/* --- 1. VARIABLES (Aligned with Register Palette: Blue/Cyan) --- */
:root {
    /* Colors */
    --bg-main: #030712;
    --bg-secondary: #0f172a;
    --bg-radial: radial-gradient(circle at 50% 0%, #1a1d26 0%, #0f1115 100%);
    
    --primary: #2563eb;
    --primary-glow: rgba(37, 99, 235, 0.4);
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.4);
    
    --error: #ef4444;
    --success: #10b981; 
    --warning: #f59e0b;
    
    /* Text */
    --text-white: #f8fafc;
    --text-gray: #94a3b8;
    --text-placeholder: #64748b;

    /* Glass Effect */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-blur: blur(20px);

    /* UI */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --font-main: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 2. RESET & BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-white);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }

/* Ambient Glows */
.ambient-glow {
    position: fixed; width: 600px; height: 600px;
    border-radius: 50%; filter: blur(140px); z-index: -1; opacity: 0.25;
    pointer-events: none;
}
.glow-1 { top: -150px; left: -150px; background: var(--primary); }
.glow-2 { bottom: -150px; right: -150px; background: var(--accent); }

/* --- 3. FIXED SMART BACK BUTTON --- */
.fixed-back-btn {
    position: fixed; top: 24px; right: 24px; z-index: 100;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px;
    background: rgba(3, 7, 18, 0.6);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 50px;
    color: var(--text-gray); font-size: 0.9rem; font-weight: 500;
    transition: var(--transition); box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.fixed-back-btn:hover {
    background: rgba(255, 255, 255, 0.1); border-color: var(--text-white);
    color: var(--text-white); transform: translateX(-3px);
}

/* --- 4. LAYOUT & CARD --- */
.login-container {
    width: 100%; padding: 24px;
    display: flex; justify-content: center; align-items: center; min-height: 100vh;
}
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px; width: 100%; max-width: 480px; position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); transition: var(--transition);
    text-align: center;
}
.glass-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

/* --- 5. HEADER & LOGO --- */
.card-header { margin-bottom: 32px; transition: var(--transition); }
.logo-link { display: inline-block; margin-bottom: 20px; }
.card-logo { 
    height: 50px; width: auto; 
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.1)); transition: var(--transition);
}
.logo-link:hover .card-logo { transform: scale(1.05); filter: drop-shadow(0 0 15px rgba(6, 182, 212, 0.4)); }
.card-header h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 8px; color: var(--text-white); margin-top: 0; }
.card-header p { color: var(--text-gray); font-size: 0.95rem; }

/* --- 6. FORMS & INPUTS --- */
.form-group { margin-bottom: 20px; position: relative; text-align: left; } /* Ensuring Left Align */
.form-group label { display: block; font-size: 0.85rem; color: var(--text-gray); margin-bottom: 8px; font-weight: 500; }
.input-wrapper { position: relative; display: flex; align-items: center; }

.input-icon {
    position: absolute; left: 16px; color: var(--text-placeholder); font-size: 1rem;
    transition: var(--transition); pointer-events: none;
}

.input-wrapper input {
    width: 100%; background: rgba(3, 7, 18, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: var(--radius-sm);
    padding: 12px 44px 12px 44px; /* Space for icon left & right */
    color: var(--text-white);
    font-size: 1rem; transition: var(--transition); outline: none;
}
.input-wrapper input:hover { border-color: rgba(255, 255, 255, 0.2); }
.input-wrapper input:focus {
    border-color: var(--accent); background: rgba(3, 7, 18, 0.8);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}
.input-wrapper input:focus ~ .input-icon { color: var(--accent); }

/* Validation Styles */
.input-wrapper.valid input { border-color: var(--success); }
.input-wrapper.valid .input-icon { color: var(--success); }
.input-wrapper.invalid input { border-color: var(--error); }
.input-wrapper.invalid .input-icon { color: var(--error); }

.error-msg { 
    display: none; color: var(--error); font-size: 0.8rem; margin-top: 6px; 
    animation: fadeIn 0.3s ease; text-align: left;
}
.input-wrapper.invalid + .error-msg { display: block; }

/* --- 7. BUTTONS --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 24px; border-radius: 50px; font-weight: 600; font-size: 1rem;
    transition: var(--transition); width: 100%; text-align: center; cursor: pointer;
}
.btn-primary {
    background: linear-gradient(90deg, var(--primary), #1d4ed8);
    color: white; box-shadow: 0 4px 20px var(--primary-glow); border: none;
}
.btn-primary:not(:disabled):hover {
    transform: translateY(-2px); box-shadow: 0 8px 30px var(--primary-glow);
}
.btn-primary:disabled {
    background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.3);
    box-shadow: none; cursor: not-allowed; border: 1px solid rgba(255,255,255,0.05);
}
.btn-block { width: 100%; }
.mt-4 { margin-top: 24px; }

/* --- 8. OTP & SUCCESS UI --- */
.view-section { animation: fadeIn 0.5s ease; }
.success-icon-wrapper {
    width: 80px; height: 80px; margin: 0 auto 24px;
    background: rgba(6, 182, 212, 0.1); border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 2rem;
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.2);
}
.pulse-anim { animation: pulseIcon 2s infinite; }
.description { color: var(--text-gray); margin-bottom: 24px; font-size: 0.95rem; line-height: 1.6; }
.highlight-text { color: var(--text-white); font-weight: 600; }

/* OTP Inputs */
.otp-container { display: flex; gap: 8px; justify-content: center; margin-bottom: 24px; }
.otp-input {
    width: 48px; height: 56px;
    background: rgba(3, 7, 18, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-size: 1.5rem; font-weight: 600; text-align: center;
    transition: var(--transition); outline: none; appearance: none; padding: 0;
}
.otp-input:focus {
    border-color: var(--accent); background: rgba(3, 7, 18, 0.8);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15); transform: translateY(-2px);
}
.otp-input::-webkit-outer-spin-button, .otp-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.otp-input[type=number] { -moz-appearance: textfield; }

/* Resend & Feedback */
.resend-wrapper { margin-top: 20px; font-size: 0.9rem; }
.btn-link {
    background: none; border: none; color: var(--accent); font-weight: 500;
    cursor: pointer; padding: 0; text-decoration: none; font-size: inherit; transition: var(--transition);
}
.btn-link:hover:not(:disabled) { color: var(--text-white); text-decoration: underline; }
.btn-link:disabled { color: var(--text-placeholder); cursor: default; opacity: 0.7; }
.timer-text { color: var(--text-gray); margin-left: 5px; }
.feedback-message { font-size: 0.9rem; margin-bottom: 16px; min-height: 20px; font-weight: 500; }
.feedback-message.error { color: var(--error); animation: shake 0.4s ease-in-out; }
.feedback-message.success { color: var(--success); }
.security-note { margin-top: 16px; font-size: 0.8rem; color: var(--text-placeholder); opacity: 0.8; }

.mt-2 { margin-top: 12px; }

/* --- 9. FOOTER --- */
.divider {
    display: flex; align-items: center; text-align: center;
    margin: 24px 0; color: var(--text-placeholder); font-size: 0.85rem;
}
.divider::before, .divider::after {
    content: ''; flex: 1; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.divider span { padding: 0 10px; text-transform: uppercase; letter-spacing: 1px; font-size: 0.75rem; }
.card-footer { text-align: center; font-size: 0.9rem; color: var(--text-gray); }
.register-link { color: var(--text-white); font-weight: 600; margin-left: 5px; }
.register-link:hover { color: var(--accent); text-decoration: underline; }

/* Utilities */
.hidden { display: none !important; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.fa-spin { animation: spin 1s linear infinite; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseIcon { 0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); } 70% { box-shadow: 0 0 0 15px rgba(6, 182, 212, 0); } 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); } }

/* --- 10. RESPONSIVE --- */
@media(max-width:767px){
    .login-container { align-items: flex-start; padding-top: 80px; }
    .glass-card { padding: 24px; }
    .fixed-back-btn { top: 16px; right: 16px; padding: 8px 16px; font-size: 0.85rem; }
    .otp-container { gap: 6px; }
    .otp-input { width: 42px; height: 50px; font-size: 1.2rem; }
}

@media (min-width: 1024px) and (max-width: 1600px) {
    .fixed-back-btn {
        top: 18px;
        right: 18px;
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .ambient-glow {
        width: 480px;
        height: 480px;
        filter: blur(112px);
    }

    .login-container {
        padding: 18px;
    }

    .glass-card {
        max-width: 384px;
        padding: 32px;
        border-radius: 19px;
    }

    .card-header {
        margin-bottom: 26px;
    }

    .card-logo {
        height: 40px;
    }

    .card-header h1 {
        font-size: 1.44rem;
    }

    .card-header p,
    .description,
    .feedback-message,
    .card-footer {
        font-size: 0.82rem;
    }

    .otp-container {
        gap: 6px;
        margin-bottom: 18px;
    }

    .otp-input {
        width: 38px;
        height: 45px;
        font-size: 1.2rem;
    }

    .btn {
        padding: 11px 18px;
        font-size: 0.88rem;
    }
}
