/* ═══════════════════════════════════════════════════════════
   ASP POT — Facelift Design System (MediHiveRx-inspired)
   Sprint 36 Phase 1 — Lucas (Frontend)
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Brand */
  --navy: #0B2A4A;
  --blue: #0078D4;
  --blue-hover: #006CBE;
  --blue-lt: #EFF6FC;
  --teal-accent: #3FB8B8;
  
  /* Surfaces */
  --bg: #FAF9F8;
  --surface: #fff;
  --border: #EDEBE9;
  --border-dk: #C8C6C4;
  
  /* Text */
  --text: #323130;
  --text-2: #605E5C;
  --text-3: #8A8886;
  
  /* Status */
  --success: #107C10;
  --success-lt: #DFF6DD;
  --danger: #A4262C;
  --danger-lt: #FED9CC;
  --warn: #986A00;
  --warn-lt: #FFF4CE;
  --warn-border: #F2CC8F;
  
  /* Shadows */
  --shadow: 0 1.6px 3.6px rgba(0,0,0,0.13);
  --shadow-lg: 0 6.4px 14.4px rgba(0,0,0,0.13);
  
  /* Radii */
  --radius: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', -apple-system, system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.5; }

/* ── HEADER ── */
.fl-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  color: #fff; padding: 0 16px; height: 48px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.fl-hamburger { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius); }
.fl-hamburger:hover { background: rgba(255,255,255,0.15); }
.fl-logo { width: 32px; height: 32px; background: rgba(255,255,255,0.95); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; padding: 2px; }
.fl-logo img { width: 100%; height: 100%; object-fit: contain; }
.fl-title { font-size: 14px; font-weight: 600; }
.fl-title .fl-page { opacity: 0.7; font-weight: 400; }
.fl-header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.fl-notif-btn { background: rgba(255,255,255,0.15); border: none; color: #fff; padding: 6px 10px; border-radius: var(--radius); cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 4px; }
.fl-notif-btn:hover { background: rgba(255,255,255,0.25); }
.fl-notif-badge { background: var(--danger); color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 8px; font-weight: 700; }

/* ── SIDEBAR ── */
.fl-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200; display: none; }
.fl-overlay.open { display: block; }
.fl-sidebar {
  position: fixed; top: 0; left: -320px; width: 300px; height: 100%;
  background: var(--surface); z-index: 201; transition: left .25s ease;
  box-shadow: 4px 0 16px rgba(0,0,0,0.1); overflow-y: auto;
}
.fl-sidebar.open { left: 0; }
.fl-sidebar-close { position: absolute; top: 12px; right: 12px; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-3); padding: 4px 8px; border-radius: var(--radius); }
.fl-sidebar-close:hover { background: var(--bg); }

/* User card */
.fl-user-card { padding: 20px 16px 16px; border-bottom: 1px solid var(--border); }
.fl-user-info { display: flex; align-items: center; gap: 10px; }
.fl-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--blue)); color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.fl-user-name { font-size: 13px; font-weight: 600; }
.fl-user-email { font-size: 11px; color: var(--text-3); }
.fl-role-badge { display: inline-block; background: var(--blue-lt); color: var(--blue); font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; margin-top: 4px; }

/* Nav sections */
.fl-nav-section { padding: 12px 16px 4px; }
.fl-nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); font-weight: 600; margin-bottom: 6px; }
.fl-nav-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text);
  text-decoration: none; transition: background .15s; border: none; background: none; width: 100%; text-align: left;
}
.fl-nav-item:hover { background: var(--bg); }
.fl-nav-item.active { background: var(--blue-lt); color: var(--blue); }
.fl-nav-icon { font-size: 15px; min-width: 20px; text-align: center; }
.fl-nav-item.danger { color: var(--danger); }
.fl-nav-sub { padding-left: 36px; }
.fl-nav-sub .fl-nav-item { font-size: 12px; padding: 5px 12px; color: var(--text-2); }

/* ── CONTENT ── */
.fl-content { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* ── CARDS ── */
.fl-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}
.fl-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.fl-card h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; }

/* ── CHIPS ── */
.fl-chip { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.fl-chip-done { background: var(--success-lt); color: var(--success); }
.fl-chip-progress { background: var(--warn-lt); color: var(--warn); }
.fl-chip-planned { background: #E8E8E8; color: var(--text-2); }
.fl-chip-blocked { background: var(--danger-lt); color: var(--danger); }
.fl-chip-p0 { background: var(--danger-lt); color: var(--danger); }
.fl-chip-p1 { background: #FFE0B2; color: #E65100; }
.fl-chip-p2 { background: var(--warn-lt); color: var(--warn); }
.fl-chip-p3 { background: #E8E8E8; color: var(--text-3); }
.fl-chip-role { background: var(--blue-lt); color: var(--blue); }

/* ── STATS ── */
.fl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.fl-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; text-align: center; box-shadow: var(--shadow); }
.fl-stat-num { font-size: 28px; font-weight: 700; color: var(--blue); }
.fl-stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }

/* ── TABLES ── */
.fl-table-wrap { overflow-x: auto; }
.fl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fl-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); font-weight: 600; font-size: 11px; text-transform: uppercase; color: var(--text-3); letter-spacing: 0.3px; }
.fl-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.fl-table tr:hover { background: var(--bg); }
.fl-mono { font-family: 'Cascadia Code', 'SF Mono', 'Consolas', monospace; font-size: 11px; color: var(--text-3); }

/* ── FORMS ── */
.fl-fg { margin-bottom: 12px; }
.fl-fg label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.fl-fg input, .fl-fg select, .fl-fg textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border-dk);
  border-radius: var(--radius); font-size: 13px; font-family: inherit; color: var(--text);
}
.fl-fg input:focus, .fl-fg select:focus, .fl-fg textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0,120,212,0.15);
}

/* ── BUTTONS ── */
.fl-btn { padding: 8px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer; border: none; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.fl-btn-primary { background: var(--blue); color: #fff; }
.fl-btn-primary:hover { background: var(--blue-hover); }
.fl-btn-secondary { background: var(--surface); border: 1px solid var(--border-dk); color: var(--text); }
.fl-btn-secondary:hover { background: var(--bg); }
.fl-btn-danger { background: var(--surface); border: 1px solid var(--danger); color: var(--danger); }
.fl-btn-ai { background: var(--blue-lt); color: var(--blue); border: 1px solid var(--blue); }
.fl-btn-sm { padding: 4px 12px; font-size: 12px; }

/* ── TOGGLE BUTTONS ── */
.fl-tog-row { display: flex; gap: 4px; flex-wrap: wrap; }
.fl-tog { padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 11px; cursor: pointer; background: var(--surface); color: var(--text-2); transition: all .15s; }
.fl-tog.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.fl-tog:hover:not(.on) { background: var(--bg); }

/* ── STEP NAVIGATOR ── */
.fl-steps { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.fl-step-dot {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; cursor: pointer; border: 2px solid var(--border); color: var(--text-3); transition: all .2s;
}
.fl-step-dot.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.fl-step-dot.done { background: var(--success-lt); color: var(--success); border-color: var(--success); }

/* ── SECTION HEADERS ── */
.fl-sec-hdr {
  display: flex; align-items: center; gap: 10px; padding: 14px 0; margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.fl-sec-icon { font-size: 20px; }
.fl-sec-title { font-size: 15px; font-weight: 600; }
.fl-sec-desc { font-size: 12px; color: var(--text-3); }
.fl-sub-title { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

/* ── PROGRESS BARS ── */
.fl-progress { height: 10px; background: #F3F2F1; border-radius: 5px; overflow: hidden; }
.fl-progress-fill { height: 100%; background: var(--teal-accent); border-radius: 5px; transition: width .5s ease; }
.fl-module-bar { height: 16px; background: #F3F2F1; border-radius: 4px; overflow: hidden; flex: 1; }

/* ── EXAM ROWS ── */
.fl-exam-row { display: flex; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.fl-exam-row:last-child { border-bottom: none; }
.fl-exam-label { min-width: 140px; font-size: 12px; font-weight: 500; }

/* ── VIEW MODE ── */
.fl-view-mode .fl-fg input, .fl-view-mode .fl-fg select, .fl-view-mode .fl-fg textarea {
  background: #F3F2F1; border-color: var(--border); pointer-events: none;
}
.fl-view-badge { display: inline-block; background: var(--blue-lt); color: var(--blue); font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 10px; }
.fl-dup-badge { display: inline-block; background: var(--warn-lt); color: var(--warn); font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 10px; }

/* ── FOOTER ── */
.fl-footer { text-align: center; padding: 16px; font-size: 10px; color: var(--text-3); }
.fl-footer a { color: var(--blue); text-decoration: none; font-weight: 500; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .fl-content { padding: 12px; }
  .fl-stats { grid-template-columns: 1fr 1fr; }
  .fl-card { padding: 14px; }
  .fl-exam-row { flex-direction: column; gap: 4px; }
  .fl-exam-label { min-width: auto; }
}

/* ── PRINT ── */
@media print {
  .fl-header, .fl-sidebar, .fl-overlay, .fl-footer { display: none !important; }
  .fl-content { max-width: 100%; padding: 0; }
  .fl-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ── Hide legacy headers (replaced by fl-header) ── */
.top-bar, .top, .dash-header, .app-header { display: none !important; }
.container, .content, .main-layout { padding-top: 0 !important; }

/* POT-specific action bar */
.pot-action-bar { position: sticky; top: 48px; z-index: 50; }

/* ════════════════════════════════════════════════════════════════
   ACCESSIBILITY — WCAG 2.2 AA (v5.35.0)
   Global rules; reaches every page that loads facelift.css.
   ════════════════════════════════════════════════════════════════ */

/* 2.4.7 Focus Visible — a clear, consistent keyboard focus indicator on
   every interactive element. :focus-visible keeps it keyboard-only so it
   doesn't show on mouse clicks. */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible,
[tabindex]:focus-visible, [role="button"]:focus-visible,
[role="tab"]:focus-visible, [role="link"]:focus-visible {
  outline: 3px solid #0B5FD8 !important;
  outline-offset: 2px !important;
  border-radius: 3px;
}
/* Older browsers without :focus-visible still get a visible focus ring */
@supports not selector(:focus-visible) {
  a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 3px solid #0B5FD8 !important;
    outline-offset: 2px !important;
  }
}

/* Screen-reader-only utility — content available to AT but visually hidden */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* 2.4.1 Bypass Blocks — skip-to-content link, visible only on focus */
.skip-link {
  position: absolute; left: 8px; top: -48px;
  z-index: 1000;
  background: #0B5FD8; color: #fff;
  padding: 10px 16px; border-radius: 0 0 8px 8px;
  font-weight: 600; text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 0; }

/* 2.3.3 Animation from Interactions — honor reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 2.5.8 Target Size (Minimum) — keep tap targets usable (>=24px) */
button, .btn, a.fl-nav-item, [role="button"] { min-height: 24px; }
