@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Sora:wght@400;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:         #eef2f7;
  --bg-soft:    #f7f9fc;
  --ink:        #142236;
  --muted:      #5e7188;
  --line:       #d8e1ec;
  --card:       #ffffff;
  --sidebar:    #11263a;
  --sidebar-2:  #1b344d;
  --teal:       #00796B; /* Updated to match BridgeLearn Demo */
  --teal-soft:  #E0F2F1;
  --teal-dark:  #004D40;
  --blue:       #1d4ed8;
  --blue-soft:  #dce8ff;
  --amber:      #d97706;
  --amber-soft: #ffedd4;
  --rose:       #c62849;
  --rose-soft:  #ffdce4;
  --ok:         #0f9f6f;
  --ok-soft:    #d8f8eb;
  --radius-xl:  24px;
  --radius-lg:  16px;
  --radius-md:  12px;
  --radius-sm:  8px;
  --shadow-sm:  0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md:  0 10px 30px rgba(0, 0, 0, 0.08);
  --shadow-lg:  0 20px 40px rgba(0, 0, 0, 0.12);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes slideUpFade {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-slide-up {
  animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}
.delay-100 { animation-delay: 100ms; opacity: 0; }
.delay-200 { animation-delay: 200ms; opacity: 0; }
.delay-300 { animation-delay: 300ms; opacity: 0; }

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Manrope', sans-serif; background: var(--bg); color: var(--ink); display: flex; min-height: 100vh; font-size: 15px; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5 { font-family: 'Sora', sans-serif; }
a { color: inherit; text-decoration: none; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: 258px; flex-shrink: 0;
  background: var(--sidebar);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; overflow: hidden;
  box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}
.sidebar-brand { padding: 26px 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.logo-text { font-family: 'Sora', sans-serif; font-size: 1.15rem; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.logo-sub  { font-size: 0.7rem; color: rgba(255,255,255,0.5); margin-top: 4px; }

.sidebar-nav { flex: 1; padding: 18px 12px; overflow-y: auto; }
.nav-section { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.3); padding: 14px 10px 8px; font-weight: 700; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65); font-size: 0.88rem; font-weight: 600;
  transition: var(--transition); margin-bottom: 4px;
}
.nav-link:hover  { background: rgba(255,255,255,0.08); color: #fff; transform: translateX(4px); }
.nav-link.active { background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: #fff; box-shadow: 0 4px 12px rgba(0, 121, 107, 0.3); }
.nav-link .icon  { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.05); background: rgba(0,0,0,0.1); }
.user-pill { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.user-name { font-size: 0.85rem; color: rgba(255,255,255,0.9); font-weight: 600; line-height: 1.2; }
.user-role { font-size: 0.7rem; color: rgba(255,255,255,0.4); margin-top: 2px;}
.logout-btn {
  margin-left: auto; background: rgba(255,255,255,0.05); border: none;
  color: rgba(255,255,255,0.5); cursor: pointer; font-size: 1.1rem;
  padding: 6px 8px; border-radius: 8px; transition: var(--transition);
}
.logout-btn:hover { background: rgba(198,40,73,0.2); color: var(--rose); transform: scale(1.05); }

/* ── Workspace ─────────────────────────────────────────────────────────────── */
.workspace { margin-left: 258px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; background: linear-gradient(180deg, #eef2f7 0%, #f4f7fa 100%); }
.topbar {
  background: rgba(255, 255, 255, 0.8); border-bottom: 1px solid rgba(216, 225, 236, 0.6);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 0 32px; height: 64px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-family: 'Sora', sans-serif; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.topbar-sub   { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.topbar-spacer { flex: 1; }
.content { padding: 32px; flex: 1; max-width: 1600px; margin: 0 auto; width: 100%; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card { 
  background: var(--card); border-radius: var(--radius-lg); 
  box-shadow: var(--shadow-sm); padding: 24px; 
  transition: var(--transition);
  border: 1px solid rgba(216, 225, 236, 0.5);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: rgba(0, 121, 107, 0.1); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.card-title { font-family: 'Sora', sans-serif; font-size: 1rem; font-weight: 700; color: var(--ink); }
.card-sub   { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* ── KPI Cards ─────────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }
.kpi-card {
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 24px;
  border-top: 4px solid transparent;
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.kpi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.kpi-card::after {
  content: ''; position: absolute; top: 0; right: 0; width: 60px; height: 60px;
  background: radial-gradient(circle, rgba(0,121,107,0.05) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%; transform: translate(20%, -20%);
}
.kpi-card.teal   { border-top-color: var(--teal); }
.kpi-card.blue   { border-top-color: var(--blue); }
.kpi-card.amber  { border-top-color: var(--amber); }
.kpi-card.rose   { border-top-color: var(--rose); }
.kpi-card.ok     { border-top-color: var(--ok); }
.kpi-label { font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.kpi-value { font-family: 'Sora', sans-serif; font-size: 2.4rem; font-weight: 700; color: var(--ink); line-height: 1; letter-spacing: -0.02em; }
.kpi-note  { font-size: 0.75rem; color: var(--muted); margin-top: 8px; font-weight: 500;}

/* ── Grids ─────────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.gap-top { margin-top: 24px; }

/* ── Section header ────────────────────────────────────────────────────────── */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-title  { font-family: 'Sora', sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.section-sub    { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); background: var(--card); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  background: var(--bg-soft); color: var(--muted);
  font-weight: 700; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 14px 18px; text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 500; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0, 121, 107, 0.02); }
tbody tr.clickable { cursor: pointer; transition: background 0.2s; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.badge-ok    { background: var(--ok-soft);    color: #0a6b4a; }
.badge-rose  { background: var(--rose-soft);  color: var(--rose); }
.badge-amber { background: var(--amber-soft); color: #8a4e08; }
.badge-blue  { background: var(--blue-soft);  color: var(--blue); }
.badge-teal  { background: var(--teal-soft);  color: var(--teal); }
.badge-muted { background: var(--bg);         color: var(--muted); border: 1px solid var(--line); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 600; cursor: pointer;
  border: none; transition: var(--transition); font-family: inherit;
}
.btn-primary   { background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: #fff; box-shadow: 0 4px 12px rgba(0, 121, 107, 0.2); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 121, 107, 0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.btn-secondary:hover { background: var(--bg-soft); border-color: #cbd5e1; transform: translateY(-1px); }
.btn-sm  { padding: 6px 14px; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 0.9rem; font-family: inherit; color: var(--ink);
  background: var(--card); transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0, 121, 107, 0.1); }
select.form-control { cursor: pointer; }

/* ── Filter bar ────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 24px; padding: 20px; background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid rgba(216, 225, 236, 0.5); }
.filter-bar .form-group { margin-bottom: 0; min-width: 160px; }

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.page-btn {
  padding: 8px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card);
  color: var(--muted); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: var(--transition);
}
.page-btn.active { background: var(--teal); color: #fff; border-color: var(--teal); box-shadow: 0 2px 8px rgba(0, 121, 107, 0.2); }
.page-btn:hover:not(.active) { background: var(--bg-soft); color: var(--ink); border-color: #cbd5e1; }
.page-info { font-size: 0.8rem; color: var(--muted); margin-right: auto; font-weight: 500;}

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs { 
  display: flex; gap: 4px; border-bottom: 2px solid var(--line); 
  margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; 
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 12px 20px; border: none; background: none;
  font-size: 0.9rem; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: var(--transition); white-space: nowrap;
  text-decoration: none; font-family: inherit; border-radius: 6px 6px 0 0;
}
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); background: rgba(0, 121, 107, 0.04); }
.tab-btn:hover:not(.active)  { color: var(--ink); background: rgba(0,0,0,0.02); }

/* ── Chart ─────────────────────────────────────────────────────────────────── */
.chart-wrap { width: 100%; min-height: 500px; border-radius: var(--radius-md); overflow: hidden; }
.fig-frame  { width: 100%; height: 520px; border: none; border-radius: var(--radius-md); background: #fafafa; }

/* ── Result card ───────────────────────────────────────────────────────────── */
.result-card { background: linear-gradient(135deg, var(--teal-soft), #fff); border: 1px solid rgba(0, 121, 107, 0.2); border-radius: var(--radius-lg); padding: 24px; margin-top: 24px; box-shadow: var(--shadow-sm); }
.result-card h3 { font-family: 'Sora', sans-serif; color: var(--teal-dark); font-size: 1.05rem; margin-bottom: 16px; font-weight: 700; }
.result-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed rgba(0, 121, 107, 0.2); }
.result-row:last-child { border-bottom: none; }
.result-label { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.result-value { font-weight: 700; color: var(--ink); font-size: 0.95rem; }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert { padding: 14px 20px; border-radius: var(--radius-md); font-size: 0.9rem; margin-bottom: 18px; font-weight: 500; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-sm); }
.alert-error   { background: var(--rose-soft);  color: var(--rose);  border: 1px solid rgba(198,40,73,0.3); }
.alert-success { background: var(--ok-soft);    color: #0a6b4a;      border: 1px solid rgba(15,159,111,0.3); }
.alert-info    { background: var(--blue-soft);  color: var(--blue);  border: 1px solid rgba(29,78,216,0.3); }

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at top right, var(--sidebar-2), var(--sidebar)); margin-left: 0; }
.login-box  { background: var(--card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 48px; width: 100%; max-width: 440px; text-align: center; }
.login-logo { font-family: 'Sora', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--teal); letter-spacing: -0.02em; }
.login-app  { font-family: 'Sora', sans-serif; font-size: 1.1rem; font-weight: 600; color: var(--ink); margin-top: 8px; }
.login-sub  { font-size: 0.85rem; color: var(--muted); margin-top: 6px; margin-bottom: 32px; }

/* ── Detail grid ───────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.detail-item { padding: 16px 20px; background: var(--bg-soft); border-radius: var(--radius-md); border: 1px solid var(--line); transition: var(--transition); }
.detail-item:hover { border-color: rgba(0, 121, 107, 0.3); background: #fff; box-shadow: var(--shadow-sm); }
.detail-item label { font-size: 0.72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; display: block; margin-bottom: 6px; }
.detail-item span  { font-size: 0.95rem; color: var(--ink); font-weight: 700; }

/* ── Progress bar ──────────────────────────────────────────────────────────── */
.progress { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--teal), #26A69A); border-radius: 999px; transition: width 1s cubic-bezier(0.16, 1, 0.3, 1); }

/* ── Quick links ───────────────────────────────────────────────────────────── */
.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.quick-link {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; background: var(--card);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  border: 1px solid rgba(216, 225, 236, 0.5); transition: var(--transition);
}
.quick-link:hover { border-color: var(--teal); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.quick-link .ql-icon { font-size: 1.6rem; background: var(--bg-soft); width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--teal); transition: var(--transition); }
.quick-link:hover .ql-icon { background: var(--teal); color: #fff; }
.quick-link .ql-title { font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.quick-link .ql-sub   { font-size: 0.8rem; color: var(--muted); margin-top: 3px; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .workspace { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .content  { padding: 20px; }
}
