/* ===== Auth Page Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-rgb: 99, 102, 241;

    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --white: #ffffff;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.25);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body.auth-body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

/* ===== Auth Body - Animated Gradient Background ===== */
.auth-body {
    font-family: var(--font-family);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    position: relative;
    overflow: hidden;
}

.auth-body::before {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    animation: floatOrb1 12s ease-in-out infinite;
    will-change: transform;
    pointer-events: none;
}

.auth-body::after {
    content: '';
    position: fixed;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
    animation: floatOrb2 10s ease-in-out infinite;
    will-change: transform;
    pointer-events: none;
}

@keyframes floatOrb1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, 40px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

@keyframes floatOrb2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-30px, -20px) scale(1.05); }
    66% { transform: translate(20px, -40px) scale(0.9); }
}

/* ===== Mesh Grid Background with Animated Glow ===== */
.auth-bg-pattern {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
}

/* Animated glowing grid lines */
.grid-glow {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.grid-glow-line {
    position: absolute;
    background: rgba(99, 102, 241, 0.08);
    animation: gridLineFade 4s ease-in-out infinite;
    opacity: 0;
}

.grid-glow-line.horizontal {
    height: 1px;
    left: 0;
    right: 0;
}

.grid-glow-line.vertical {
    width: 1px;
    top: 0;
    bottom: 0;
}

@keyframes gridLineFade {
    0%, 100% { opacity: 0; }
    30%, 70% { opacity: 1; }
}

.auth-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 16px;
    position: relative;
    z-index: 1;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

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

/* ===== Back Link ===== */
.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 16px;
    transition: var(--transition);
    text-decoration: none;
    padding: 8px 16px 8px 12px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    letter-spacing: 0.01em;
}

.auth-back:hover {
    color: #ffffff;
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(-3px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.auth-back svg {
    flex-shrink: 0;
    opacity: 0.8;
    transition: var(--transition-fast);
}

.auth-back:hover svg {
    opacity: 1;
}

/* ===== Auth Card - Glassmorphism ===== */
.auth-card {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    /* No jump animation - appear instantly */
}

.auth-card-header {
    padding: 36px 36px 0;
    text-align: center;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    margin-bottom: 18px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    transition: var(--transition);
}

.auth-logo:hover {
    transform: scale(1.05) rotate(-2deg);
}

.auth-logo svg {
    width: 32px;
    height: 32px;
}

.auth-card-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.auth-card-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    line-height: 1.5;
}

.auth-card-body {
    padding: 28px 36px 36px;
}

/* ===== Auth Form Elements ===== */
.auth-form-group {
    margin-bottom: 20px;
}

.auth-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.auth-input-wrapper {
    position: relative;
}

.auth-input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
    transition: var(--transition-fast);
}

.auth-input {
    width: 100%;
    padding: 13px 16px 13px 44px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: var(--transition-fast);
    outline: none;
    font-family: var(--font-family);
    font-weight: 400;
}

.auth-input::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.auth-input:hover {
    border-color: var(--gray-300);
    background: var(--white);
}

.auth-input:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
}

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

.auth-input.is-invalid {
    border-color: var(--danger);
    background: #fff5f5;
}

.auth-input.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

/* Password field needs right padding for eye button */
.auth-input-wrapper .auth-input[type="password"],
.auth-input-wrapper .auth-input[data-password-field] {
    padding-right: 50px;
}

/* ===== Toggle Password Eye Button ===== */
.auth-input-wrapper .toggle-password {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: var(--gray-400);
    cursor: pointer;
    transition: var(--transition-fast);
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    padding: 0;
    line-height: 1;
}

.auth-input-wrapper .toggle-password:hover {
    color: var(--primary);
    background: var(--primary-50);
}

.auth-input-wrapper .toggle-password:active {
    transform: translateY(-50%) scale(0.92);
}

.auth-input-wrapper .toggle-password svg {
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

.auth-error {
    color: var(--danger);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== Auth Extras ===== */
.auth-extras {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: nowrap;
    gap: 8px;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
    user-select: none;
}

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

.auth-forgot {
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 600;
    transition: var(--transition-fast);
    text-decoration: none;
}

.auth-forgot:hover {
    color: var(--primary-dark);
}

/* ===== Auth Button ===== */
.auth-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: var(--white);
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.auth-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: var(--transition-fast);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.4);
}

.auth-btn:hover::before {
    opacity: 1;
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== Spinner ===== */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.auth-btn.loading .btn-text {
    opacity: 0;
}

.auth-btn.loading .spinner {
    display: block;
    position: absolute;
}

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

/* ===== Auth Alert ===== */
.auth-alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-alert-success {
    background: var(--success-light);
    color: #047857;
    border: 1px solid #a7f3d0;
}

.auth-alert-danger {
    background: var(--danger-light);
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

/* ===== OTP Input ===== */
.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0;
}

.otp-input {
    width: 50px;
    height: 58px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition-fast);
    color: var(--gray-900);
    background: var(--gray-50);
    font-family: var(--font-family);
    caret-color: var(--primary);
}

.otp-input:hover {
    border-color: var(--gray-300);
}

.otp-input:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
    transform: translateY(-2px);
}

.otp-input.is-invalid {
    border-color: var(--danger);
    animation: shake 0.3s ease;
}

@keyframes shake {
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

/* ===== Auth Responsive ===== */
@media (max-width: 520px) {
    .auth-wrapper {
        max-width: 100%;
        padding: 10px;
    }
    .auth-card-header {
        padding: 28px 20px 0;
    }
    .auth-card-body {
        padding: 24px 20px 28px;
    }
    .auth-card-title {
        font-size: 1.3rem;
    }
    .auth-card-subtitle {
        font-size: 0.8125rem;
    }
    .auth-logo {
        width: 52px;
        height: 52px;
        border-radius: 14px;
    }
    .auth-logo svg {
        width: 28px;
        height: 28px;
    }
    .otp-inputs {
        gap: 8px;
    }
    .otp-input {
        width: 44px;
        height: 52px;
        font-size: 1.25rem;
    }
    .auth-remember {
        font-size: 0.75rem;
        gap: 6px;
    }
    .auth-remember input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
    .auth-forgot {
        font-size: 0.75rem;
        white-space: nowrap;
    }
}

@media (max-width: 380px) {
    .auth-wrapper {
        padding: 6px;
    }
    .auth-card-header {
        padding: 24px 16px 0;
    }
    .auth-card-body {
        padding: 20px 16px 24px;
    }
    .auth-card-title {
        font-size: 1.2rem;
    }
    .otp-input {
        width: 38px;
        height: 46px;
        font-size: 1.1rem;
    }
    .auth-remember {
        font-size: 0.7rem;
        gap: 4px;
    }
    .auth-remember input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
    .auth-forgot {
        font-size: 0.7rem;
    }
}

.otp-resend {
    text-align: center;
    margin-top: 20px;
}

.otp-resend-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: var(--font-family);
    transition: var(--transition-fast);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

.otp-resend-btn:hover {
    background: var(--primary-50);
}

.otp-resend-btn:disabled {
    color: var(--gray-400);
    cursor: not-allowed;
    background: none;
}

/* ===== Custom Tooltips ===== */
.custom-tooltip {
    position: fixed;
    z-index: 10000;
    padding: 6px 12px;
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    color: #fff;
    background: var(--gray-800);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 1px 4px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--gray-800);
    transform: rotate(45deg);
}

.custom-tooltip.tooltip-bottom::after {
    top: -4px;
    left: 50%;
    margin-left: -4px;
}

.custom-tooltip.tooltip-top::after {
    bottom: -4px;
    left: 50%;
    margin-left: -4px;
}

.otp-timer {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ===== Auth Footer Text ===== */
.auth-footer-text {
    text-align: center;
    padding: 20px 40px 28px;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.auth-footer-text a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
}

.auth-footer-text a:hover {
    color: var(--primary-dark);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    
    .auth-body {
        min-height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 16px;
    }

    .auth-card-header {
        padding: 32px 24px 0;
    }

    .auth-card-body {
        padding: 28px 24px 32px;
    }

    .auth-card-title {
        font-size: 1.375rem;
    }

    .auth-logo {
        width: 56px;
        height: 56px;
        border-radius: 16px;
    }

    .otp-inputs {
        gap: 8px;
    }

    .otp-input {
        width: 46px;
        height: 54px;
        font-size: 1.25rem;
    }

    .auth-extras {
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
    }
}
