/**
 * Auth Modal Styles - Premium Design
 * 登录弹框样式 - 现代化高级设计
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==================== Variables ==================== */
/* Variables are now inherited from variables.css */


/* ==================== Modal Container ==================== */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.auth-modal--open {
    opacity: 1;
    visibility: visible;
}

/* ==================== Overlay ==================== */
.auth-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    /* Slate 900 with opacity */
    backdrop-filter: blur(8px);
    /* Glassmorphism effect */
    transition: all 0.3s ease;
}

/* ==================== Modal Dialog ==================== */
.auth-modal__container {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
    margin: 1rem;
    /* Hide scrollbar */
    scrollbar-width: none;
}

.auth-modal__container::-webkit-scrollbar {
    display: none;
}

.auth-modal--open .auth-modal__container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ==================== Close Button ==================== */
.auth-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
    z-index: 10;
    font-size: 18px;
}

.auth-modal__close:hover {
    background-color: #f1f5f9;
    color: var(--color-text-primary);
    transform: rotate(90deg);
}

/* ==================== Auth Card ==================== */
.auth-modal .auth-card {
    padding: 2.5rem;
    background: transparent;
    box-shadow: none;
    border: none;
}

/* ==================== Header ==================== */
.auth-modal .auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-modal .auth-header .auth-logo {
    display: inline-block;
    margin-bottom: 1rem;
}

.auth-modal .auth-header .auth-logo img {
    height: 40px;
    width: auto;
}

.auth-modal .auth-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.025em;
}

.auth-modal .auth-header p {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ==================== Tabs ==================== */
.auth-modal .auth-tabs {
    display: flex;
    background-color: var(--color-bg-secondary);
    padding: 6px;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    position: relative;
    border: 1px solid var(--color-gray-200);
}

.auth-modal .auth-tab {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 1;
}

.auth-modal .auth-tab:hover {
    color: var(--color-text-primary);
}

.auth-modal .auth-tab--active,
.auth-modal .auth-tab.auth-tab--active {
    background-color: #ffffff;
    color: var(--color-primary-500);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ==================== Form ==================== */
.auth-modal .auth-form {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.auth-modal .form-group {
    margin-bottom: 1.25rem;
}

.auth-modal .form-group>label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.auth-modal .input-icon {
    position: relative;
    transition: var(--transition-normal);
}

.auth-modal .input-icon>i:first-child {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
    pointer-events: none;
    transition: color 0.2s;
}

.auth-modal .input-icon input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    font-size: 15px;
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
    transition: all 0.2s;
}

.auth-modal .input-icon input:hover {
    border-color: #cbd5e1;
    background-color: #ffffff;
}

.auth-modal .input-icon input:focus {
    outline: none;
    border-color: var(--color-primary-500);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.auth-modal .input-icon input:focus+i,
.auth-modal .input-icon input:focus~i {
    color: var(--color-primary-500);
}

.auth-modal .input-icon input::placeholder {
    color: #94a3b8;
}

/* Password toggle */
.auth-modal .toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.auth-modal .toggle-password:hover {
    color: var(--color-text-primary);
}

/* ==================== Form Row ==================== */
.auth-modal .form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-modal .form-row--between {
    justify-content: space-between;
}

/* Checkbox */
.auth-modal .checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.auth-modal .checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary-500);
    cursor: pointer;
    border-radius: 4px;
}

/* Form link */
.auth-modal .form-link {
    font-size: 0.875rem;
    color: var(--color-primary-500);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-modal .form-link:hover {
    color: var(--color-primary-600);
    text-decoration: underline;
}

/* ==================== Error Message ==================== */
.auth-modal .form-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin: 1rem 0;
    padding: 12px 16px;
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    border-radius: var(--radius-lg);
    display: none;
    align-items: center;
    gap: 8px;
}

.auth-modal .form-error:before {
    content: '\f071';
    /* Font Awesome warning icon code */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

.auth-modal .form-error:not(:empty) {
    display: flex;
}

/* ==================== Turnstile ==================== */
.auth-modal .cf-turnstile {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

/* ==================== Submit Button ==================== */
.auth-modal .btn--full {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-lg);
    background-color: var(--color-primary-500);
    color: white;
    border: none;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.auth-modal .btn--full:hover {
    background-color: var(--color-primary-600);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

.auth-modal .btn--full:active {
    transform: translateY(0);
}

.auth-modal .btn--full:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==================== Divider ==================== */
.auth-modal .form-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.auth-modal .form-divider::before,
.auth-modal .form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--color-gray-200);
}

.auth-modal .form-divider span {
    padding: 0 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==================== Social Login ==================== */
.auth-modal .social-login {
    display: flex;
    gap: 12px;
}

.auth-modal .social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    background: #fff;
    color: var(--color-text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-modal .social-btn:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.auth-modal .social-btn--google i {
    color: #ea4335;
    font-size: 18px;
}

/* ==================== Password Strength ==================== */
.auth-modal .password-strength {
    height: 4px;
    background-color: var(--color-gray-200);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
    display: none;
}

.auth-modal .password-strength-bar {
    height: 100%;
    width: 0;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease;
}

.auth-modal .password-strength-text {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 6px;
    display: none;
    text-align: right;
}

.auth-modal .form-hint {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 6px;
    display: block;
}

/* ==================== Register Form Specific ==================== */
.auth-modal #registerForm .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.auth-modal #registerForm .form-row .form-group {
    margin-bottom: 0;
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-modal .auth-form>* {
    animation: fadeIn 0.4s ease-out forwards;
}

.auth-modal .auth-form>*:nth-child(1) {
    animation-delay: 0.05s;
}

.auth-modal .auth-form>*:nth-child(2) {
    animation-delay: 0.1s;
}

.auth-modal .auth-form>*:nth-child(3) {
    animation-delay: 0.15s;
}

.auth-modal .auth-form>*:nth-child(4) {
    animation-delay: 0.2s;
}

.auth-modal .auth-form>*:nth-child(5) {
    animation-delay: 0.25s;
}

/* ==================== Responsive ==================== */
@media (max-width: 767px) {
    .auth-modal {
        align-items: flex-end;
    }

    .auth-modal__container {
        max-width: 100%;
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        transform: scale(1) translateY(100%);
    }

    .auth-modal--open .auth-modal__container {
        transform: scale(1) translateY(0);
    }

    .auth-modal .auth-card {
        padding: 24px 20px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
    }

    .auth-modal .auth-header {
        margin-bottom: 1.5rem;
        margin-top: 0.5rem;
    }

    .auth-modal__close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        background-color: #f8fafc;
    }

    .auth-modal .input-icon input {
        padding: 16px 16px 16px 44px;
        font-size: 16px;
    }

    .auth-modal .btn--full {
        padding: 16px;
    }

    .auth-modal .social-login {
        flex-direction: row;
        gap: 12px;
    }

    .auth-modal .social-btn {
        padding: 14px;
    }

    .auth-modal #registerForm .form-row {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}