/* ======================================================
   AL-ARCADE HR PLATFORM v3.0 — "THE GRIND"
   Core Stylesheet — Phase 1
   ====================================================== */

:root {
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --success: #22C55E;
    --warning: #EAB308;
    --danger: #EF4444;
    --gold: #F59E0B;
    --bg: #F8FAFC;
    --bg-card: #FFFFFF;
    --text: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --radius: 8px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
    --bg: #0F172A;
    --bg-card: #1E293B;
    --text: #E2E8F0;
    --text-muted: #94A3B8;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; }

/* Navigation */
.top-nav { display: flex; align-items: center; gap: 16px; padding: 8px 24px; background: var(--bg-card); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.nav-brand a { text-decoration: none; font-size: 1.2em; font-weight: 700; color: var(--primary); }
.nav-search { flex: 1; max-width: 400px; }
.nav-search input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font-size: 0.9em; }
.nav-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.nav-btn { background: none; border: none; cursor: pointer; font-size: 1.1em; padding: 6px; border-radius: var(--radius); color: var(--text); position: relative; }
.nav-btn:hover { background: var(--bg); }
.nav-user { display: flex; flex-direction: column; align-items: end; }
.nav-user span:first-child { font-weight: 600; font-size: 0.9em; }
.role-badge { font-size: 0.7em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.badge { position: absolute; top: -2px; right: -2px; background: var(--danger); color: white; border-radius: 50%; width: 18px; height: 18px; font-size: 0.65em; display: flex; align-items: center; justify-content: center; }

/* HUD */
.hud { padding: 12px 24px; background: var(--bg-card); border-bottom: 2px solid var(--border); }
.hud-primary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hud-month { font-weight: 700; }
.hud-bar-container { flex: 1; min-width: 200px; height: 24px; background: var(--border); border-radius: 12px; overflow: hidden; }
.hud-bar { height: 100%; border-radius: 12px; transition: width 0.5s ease, background 0.5s ease; }
.hud-exceptional .hud-bar, [data-color="hud-exceptional"] .hud-bar { background: linear-gradient(90deg, var(--gold), #FBBF24); }
.hud-healthy .hud-bar, [data-color="hud-healthy"] .hud-bar { background: var(--success); }
.hud-warning .hud-bar, [data-color="hud-warning"] .hud-bar { background: var(--warning); }
.hud-critical .hud-bar, [data-color="hud-critical"] .hud-bar { background: var(--danger); }
.hud-amount { font-weight: 700; font-size: 1.1em; white-space: nowrap; }
.hud-secondary { display: flex; gap: 16px; margin-top: 4px; font-size: 0.85em; color: var(--text-muted); }
.hud-deductions { color: var(--danger); }
.hud-bounties { color: var(--success); }

/* Main Content */
.main-content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.container { max-width: 1200px; margin: 0 auto; }

/* Cards */
.card { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); padding: 20px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: 12px; font-size: 1em; color: var(--text-muted); }
.card-wide { grid-column: span 2; }

/* Dashboard Grid */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 20px; margin-top: 20px; }
.stat-card { text-align: center; }
.stat-number { font-size: 2.5em; font-weight: 800; color: var(--primary); }
.stat-sub { font-size: 0.85em; color: var(--text-muted); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9em; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font-size: 0.95em; }
.form-group textarea { min-height: 100px; resize: vertical; }

/* Buttons */
.btn { display: inline-block; padding: 10px 20px; border-radius: var(--radius); font-weight: 600; text-decoration: none; cursor: pointer; border: none; font-size: 0.9em; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.8em; }
.btn-lg { padding: 14px 28px; font-size: 1.1em; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-link { background: none; color: var(--primary); padding: 0; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.9em; }
.alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* Auth Page */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-container { width: 100%; max-width: 420px; padding: 20px; }
.auth-logo { text-align: center; font-size: 2em; font-weight: 800; margin-bottom: 30px; color: var(--primary); }
.auth-form { background: var(--bg-card); padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.auth-form h2 { text-align: center; margin-bottom: 24px; }

/* Blocking Notification */
.blocking-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: rgba(0,0,0,0.85); }
.blocking-overlay { width: 100%; max-width: 600px; padding: 20px; }
.blocking-card { background: var(--bg-card); padding: 40px; border-radius: var(--radius); text-align: center; }
.blocking-icon { font-size: 3em; margin-bottom: 16px; }
.blocking-content { text-align: left; margin: 20px 0; padding: 16px; background: var(--bg); border-radius: var(--radius); }
.blocking-note { font-size: 0.85em; color: var(--text-muted); margin: 16px 0; font-style: italic; }

/* Notifications */
.notification-list { display: flex; flex-direction: column; gap: 8px; }
.notification-item { padding: 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.notification-item.unread { border-left: 3px solid var(--primary); background: #F0F4FF; }
.notification-item.tier-blocking { border-left-color: var(--danger); }
.notif-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.notif-time { font-size: 0.8em; color: var(--text-muted); }

/* Tasks */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9em; }
.task-key { font-weight: 700; color: var(--primary); font-size: 0.8em; white-space: nowrap; }
.task-title { flex: 1; }
.task-status { padding: 2px 8px; border-radius: 12px; font-size: 0.75em; font-weight: 600; }
.overdue { color: var(--danger); font-weight: 600; }

/* Badges */
.badge-doing { background: #DBEAFE; color: #1E40AF; }
.badge-todo { background: #FEF9C3; color: #854D0E; }
.badge-in_review { background: #E0E7FF; color: #4338CA; }
.badge-frozen { background: #E0F2FE; color: #075985; }
.badge-done { background: #DCFCE7; color: #166534; }
.badge-backlog { background: var(--border); color: var(--text-muted); }
.badge-success { background: #DCFCE7; color: #166534; }
.badge-warning { background: #FEF9C3; color: #854D0E; }
.badge-danger { background: #FEF2F2; color: #991B1B; }

/* Page Header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

/* Team Status */
.team-member-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }

/* Toast */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius); color: white; font-weight: 600; animation: slideIn 0.3s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: #000; }
.toast-info { background: var(--primary); }
.toast-gold { background: linear-gradient(135deg, #F59E0B, #D97706); }

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

/* Error Pages */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.error-container { text-align: center; }
.error-container h1 { font-size: 6em; font-weight: 800; color: var(--primary); }

/* Responsive */
@media (max-width: 768px) {
    .top-nav { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
    .nav-search { order: 3; max-width: 100%; flex-basis: 100%; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .card-wide { grid-column: span 1; }
    .hud { padding: 8px 12px; }
    .main-content { padding: 12px; }
}