/* =========================================
   CSQuiz - Modern Gamified UI (Light Theme)
   ========================================= */

/* Base Reset & Fonts */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, sans-serif;
}

body {
    /* Soft light background */
    background-color: #f8fafc;
    background-image: radial-gradient(circle at top right, #ffffff, #f1f5f9);
    color: #0f172a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Card Layout - Glassmorphism touch */
.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    perspective: 1000px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08), 
                inset 0 1px 0 rgba(255, 255, 255, 0.6);
    padding: 40px 35px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.12), 
                inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.card-header {
    text-align: center;
    margin-bottom: 35px;
}

.card-header h2 {
    color: #0f172a;
    margin-bottom: 10px;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    /* Adding a subtle text gradient */
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-header p {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Form Inputs */
.input-group {
    margin-bottom: 22px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #475569;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

.input-group input[type="text"],
.input-group input[type="email"],
.input-group input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    color: #0f172a;
    transition: all 0.3s ease;
}

.input-group input::placeholder {
    color: #94a3b8;
}

.input-group input:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
    background-color: #ffffff;
}

/* Password Wrapper & Span Icon */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 15px;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #38bdf8;
}

/* Button - Modern Gradient */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #38bdf8 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

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

/* Footer Links */
.card-footer {
    text-align: center;
    margin-top: 30px;
    font-size: 0.95rem;
    color: #64748b;
}

.card-footer a {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.card-footer a:hover {
    color: #818cf8;
    text-decoration: underline;
}

/* --- Modern UI Alerts (Toast Style) --- */
.alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 90vw;
    width: fit-content;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
    cursor: pointer;
    z-index: 9999;
    animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: opacity 0.3s ease;
}

.alert-success {
    background-color: rgba(220, 252, 231, 0.95);
    color: #065f46;
    border: 1px solid #34d399;
    backdrop-filter: blur(8px);
}

.alert-error {
    background-color: rgba(254, 226, 226, 0.95);
    color: #991b1b;
    border: 1px solid #f87171;
    backdrop-filter: blur(8px);
}

.alert-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        top: -50px;
        transform: translateX(-50%) scale(0.9);
    }
    to {
        opacity: 1;
        top: 20px;
        transform: translateX(-50%) scale(1);
    }
}
/* =========================================
   Register Page - Additional Styles
   ========================================= */

/* ── Card width bump for the wider layout ── */
.register-page .auth-container { max-width: 480px; }

/* ── Name row: side-by-side ── */
.name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ── Role cards ── */
.role-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 22px;
}

.role-card {
    position: relative;
    cursor: pointer;
}

.role-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.role-card label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}

.role-card label:hover {
    border-color: #38bdf8;
    background-color: #eff6ff;
}

.role-card input:checked + label {
    border-color: #38bdf8;
    background-color: rgba(56, 189, 248, 0.08);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.role-card .role-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.role-card .role-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.role-card .role-desc {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
    font-weight: 400;
    letter-spacing: 0;
}

.role-card input:checked + label .role-title {
    color: #38bdf8;
}

/* ── Section label (used above role cards) ── */
.section-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #475569;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

/* ── Inline field hints ── */
.field-hint {
    font-size: 0.78rem;
    margin-top: 5px;
    min-height: 18px;
    transition: color 0.2s;
    color: #64748b;
}

.field-hint.valid   { color: #059669; }
.field-hint.invalid { color: #dc2626; }

/* ── Password strength bar ── */
.strength-wrap {
    margin-top: 8px;
}

.strength-bar-track {
    height: 4px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.strength-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    transition: width 0.35s ease, background-color 0.35s ease;
}

.strength-label {
    font-size: 0.78rem;
    margin-top: 5px;
    color: #64748b;
    min-height: 18px;
}

/* ── Confirm match icon ── */
.match-icon {
    position: absolute;
    right: 46px;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.match-icon.show { opacity: 1; }

/* ── Input error state ── */
.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15) !important;
}

/* ── Submit button loading state ── */
.btn-primary.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Form divider ── */
.form-divider {
    border: none;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    margin: 6px 0 22px;
}

/* ── Select input (role dropdown fallback) ── */
.input-group select {
    width: 100%;
    padding: 14px 16px;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    color: #0f172a;
    transition: all 0.3s ease;
    appearance: none;
    cursor: pointer;
}

.input-group select:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
    background-color: #ffffff;
}

/* =========================================
   Login Page - Additional Styles
   ========================================= */

/* ── Forgot password link ── */
.forgot-link-wrap {
    text-align: right;
    margin-bottom: 20px;
}

.forgot-link {
    font-size: 0.85rem;
    color: #38bdf8;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.forgot-link:hover {
    color: #818cf8;
}

/* ── Password field spacing tweak on login ── */
.login-page .input-group.password-group {
    margin-bottom: 10px;
}

/* ── Card shake on invalid credentials ── */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%       { transform: translateX(-8px); }
    30%       { transform: translateX(8px); }
    45%       { transform: translateX(-6px); }
    60%       { transform: translateX(6px); }
    75%       { transform: translateX(-3px); }
    90%       { transform: translateX(3px); }
}

.auth-card.shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}