/* Authentication Pages Styles */

.auth-page {
    min-height: calc(100vh - 80px - 200px); /* viewport - navbar - footer */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    width: 100%;
    max-width: 500px;
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header .logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
    text-decoration: none;
    margin-bottom: 20px;
}

.auth-header .logo i {
    font-size: 32px;
}

.auth-header h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.auth-header p {
    color: #666;
    font-size: 14px;
}

.auth-form {
    margin-top: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group label i {
    margin-right: 5px;
    color: #667eea;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-block {
    width: 100%;
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #eee;
}

.auth-footer p {
    color: #666;
    font-size: 14px;
    margin: 10px 0;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Alert Messages */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.alert i {
    font-size: 18px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-success i {
    color: #28a745;
}

.alert-danger,
.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-danger i,
.alert-error i {
    color: #dc3545;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-info i {
    color: #17a2b8;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-warning i {
    color: #ffc107;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 25px 0;
    color: #999;
    font-size: 14px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.divider span {
    padding: 0 15px;
}

/* Password Strength Indicator */
.password-strength {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: all 0.3s;
    border-radius: 2px;
}

.password-strength-bar.weak {
    width: 33%;
    background: #dc3545;
}

.password-strength-bar.medium {
    width: 66%;
    background: #ffc107;
}

.password-strength-bar.strong {
    width: 100%;
    background: #28a745;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-group label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

/* Loading State */
.btn-primary.loading {
    position: relative;
    color: transparent;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .auth-page {
        padding: 40px 15px;
    }
    
    .auth-card {
        padding: 30px 20px;
    }
    
    .auth-header h2 {
        font-size: 20px;
    }
}

/* Success Icon Animation */
.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: #28a745;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s ease-out;
}

.success-icon i {
    font-size: 40px;
    color: white;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Sharp auth refresh */
.auth-page {
    min-height: calc(100vh - 80px);
    min-height: calc(100svh - 80px);
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 132px 20px 70px;
    background:
        radial-gradient(circle at top left, rgba(15, 107, 255, 0.12), transparent 34%),
        linear-gradient(180deg, #f8fafc, #eef4ff);
}

.auth-card {
    border: 1px solid #dfe6ef;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.1);
}

.auth-header h2 {
    color: #111827;
    font-size: 1.6rem;
    font-weight: 900;
}

.auth-header p,
.auth-footer p,
.form-group small {
    color: #5f6b7a;
}

.form-group label {
    color: #111827;
    font-weight: 800;
}

.form-group label i,
.auth-footer a {
    color: #0f6bff;
}

.form-group input,
.form-group textarea,
.form-group select {
    min-height: 48px;
    border: 1px solid #dfe6ef;
    border-radius: 7px;
    font-weight: 650;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #0f6bff;
    box-shadow: 0 0 0 4px rgba(15, 107, 255, 0.1);
}

.auth-form .btn-primary,
.btn-block {
    width: 100%;
    border-radius: 7px;
    background: #0f6bff;
    color: #fff !important;
    font-weight: 900;
}

body:not(.premium-home) .auth-form .btn-primary,
body:not(.premium-home) .auth-form .btn-block {
    width: 100%;
    min-height: 50px;
    border-radius: 7px;
    background: #0f6bff;
    color: #fff !important;
    box-shadow: none;
}

.auth-form .btn-primary:hover {
    background: #084ec0;
    box-shadow: 0 14px 28px rgba(15, 107, 255, 0.2);
}

.alert {
    border-radius: 7px;
}

@media (max-width: 768px) {
    .auth-page {
        min-height: calc(100svh - 64px);
        padding: 100px 15px 48px;
    }
}

/* KAYAK-inspired auth modal */
.auth-screen .navbar,
.auth-screen .footer {
    display: none;
}

.auth-modal-page {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    padding: 34px 20px;
    display: grid;
    place-items: center;
    justify-items: center;
    align-items: center;
    background:
        linear-gradient(rgba(17, 24, 39, 0.62), rgba(17, 24, 39, 0.62)),
        url('https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1800&q=80') center/cover fixed;
}

.auth-modal-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(246, 248, 251, 0.18);
    backdrop-filter: blur(2px);
}

.auth-modal-page .auth-container {
    position: fixed;
    z-index: 1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(580px, calc(100vw - 48px));
    max-width: 580px;
    margin-inline: auto;
}

.auth-modal-card {
    position: relative;
    border: 0;
    width: 100%;
    border-radius: 22px;
    max-height: calc(100svh - 68px);
    overflow-y: auto;
    padding: 32px 36px 30px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.32);
}

.auth-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.auth-back-link,
.auth-close-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #111827;
    text-decoration: none;
    font-size: 0.98rem;
    font-weight: 750;
}

.auth-close-link {
    width: 38px;
    height: 38px;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.45rem;
}

.auth-back-link:hover,
.auth-close-link:hover {
    background: #f3f6fa;
    color: #0f6bff;
}

.auth-modal-card .auth-header {
    max-width: 520px;
    margin-bottom: 14px;
    text-align: left;
}

.auth-modal-card .auth-header h1 {
    margin: 0 0 12px;
    color: #171e26;
    font-size: clamp(1.9rem, 3vw, 2.35rem);
    line-height: 1.05;
    font-weight: 950;
    letter-spacing: 0;
}

.auth-modal-card .auth-header h1 span {
    color: #ff5a1f;
}

.auth-modal-card .auth-header p {
    max-width: 520px;
    color: #242c35;
    font-size: 0.95rem;
    line-height: 1.4;
}

.auth-benefits {
    margin: 14px 0 20px 20px;
    color: #202832;
    font-size: 0.9rem;
    line-height: 1.4;
}

.auth-benefits li + li {
    margin-top: 3px;
}

.social-auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.social-auth-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 2px solid #171e26;
    border-radius: 9px;
    background: #fff;
    color: #171e26;
    font-size: 0.95rem;
    font-weight: 900;
    cursor: pointer;
    transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
}

.social-auth-btn:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.08);
}

.social-auth-btn .fa-google {
    color: #4285f4;
}

.social-auth-btn .fa-apple {
    font-size: 1.22rem;
}

.auth-modal-card .divider {
    margin: 20px 0 18px;
    color: #5f6b7a;
    font-size: 0.95rem;
}

.auth-modal-card .divider::before,
.auth-modal-card .divider::after {
    border-bottom-color: #d5dde7;
}

.auth-modal-card .auth-form {
    margin-top: 0;
}

.auth-stepper {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0 0 24px;
}

.auth-stepper span {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d5dde7;
    border-radius: 999px;
    background: #f8fafc;
    color: #667382;
    font-size: 0.85rem;
    font-weight: 900;
    text-transform: uppercase;
}

.auth-stepper span.active {
    border-color: #171e26;
    background: #171e26;
    color: #fff;
}

.auth-step-panel {
    display: none;
}

.auth-step-panel.active {
    display: block;
}

.auth-code-intro {
    margin-bottom: 18px;
}

.auth-code-intro h2 {
    margin-bottom: 8px;
    color: #171e26;
    font-size: clamp(1.45rem, 2.5vw, 1.85rem);
    line-height: 1.12;
    font-weight: 950;
}

.auth-code-intro p {
    color: #35404c;
    font-size: 0.98rem;
    line-height: 1.45;
}

.code-inputs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.code-inputs input {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid #a8b4c0;
    border-radius: 8px;
    background: #f8fafc;
    color: #171e26;
    text-align: center;
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    font-weight: 900;
}

.code-inputs input:focus {
    outline: none;
    border-color: #171e26;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(15, 107, 255, 0.1);
}

.code-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 16px;
    border-radius: 10px;
    background: #f0f9ff;
    color: #0369a1;
    font-size: 0.88rem;
    font-weight: 600;
}
.code-countdown i {
    font-size: 0.9rem;
}
.code-countdown strong {
    font-variant-numeric: tabular-nums;
    font-size: 1.05rem;
}
.code-countdown.expired {
    background: #fef2f2;
    color: #dc2626;
}

.spam-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 0.85rem;
    line-height: 1.5;
}
.spam-notice i {
    margin-top: 2px;
    flex-shrink: 0;
    color: #d97706;
}
.spam-notice p {
    margin: 0;
}
.spam-notice em {
    font-style: normal;
    color: #78350f;
    font-weight: 600;
}

.resend-code-text {
    margin-top: 14px;
    color: #35404c;
    font-size: 0.92rem;
    line-height: 1.5;
    text-align: center;
}

.resend-code-text button {
    border: 0;
    background: transparent;
    color: #0077a3;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    padding: 0;
}

.resend-code-text button:disabled {
    color: #94a3b8;
    cursor: not-allowed;
}

.resend-code-text button span {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.verified-email-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    border: 1px solid #bbf7d0;
    border-radius: 9px;
    background: #f0fdf4;
    color: #166534;
    padding: 11px 14px;
    font-weight: 900;
}

.verified-email-badge i {
    color: #16a34a;
}

.auth-modal-card .form-group {
    margin-bottom: 14px;
}

.auth-modal-card .form-group label {
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

.auth-modal-card .form-group input {
    min-height: 48px;
    border: 2px solid #a8b4c0;
    border-radius: 8px;
    padding: 0 16px;
    color: #171e26;
    font-size: 0.98rem;
    font-weight: 700;
}

.auth-modal-card .form-group input:focus {
    border-color: #171e26;
    box-shadow: 0 0 0 4px rgba(15, 107, 255, 0.1);
}

body:not(.premium-home) .auth-modal-card .auth-form .btn-primary,
.auth-modal-card .auth-form .btn-primary {
    min-height: 50px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ff6b1a, #ef2f21);
    color: #fff !important;
    font-size: 0.98rem;
    font-weight: 950;
}

body:not(.premium-home) .auth-modal-card .auth-form .btn-primary:hover,
.auth-modal-card .auth-form .btn-primary:hover {
    background: linear-gradient(135deg, #ff7a1f, #d92318);
    box-shadow: 0 18px 34px rgba(239, 47, 33, 0.22);
}

.auth-modal-card .auth-footer {
    margin-top: 18px;
    padding-top: 0;
    border-top: 0;
}

.auth-modal-card .auth-footer p {
    font-size: 0.9rem;
}

.auth-legal {
    margin-top: 16px !important;
    color: #667382 !important;
}

.auth-modal-card .auth-footer a,
.auth-legal a {
    color: #0077a3;
}

.auth-modal-card .alert {
    border-radius: 12px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .auth-modal-page {
        padding: 20px 14px;
        place-items: center;
    }

    .auth-modal-page .auth-container {
        width: min(330px, calc(100vw - 28px));
        max-width: 330px;
    }

    .auth-modal-card {
        border-radius: 18px;
        max-height: calc(100svh - 40px);
        padding: 18px 18px;
    }

    .auth-card-actions {
        margin-bottom: 12px;
    }

    .auth-modal-card .auth-header h1 {
        font-size: 1.48rem;
    }

    .auth-modal-card .auth-header {
        margin-bottom: 10px;
    }

    .auth-modal-card .auth-header p,
    .auth-benefits {
        font-size: 0.8rem;
    }

    .auth-benefits {
        margin: 10px 0 14px 18px;
    }

    .auth-modal-card .divider {
        margin: 14px 0 12px;
    }

    .auth-modal-card .form-group {
        margin-bottom: 10px;
    }

    .social-auth-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .auth-modal-card .form-group input,
    .social-auth-btn,
    body:not(.premium-home) .auth-modal-card .auth-form .btn-primary,
    .auth-modal-card .auth-form .btn-primary {
        min-height: 44px;
    }

    .auth-modal-card .auth-footer {
        margin-top: 12px;
    }

    .auth-modal-card .auth-footer p {
        font-size: 0.82rem;
    }

    .auth-legal {
        margin-top: 10px !important;
    }

    .code-inputs {
        gap: 8px;
    }
}

/* Auth balance guard */
.auth-modal-page,
.auth-modal-page *,
.auth-page,
.auth-page * {
    min-width: 0;
}

.auth-modal-page .auth-container {
    max-height: calc(100svh - 40px);
}

.auth-modal-card {
    overscroll-behavior: contain;
}

.auth-modal-card .auth-form .btn-primary,
body:not(.premium-home) .auth-modal-card .auth-form .btn-primary {
    width: 100%;
    max-width: 100%;
    white-space: normal;
}

.auth-modal-card .form-group input,
.code-inputs input {
    max-width: 100%;
}

@media (max-width: 420px) {
    .auth-modal-page .auth-container {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }

    .auth-modal-card {
        padding: 18px 16px;
    }

    .code-inputs {
        gap: 6px;
    }
}
