/**
 * Math Captcha Styles
 */

.math-captcha {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.math-captcha-title {
    font-size: 14px;
    color: #8094ae;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 400;
}

.math-problem-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f5f7fa;
    border: 1px solid #dbdfea;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.math-problem {
    font-size: 24px;
    font-weight: 600;
    color: #364a63;
    min-width: 120px;
    text-align: center;
}

.math-input {
    flex: 1;
    height: 45px;
    padding: 0 15px;
    font-size: 18px;
    font-weight: 500;
    border: 2px solid #dbdfea;
    border-radius: 6px;
    outline: none;
    transition: all 0.3s;
    background: #fff;
    color: #364a63;
}

.math-input:focus {
    border-color: #6576ff;
    box-shadow: 0 0 0 3px rgba(101, 118, 255, 0.1);
}

.math-input.success {
    border-color: #1ee0ac;
    background: #e7fcf5;
}

.math-input.error {
    border-color: #e85347;
    background: #fef4f3;
    animation: shake 0.5s ease-in-out;
}

.math-input:disabled {
    background: #f5f7fa;
    cursor: not-allowed;
}

.math-refresh {
    width: 40px;
    height: 40px;
    background: #fff;
    border: 2px solid #dbdfea;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: #8094ae;
    flex-shrink: 0;
}

.math-refresh:hover {
    background: #6576ff;
    border-color: #6576ff;
    color: #fff;
    transform: rotate(180deg);
}

.math-refresh svg {
    pointer-events: none;
}

.math-message {
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
    min-height: 20px;
    font-weight: 500;
}

.math-message.success {
    color: #1ee0ac;
    animation: fadeIn 0.3s ease-in;
}

.math-message.error {
    color: #e85347;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Mobile Responsive - Tablets and smaller */
@media (max-width: 768px) {
    .math-captcha {
        max-width: 100%;
        padding: 0 15px;
    }
}

/* Mobile Responsive - Small phones */
@media (max-width: 480px) {
    .math-captcha {
        padding: 0 10px;
    }

    .math-captcha-title {
        font-size: 13px;
    }

    .math-problem-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .math-problem {
        font-size: 22px;
        min-width: auto;
    }

    .math-input {
        height: 42px;
        font-size: 16px;
    }

    .math-refresh {
        align-self: center;
        width: 38px;
        height: 38px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .math-problem {
        font-size: 20px;
    }

    .math-input {
        height: 40px;
        font-size: 15px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .math-captcha-title {
        color: #c4cefe;
    }

    .math-problem-container {
        background: #1c2b46;
        border-color: #2d3e5f;
    }

    .math-problem {
        color: #e6e8eb;
    }

    .math-input {
        background: #141d2e;
        border-color: #2d3e5f;
        color: #e6e8eb;
    }

    .math-input:focus {
        border-color: #8692ff;
        box-shadow: 0 0 0 3px rgba(134, 146, 255, 0.15);
    }

    .math-input.success {
        border-color: #1ee0ac;
        background: #0d3d2f;
    }

    .math-input.error {
        border-color: #e85347;
        background: #3d1916;
    }

    .math-refresh {
        background: #1c2b46;
        border-color: #2d3e5f;
        color: #c4cefe;
    }

    .math-refresh:hover {
        background: #6576ff;
        border-color: #6576ff;
        color: #fff;
    }
}

/* Loading state */
.math-captcha.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Disabled state */
.math-captcha.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Remove number input arrows on Firefox */
.math-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Remove number input arrows on Chrome, Safari, Edge */
.math-input[type=number]::-webkit-outer-spin-button,
.math-input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .math-refresh {
        min-width: 44px;
        min-height: 44px;
    }

    .math-input {
        min-height: 44px;
    }
}
