/* --- Base Variables & Setup --- */
:root {
    --bg-gradient-1: #0f172a; 
    --bg-gradient-2: #1e1b4b; 
    --bg-gradient-3: #312e81;
    --accent-color: #3b82f6; 
    --accent-hover: #2563eb;
    --success: #10b981; 
    --warning: #f59e0b; 
    --danger: #ef4444;
    --text-light: #f8fafc; 
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.05); 
    --glass-border: rgba(255, 255, 255, 0.15);
    --radius-lg: 20px; 
    --radius-md: 12px; 
    --radius-sm: 8px;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Segoe UI', Roboto, sans-serif; 
}

html { height: -webkit-fill-available; }

body {
    background-color: var(--bg-gradient-1); 
    color: var(--text-light);
    overflow-x: hidden; 
    line-height: 1.6; 
    min-height: 100vh;
    display: flex; 
    align-items: center; 
    justify-content: center;
}

/* --- Animated Background --- */
.bg-animation {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1;
    background: linear-gradient(-45deg, var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3));
    background-size: 400% 400%; 
    animation: gradientBG 15s ease infinite; 
    transform: translateZ(0);
}
@keyframes gradientBG { 
    0% { background-position: 0% 50%; } 
    50% { background-position: 100% 50%; } 
    100% { background-position: 0% 50%; } 
}

/* --- Utilities --- */
.d-none { display: none !important; } 
.d-flex { display: flex; } 
.d-block { display: block; }
.justify-between { justify-content: space-between; } 
.align-center { align-items: center; } 
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); } 
.text-success { color: var(--success); } 
.text-danger { color: var(--danger); } 
.text-accent { color: var(--accent-color); }
.text-sm { font-size: 0.85rem; } 
.text-xs { font-size: 0.75rem; line-height: 1.3; }
.font-bold { font-weight: bold; } 
.text-decoration-none { text-decoration: none; }
.m-0 { margin: 0; } 
.mt-1 { margin-top: 0.25rem; } 
.mt-2 { margin-top: 0.5rem; } 
.mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; } 
.mb-2 { margin-bottom: 0.5rem; } 
.mb-3 { margin-bottom: 1rem; }
.w-100 { width: 100%; } 
.gap-1 { gap: 0.25rem; } 
.py-3 { padding-top: 1rem; padding-bottom: 1rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.relative { position: relative; } 
.overflow-hidden { overflow: hidden; } 
.cursor-pointer { cursor: pointer; }

/* --- Branding & Containers --- */
.brand { font-size: 1.8rem; font-weight: 700; color: var(--text-light); text-decoration: none; }
.brand span { color: var(--accent-color); }

.auth-container { width: 100%; max-width: 450px; padding: 1.5rem; z-index: 10; }

.glass-card { 
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15); 
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg); 
    padding: 2rem;
}

/* --- Inputs & Icons --- */
.input-group { position: relative; width: 100%; }
.input-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1rem; z-index: 2; pointer-events: none;}
.eye-icon { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1rem; cursor: pointer; z-index: 2; transition: color 0.2s; }
.eye-icon:hover { color: var(--text-light); }

.glass-input {
    width: 100%; padding: 0.8rem 2.5rem 0.8rem 2.5rem; border-radius: var(--radius-md);
    background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); 
    color: white; outline: none; font-size: 1rem; transition: all 0.3s ease;
}
.glass-input::placeholder { color: rgba(255,255,255,0.4); }
.glass-input:focus { border-color: var(--accent-color); background: rgba(255,255,255,0.1); box-shadow: 0 0 15px rgba(59, 130, 246, 0.2); }

/* --- Password Strength Indicators --- */
.password-requirements {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 8px;
}
.req-item {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.3s ease;
}
.req-item i { font-size: 0.8rem; transition: transform 0.3s ease; }
.req-item.valid { color: var(--success); }
.req-item.valid i::before { content: "\f058"; }
.req-item.valid i { transform: scale(1.1); }

/* --- Role Selector --- */
.role-selector { display: flex; gap: 10px; background: rgba(0,0,0,0.2); padding: 5px; border-radius: var(--radius-md); border: 1px solid var(--glass-border); }
.role-option { flex: 1; text-align: center; }
.role-option input { display: none; }
.role-btn { display: block; padding: 0.6rem; border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: 0.3s; }
.role-option input:checked + .role-btn { background: var(--accent-color); color: white; box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3); }

/* --- Cloudflare Override --- */
.cf-turnstile { display: flex; justify-content: center; }

/* --- Buttons --- */
button { cursor: pointer; border: none; outline: none; transition: 0.2s; font-weight: 600; font-size: 1rem; }
button:active { transform: scale(0.96); }
.btn-primary { background: var(--accent-color); color: white; padding: 0.8rem; border-radius: var(--radius-sm); box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; padding: 0.8rem; border-radius: var(--radius-sm); border: 1px solid var(--glass-border); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* --- Animations & Overlays --- */
.auth-view { animation: fadeIn 0.4s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.loader-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(5px); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: var(--radius-lg); }
.spinner { width: 40px; height: 40px; border: 4px solid rgba(255,255,255,0.1); border-top-color: var(--accent-color); border-radius: 50%; animation: spin 1s linear infinite; }
.spinner-sm { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Production Toast Notifications --- */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { min-width: 250px; padding: 1rem 1.5rem; border-radius: var(--radius-md); background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); color: white; font-size: 0.95rem; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: slideInRight 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; pointer-events: auto; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--accent-color); }
.toast.fade-out { animation: fadeOutRight 0.3s ease forwards; }

@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* =========================================
   MOBILE-SPECIFIC WIDGET ADJUSTMENTS
   ========================================= */
@media (max-width: 768px) {
    .auth-container { padding: 1rem; }
    .glass-card.auth-card {
        padding: 2.5rem 1.5rem; 
        border-radius: 24px;    
    }
    .glass-input {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}
/* --- Live Verification & Camera UI --- */
.step { display: none; animation: slideInRight 0.4s ease; }
.step.active { display: block; }
.option-card { border: 1px solid var(--glass-border); padding: 1.5rem; border-radius: var(--radius-md); margin-bottom: 1rem; cursor: pointer; transition: 0.2s; background: rgba(255,255,255,0.05); text-align: center; }
.option-card:hover, .option-card.selected { background: rgba(59, 130, 246, 0.2); border-color: var(--accent-color); transform: translateY(-3px); }
.option-card i { font-size: 2rem; margin-bottom: 0.5rem; color: var(--accent-color); }

.task-card { border: 1px solid var(--glass-border); transition: 0.3s; }
.task-card.success { border-color: var(--success); background: rgba(16, 185, 129, 0.1); }

/* Fullscreen Camera Modal */
.camera-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #000; z-index: 9999; display: flex; flex-direction: column; }
.camera-ui { display: flex; flex-direction: column; height: 100%; width: 100%; max-width: 600px; margin: 0 auto; }
.camera-header { background: rgba(0,0,0,0.8); color: white; z-index: 10; }

.camera-viewfinder { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #111; }
.camera-viewfinder video { position: absolute; width: 100%; height: 100%; object-fit: cover; }

/* The Alignment Guide (Box or Oval) */
.guide-box { position: absolute; border: 2px solid rgba(255,255,255,0.5); box-shadow: 0 0 0 4000px rgba(0,0,0,0.6); pointer-events: none; transition: border-color 0.3s; z-index: 5; }
.guide-box.guide-id { width: 85%; height: 35%; border-radius: 12px; }
.guide-box.guide-selfie { width: 60%; height: 50%; border-radius: 50%; }
.guide-box.guide-cert { width: 80%; height: 70%; border-radius: 8px; }
.guide-box.valid { border-color: var(--success); border-width: 4px; }

/* Diagnostics */
.camera-diagnostics { background: rgba(15, 23, 42, 0.95); z-index: 10; }
.diag-item { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; margin-bottom: 8px; color: var(--text-muted); transition: 0.3s; }
.diag-item i { transition: 0.3s; font-size: 1rem; width: 20px; text-align: center; }
.diag-item.valid { color: white; }
.diag-item.valid i { color: var(--success); }
.diag-item.valid i::before { content: "\f058"; }

/* Capture Button */
.camera-footer { background: #000; z-index: 10; }
.capture-btn { width: 70px; height: 70px; border-radius: 50%; background: transparent; border: 4px solid var(--text-muted); display: flex; align-items: center; justify-content: center; margin: 0 auto; transition: 0.3s; }
.capture-inner { width: 50px; height: 50px; border-radius: 50%; background: var(--text-muted); transition: 0.3s; }
.capture-btn:not(:disabled) { border-color: white; }
.capture-btn:not(:disabled) .capture-inner { background: var(--accent-color); }
.capture-btn:not(:disabled):active .capture-inner { transform: scale(0.9); }
/* Password Requirements */
.password-requirements p {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ff5f5f; /* red by default */
    margin: 6px 0;
    transition: all 0.3s ease;
}

.password-requirements p i {
    color: #ff5f5f;
    transition: all 0.3s ease;
}

/* Valid Requirement */
.password-requirements p.valid {
    color: #22c55e; /* green */
}

.password-requirements p.valid i {
    color: #22c55e; /* green icon */
                    }
