/* ========================================
   HIFI BOT - Auth Pages (Login / Register)
   ======================================== */

.page-auth .site-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.page-auth {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.auth-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 20px 64px;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(37, 99, 235, 0.12), transparent 55%),
        radial-gradient(ellipse 70% 50% at 85% 90%, rgba(99, 102, 241, 0.1), transparent 50%),
        linear-gradient(165deg, #f5f7fb 0%, #eef2ff 45%, #f8fafc 100%);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 75%);
    pointer-events: none;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 22px;
    padding: 40px 36px 36px;
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.04),
        0 4px 6px rgba(15, 23, 42, 0.02),
        0 20px 50px rgba(37, 99, 235, 0.1),
        0 40px 80px rgba(15, 23, 42, 0.06);
    animation: authCardIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes authCardIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    text-decoration: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.auth-brand:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.auth-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    font-size: 1.35rem;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.auth-brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.auth-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin-bottom: 8px;
}

.auth-desc {
    font-size: 0.95rem;
    color: var(--gray-500);
    line-height: 1.5;
    max-width: 320px;
    margin: 0 auto;
}

/* Alerts */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    margin-bottom: 22px;
    animation: authAlertIn 0.35s ease both;
}

@keyframes authAlertIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.auth-alert-success {
    background: var(--success-light);
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.auth-alert-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

/* Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    color: var(--gray-400);
    pointer-events: none;
    transition: color 0.2s ease;
    z-index: 1;
}

.auth-input-wrap input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: 14px;
    outline: none;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.auth-input-wrap input::placeholder {
    color: var(--gray-400);
}

.auth-input-wrap input:hover {
    border-color: var(--gray-300);
    background: var(--white);
}

.auth-input-wrap input:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.auth-input-wrap:focus-within .auth-input-icon {
    color: var(--primary);
}

/* Password toggle */
.auth-input-toggle {
    position: absolute;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--gray-400);
    border-radius: 10px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.auth-input-toggle:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}

.auth-input-wrap input.auth-input-has-toggle {
    padding-right: 48px;
}

/* Remember me */
.auth-remember {
    margin-top: -4px;
}

.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 0.88rem;
    color: var(--gray-600);
}

.auth-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.auth-checkbox-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--gray-300);
    border-radius: 6px;
    background: var(--white);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.auth-checkbox-box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    margin-top: -2px;
    transition: transform 0.15s ease;
}

.auth-checkbox input:checked + .auth-checkbox-box {
    background: var(--primary);
    border-color: var(--primary);
}

.auth-checkbox input:checked + .auth-checkbox-box::after {
    transform: rotate(45deg) scale(1);
}

.auth-checkbox input:focus-visible + .auth-checkbox-box {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Submit button */
.auth-submit {
    width: 100%;
    margin-top: 6px;
    padding: 15px 24px;
    font-size: 0.98rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
    filter: brightness(1.05);
}

.auth-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.auth-submit:focus-visible {
    outline: none;
    box-shadow:
        0 4px 14px rgba(37, 99, 235, 0.35),
        0 0 0 4px rgba(37, 99, 235, 0.25);
}

/* Footer link */
.auth-switch {
    text-align: center;
    margin-top: 26px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-100);
    font-size: 0.9rem;
    color: var(--gray-500);
}

.auth-switch a {
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-switch a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Success state */
.auth-success-box {
    text-align: center;
    padding: 12px 0 4px;
}

.auth-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--success-light);
    color: var(--success);
    margin-bottom: 20px;
    animation: authSuccessPop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes authSuccessPop {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.auth-success-box h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.auth-success-box p {
    color: var(--gray-500);
    font-size: 0.92rem;
    margin-bottom: 24px;
}

.auth-success-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--white);
    background: var(--success);
    border-radius: 14px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
}

.auth-success-btn:hover {
    color: var(--white);
    background: #15803d;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(22, 163, 74, 0.35);
}

/* Divider hint on register */
.auth-hint {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-top: 6px;
}

/* Responsive */
@media (max-width: 520px) {
    .auth-page {
        padding: 32px 16px 48px;
        align-items: flex-start;
        padding-top: 28px;
    }

    .auth-card {
        padding: 32px 24px 28px;
        border-radius: 20px;
    }

    .auth-title {
        font-size: 1.45rem;
    }

    .auth-brand-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .auth-input-wrap input {
        padding: 13px 14px 13px 44px;
        font-size: 16px; /* prevent iOS zoom */
    }
}
