/*
Theme Name: Libwin
Description: A clean LMS dashboard theme for Libwin. Users see their courses and tests after login.
Version: 2.3.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 8.0
License: GPL v2 or later
Text Domain: edudash
Tags: education, dashboard, lms, custom-login, clean, seo
*/

/* ============================================================
   CSS VARIABLES
============================================================ */
:root {
  --primary:        #1a56db;
  --primary-dark:   #1341b5;
  --primary-light:  #e8f0fe;
  --accent:         #f59e0b;
  --accent-light:   #fef3c7;
  --success:        #10b981;
  --success-light:  #d1fae5;
  --danger:         #ef4444;
  --danger-light:   #fef2f2;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --text-light:     #94a3b8;
  --bg:             #f1f5f9;
  --bg-white:       #ffffff;
  --border:         #e2e8f0;
  --border-light:   #f1f5f9;
  --sidebar-width:  260px;
  --topbar-height:  64px;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.10), 0 8px 32px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 40px rgba(0,0,0,.12);
  --font-body:      'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --font-display:   'Sora', 'Segoe UI', system-ui, sans-serif;
  --transition:     0.18s ease;
}

/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.75rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.35rem); }
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ============================================================
   LAYOUT
============================================================ */
.edudash-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
============================================================ */
.edudash-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
  /* FIX: ensure sidebar overflow doesn't show outside its bounds */
  overflow: hidden;
}

.sidebar-logo {
  padding: 0 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-height);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { color: white; width: 20px; height: 20px; }

.sidebar-logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logo-text span { color: var(--primary); }

/* Custom logo inside sidebar */
.sidebar-logo .custom-logo-link img {
  max-height: 36px;
  width: auto;
}

/* Nav — FIX: min-height: 0 lets it shrink so footer is always visible */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-nav-section { margin-bottom: 24px; }

.sidebar-nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  padding: 0 12px;
  margin-bottom: 6px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition);
  margin-bottom: 2px;
}
.sidebar-nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav-link:hover { background: var(--primary-light); color: var(--primary); }
.sidebar-nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* Footer — FIX: flex-shrink: 0 keeps sign-out always visible */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.72rem;
  color: var(--text-light);
  text-transform: capitalize;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  margin-top: 6px;
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.sidebar-logout:hover { background: var(--danger-light); color: var(--danger); }
.sidebar-logout svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Clickable stat cards */
a.stat-card-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
a.stat-card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
a.stat-card-link:hover .stat-label::after {
  content: ' →';
  opacity: 0.6;
}

/* ============================================================
   MAIN CONTENT AREA
   BUG FIX: removed width:0 which caused issues on some browsers.
   Now using calc() approach for correct sizing.
============================================================ */
.edudash-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
}

/* ============================================================
   TOPBAR
============================================================ */
.edudash-topbar {
  height: var(--topbar-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background var(--transition);
}
.topbar-mobile-toggle:hover { background: var(--bg); }

.topbar-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
}
.topbar-search input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px 8px 36px;
  font-size: 0.875rem;
  width: 200px;
  outline: none;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.topbar-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
  width: 240px;
}
.topbar-search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-light);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.topbar-actions { display: flex; align-items: center; gap: 4px; }

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
}
.topbar-btn:hover { background: var(--bg); color: var(--text); }
.topbar-btn .dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid white;
}

/* Mobile sign-out button in topbar — hidden on desktop, shown on mobile */
.topbar-signout-mobile { display: none; color: var(--danger); }
.topbar-signout-mobile:hover { background: var(--danger-light); color: var(--danger); }

/* ============================================================
   PAGE CONTENT
============================================================ */
.edudash-content {
  flex: 1;
  padding: 28px 24px;
  max-width: 1200px;
  width: 100%;
}

/* ============================================================
   DASHBOARD — WELCOME BANNER
============================================================ */
.dashboard-welcome {
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: white;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.dashboard-welcome::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.dashboard-welcome::after {
  content: '';
  position: absolute;
  bottom: -30px; right: 80px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.welcome-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
  margin-bottom: 6px;
}
.welcome-name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  margin-bottom: 6px;
}
.welcome-subtitle { opacity: 0.85; font-size: 0.9rem; }

/* ============================================================
   STATS ROW
============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
  /* BUG FIX: align-items stretch so anchor stat cards match div height */
  align-items: stretch;
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  /* FIX: needed for anchor stat cards to fill grid cell */
  align-self: stretch;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.amber  { background: var(--accent-light);  color: var(--accent); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.purple { background: #f3e8ff; color: #8b5cf6; }
.stat-icon.red    { background: var(--danger-light); color: var(--danger); }
.stat-icon svg { width: 22px; height: 22px; }

.stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   SPECIAL BANNERS (dashboard promo banners — special tests, offers, etc.)
============================================================ */
.dash-banners {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}
.dash-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius);
  color: #fff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.dash-banner-blue   { background: linear-gradient(135deg, #1a56db, #1341b5); }
.dash-banner-green  { background: linear-gradient(135deg, #10b981, #059669); }
.dash-banner-amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.dash-banner-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.dash-banner-rose   { background: linear-gradient(135deg, #fb7185, #be123c); }
.dash-banner-red    { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.dash-banner-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dash-banner-icon svg { width: 22px; height: 22px; }
.dash-banner-info { flex: 1; min-width: 0; }
.dash-banner-badge {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,.22);
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.04em;
  padding: 2px 9px; border-radius: 99px; margin-bottom: 5px;
  text-transform: uppercase;
}
.dash-banner-title { font-family: var(--font-display); font-size: 1rem; font-weight: 800; line-height: 1.3; }
.dash-banner-subtitle { font-size: 0.82rem; opacity: 0.92; margin-top: 3px; }
.dash-banner-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff;
  font-size: 0.82rem; font-weight: 700;
  padding: 9px 16px; border-radius: 10px;
  white-space: nowrap;
  transition: transform 0.15s, opacity 0.15s;
}
.dash-banner-blue   .dash-banner-btn { color: var(--primary); }
.dash-banner-green  .dash-banner-btn { color: #059669; }
.dash-banner-amber  .dash-banner-btn { color: #b45309; }
.dash-banner-purple .dash-banner-btn { color: #6d28d9; }
.dash-banner-rose   .dash-banner-btn { color: #be123c; }
.dash-banner-red    .dash-banner-btn { color: #b91c1c; }
.dash-banner-btn:hover { transform: translateY(-1px); opacity: 0.92; }
.dash-banner-edit {
  flex-shrink: 0;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(255,255,255,.18);
  color: #fff;
  transition: background 0.15s;
}
.dash-banner-edit svg { width: 14px; height: 14px; }
.dash-banner-edit:hover { background: rgba(255,255,255,.32); color: #fff; }
@media (max-width: 640px) {
  .dash-banner { flex-wrap: wrap; }
  .dash-banner-btn { width: 100%; justify-content: center; order: 3; }
}

/* ============================================================
   SECTION HEADERS
============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-link { font-size: 0.85rem; color: var(--primary); font-weight: 500; }

/* Section dots */
.section-title-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.active-dot   { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.upcoming-dot { background: var(--accent); }
.past-dot     { background: var(--text-light); }
/* BUG FIX: these were missing — used by examcraft-integration.php */
.green-dot    { background: var(--success); }
.blue-dot     { background: var(--primary); }

/* ============================================================
   COURSE BLOCK — ACCORDION
============================================================ */
.course-block {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
  transition: box-shadow var(--transition);
}
.course-block:hover { box-shadow: var(--shadow-md); }

.course-block-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  transition: background var(--transition);
}
.course-block-header:hover { background: rgba(26,86,219,.02); }

.course-block-thumb {
  width: 50px; height: 50px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, #60a5fa 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.course-block-thumb.amber  { background: linear-gradient(135deg, #f59e0b, #fcd34d); }
.course-block-thumb.green  { background: linear-gradient(135deg, #10b981, #6ee7b7); }
.course-block-thumb.purple { background: linear-gradient(135deg, #8b5cf6, #c4b5fd); }
.course-block-thumb.rose   { background: linear-gradient(135deg, #f43f5e, #fca5a5); }
.course-block-thumb svg { width: 24px; height: 24px; color: rgba(255,255,255,.9); }

.course-block-info { flex: 1; min-width: 0; }
.course-block-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary);
  margin-bottom: 2px;
}
.course-block-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.course-block-toggle:hover .course-block-title { color: var(--primary); }
.course-block-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.course-block-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-block-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.course-block-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  transition: background var(--transition);
  white-space: nowrap;
}
.course-block-btn:hover { background: var(--primary-dark); color: white; }
.course-block-btn svg { width: 14px; height: 14px; }

.course-block-chevron {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: transform 0.25s ease, background var(--transition);
  flex-shrink: 0;
}
.course-block-toggle:hover .course-block-chevron {
  background: var(--primary-light);
  color: var(--primary);
}

/* Tests nested inside course block */
.course-block-tests { padding: 0 20px 14px; animation: slideDown 0.2s ease; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.course-block-tests-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 12px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border-light);
}
.course-block-tests-label svg { width: 13px; height: 13px; }

/* Test row */
.test-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: background var(--transition), transform var(--transition);
}
.test-row:last-child { margin-bottom: 0; }
.test-row:hover { background: var(--primary-light); transform: translateX(2px); }

.test-row-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.test-row-icon svg { width: 17px; height: 17px; }

.test-row-info { flex: 1; min-width: 0; }
.test-row-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.test-row-meta {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 10px;
}

.test-row-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background var(--transition);
  white-space: nowrap;
}
.test-row-btn:hover { background: var(--primary-dark); color: white; }

.standalone-tests-section { margin-bottom: 28px; }

/* ============================================================
   SCHEDULE
============================================================ */
.schedule-today-badge {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Active Card */
.schedule-active-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  border-left: 4px solid var(--success);
}
.schedule-active-left { display: flex; align-items: flex-start; gap: 14px; flex: 1; min-width: 0; }
.schedule-active-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--success-light);
  color: var(--success);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.schedule-active-icon svg { width: 22px; height: 22px; }
.schedule-active-info { flex: 1; min-width: 0; }
.schedule-active-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--success); margin-bottom: 3px;
}
.schedule-active-topic {
  font-family: var(--font-display);
  font-size: 1.1rem; font-weight: 800; color: var(--text);
  margin-bottom: 3px; line-height: 1.3;
}
.schedule-active-dates { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }
.schedule-progress-wrap { display: flex; align-items: center; gap: 10px; }
.schedule-progress-bar {
  flex: 1; height: 6px; background: var(--border); border-radius: 99px;
  overflow: hidden; max-width: 200px;
}
.schedule-progress-fill {
  height: 100%; background: var(--success); border-radius: 99px; transition: width 0.6s ease;
}
.schedule-progress-label { font-size: 0.73rem; color: var(--text-muted); white-space: nowrap; }

.schedule-active-right {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  flex-shrink: 0; text-align: center; min-width: 130px;
}
.schedule-test-countdown {
  background: var(--bg); border-radius: var(--radius-sm);
  padding: 10px 18px; text-align: center; width: 100%;
}
.schedule-test-countdown.is-test-day {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1.5px solid #6ee7b7;
}
.schedule-countdown-number {
  font-family: var(--font-display); font-size: 2rem; font-weight: 800;
  color: var(--primary); line-height: 1;
}
.schedule-countdown-label { font-size: 0.73rem; color: var(--text-muted); margin-top: 2px; }
.schedule-test-date { font-size: 0.7rem; color: var(--text-light); margin-top: 4px; }

/* Test Day Today state */
.schedule-test-day-icon {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--success); color: white; margin: 0 auto 6px;
  box-shadow: 0 0 0 6px rgba(16,185,129,.2);
  animation: pulse-green 2s infinite;
}
.schedule-test-day-label {
  font-family: var(--font-display); font-size: 1rem; font-weight: 800;
  color: var(--success); line-height: 1.2;
}

.schedule-test-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 700; transition: all var(--transition);
  white-space: nowrap; width: 100%; justify-content: center;
}
.schedule-test-btn.pulse { background: var(--success); color: white; animation: pulse-green 2s infinite; }
.schedule-test-btn.pulse:hover { background: #059669; color: white; }
.schedule-test-btn.outline {
  background: var(--primary-light); color: var(--primary);
  border: 1.5px solid transparent;
}
.schedule-test-btn.outline:hover { background: var(--primary); color: white; }
.schedule-no-test { font-size: 0.76rem; color: var(--text-light); font-style: italic; }
.schedule-full-unit-locked {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 8px; padding: 5px 10px;
  background: #fef3c7; color: #92400e;
  border: 1px dashed #f59e0b; border-radius: var(--radius-sm);
  font-size: 0.73rem; font-weight: 600; width: 100%; justify-content: center;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.4); }
  50%       { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
}

.schedule-no-active {
  background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 22px; color: var(--text-muted); font-size: 0.88rem;
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  border-left: 4px solid var(--border);
}

/* Upcoming */
.schedule-upcoming-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.schedule-upcoming-row {
  background: var(--bg-white); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 12px 18px; display: flex; align-items: center; gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.schedule-upcoming-row:hover { transform: translateX(3px); box-shadow: var(--shadow-md); }
.schedule-upcoming-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-light); color: var(--accent);
  font-weight: 800; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.schedule-upcoming-info { flex: 1; min-width: 0; }
.schedule-upcoming-topic { font-weight: 600; font-size: 0.9rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-upcoming-meta { font-size: 0.74rem; color: var(--text-muted); margin-top: 2px; }
.schedule-upcoming-badge {
  flex-shrink: 0; font-size: 0.7rem; font-weight: 700;
  background: var(--accent-light); color: #92400e;
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.schedule-upcoming-more { font-size: 0.8rem; color: var(--text-muted); text-align: center; padding: 10px; font-style: italic; }

/* Past */
.schedule-toggle-past {
  font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 14px; cursor: pointer; transition: all var(--transition);
}
.schedule-toggle-past:hover { border-color: var(--primary); color: var(--primary); }
.schedule-past-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.schedule-past-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--bg-white); border-radius: var(--radius-sm); opacity: 0.75; transition: opacity var(--transition);
}
.schedule-past-row:hover { opacity: 1; }
.schedule-past-check {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--success-light); color: var(--success);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.schedule-past-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.schedule-past-topic { font-size: 0.86rem; font-weight: 600; color: var(--text-muted); }
.schedule-past-meta { font-size: 0.73rem; color: var(--text-light); }
.schedule-past-link { flex-shrink: 0; font-size: 0.73rem; font-weight: 600; color: var(--primary); white-space: nowrap; }
.schedule-past-link:hover { color: var(--primary-dark); }
.schedule-past-link.outline {
  color: var(--text-muted); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 20px;
}
.schedule-past-link.outline:hover { border-color: var(--primary); color: var(--primary); }
.schedule-past-links { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.schedule-past-nil { flex-shrink: 0; font-size: 0.73rem; color: var(--text-light); font-style: italic; }

/* ============================================================
   EMPTY STATE
============================================================ */
.empty-state {
  text-align: center; padding: 44px 24px;
  background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow);
}
.empty-state-icon {
  width: 60px; height: 60px; background: var(--primary-light); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; color: var(--primary);
}
.empty-state-icon svg { width: 28px; height: 28px; }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: 0.88rem; max-width: 300px; margin: 0 auto; }

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); border: none; font-family: var(--font-body);
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }
.btn-outline { background: none; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn svg { width: 15px; height: 15px; }

/* ============================================================
   FORMS
============================================================ */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.84rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.9rem; font-family: var(--font-body); color: var(--text);
  background: var(--bg-white); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================================
   ALERTS
============================================================ */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.875rem;
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: var(--danger-light);  color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: var(--primary-light);  color: #1e40af; border: 1px solid #bfdbfe; }

/* ============================================================
   BREADCRUMBS
============================================================ */
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { color: var(--text-light); }
.breadcrumbs .current { color: var(--text); font-weight: 500; }

/* ============================================================
   LOGIN PAGE
============================================================ */
body.login-page {
  background: linear-gradient(135deg, #1e3a8a 0%, #1a56db 50%, #3b82f6 100%);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; font-family: var(--font-body);
}
.login-container { width: 100%; max-width: 420px; padding: 24px; }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand-icon {
  width: 64px; height: 64px; background: rgba(255,255,255,.15);
  border-radius: 18px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.2);
}
.login-brand-icon svg { width: 34px; height: 34px; color: white; }
.login-brand h1 { color: white; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.login-brand p { color: rgba(255,255,255,.7); font-size: 0.875rem; margin-top: 4px; }

.login-card { background: white; border-radius: 20px; padding: 34px 30px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.login-card .login-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 24px; }
.login-form .form-group { margin-bottom: 14px; }
.login-form .form-label { font-size: 0.8rem; font-weight: 600; }
.login-form .form-control { background: var(--bg); border: 1.5px solid var(--border); padding: 11px 14px; }
.login-input-wrap { position: relative; }
.login-input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-light); width: 17px; height: 17px; pointer-events: none;
}
.login-input-wrap .form-control { padding-left: 38px; }
.login-remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.84rem; color: var(--text-muted); margin: 4px 0 18px;
}
.login-remember input[type="checkbox"] { accent-color: var(--primary); }
.btn-login {
  width: 100%; padding: 13px;
  background: var(--primary); color: white; border: none;
  border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700;
  cursor: pointer; font-family: var(--font-body);
  transition: background var(--transition), transform var(--transition);
}
.btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }
.login-forgot { text-align: center; margin-top: 14px; font-size: 0.8rem; color: var(--text-muted); }
.login-forgot a { color: var(--primary); font-weight: 500; }
.login-error {
  background: var(--danger-light); border: 1px solid #fecaca;
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--danger); font-size: 0.84rem; font-weight: 500; margin-bottom: 14px;
}

/* ============================================================
   FOOTER
============================================================ */
.edudash-footer {
  padding: 18px 24px; border-top: 1px solid var(--border);
  text-align: center; font-size: 0.78rem; color: var(--text-light);
  background: var(--bg-white); margin-top: auto;
}

/* ============================================================
   EXAM PAGE
============================================================ */
.exam-back-bar { margin-bottom: 16px; }
.exam-back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.84rem; font-weight: 600; color: var(--text-muted); transition: color var(--transition);
}
.exam-back-link:hover { color: var(--primary); }
.exam-embed-wrap { background: var(--bg-white); border-radius: var(--radius); overflow: hidden; }
.exam-embed-wrap .ec-pub { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }

/* ============================================================
   ADMIN TABLE
============================================================ */
.admin-panel { background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 24px; }
.admin-panel-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { padding: 12px 20px; text-align: left; font-size: 0.73rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); background: var(--bg); }
.admin-table td { padding: 14px 20px; border-top: 1px solid var(--border-light); font-size: 0.86rem; }
.admin-table tr:hover td { background: var(--bg); }

/* ============================================================
   WORDPRESS ADMIN BAR FIX
============================================================ */
.admin-bar .edudash-sidebar { top: 32px; height: calc(100vh - 32px); }
.admin-bar .edudash-topbar { top: 32px; }
@media screen and (max-width: 782px) {
  .admin-bar .edudash-sidebar { top: 46px; height: calc(100vh - 46px); }
  .admin-bar .edudash-topbar { top: 46px; }
}

/* ============================================================
   ACCESSIBILITY
============================================================ */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ============================================================
   EXAMCRAFT INTEGRATION STYLES
============================================================ */
.ec-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.ec-badge-passed   { background: var(--success-light); color: #059669; }
.ec-badge-failed   { background: var(--danger-light); color: var(--danger); }
.ec-badge-pending  { background: var(--accent-light); color: #b45309; }
.ec-badge-progress { background: var(--primary-light); color: var(--primary); }

.ec-progress-wrap { margin: 6px 0; }
.ec-progress-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.ec-progress-label strong { color: var(--text); }
.ec-progress-bar { height: 7px; background: var(--border); border-radius: 8px; overflow: hidden; }
.ec-progress-fill { height: 100%; border-radius: 8px; transition: width 0.6s ease; }
.ec-progress-green { background: var(--success); }
.ec-progress-amber { background: var(--accent); }
.ec-progress-red   { background: var(--danger); }

.ec-progress-overview { margin-bottom: 24px; }
.ec-progress-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.ec-progress-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.ec-progress-card-title { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .5px; }
.ec-time-stat { display: flex; align-items: baseline; gap: 6px; }
.ec-time-value { font-size: 26px; font-weight: 700; color: var(--text); }
.ec-time-unit { font-size: 13px; color: var(--text-muted); }
.ec-completion-badge { font-size: 13px; color: var(--text-muted); background: var(--bg); padding: 4px 12px; border-radius: 20px; }

.ec-results-table-wrap { overflow-x: auto; margin-bottom: 24px; }
.ec-results-table { width: 100%; border-collapse: collapse; background: var(--bg-white); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.ec-results-table th { background: var(--bg); padding: 11px 16px; text-align: left; font-size: 0.71rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
.ec-results-table td { padding: 11px 16px; border-bottom: 1px solid var(--border-light); font-size: 0.86rem; color: var(--text); }
.ec-results-table tr:last-child td { border-bottom: none; }
.ec-results-table tr:hover td { background: var(--bg); }
.ec-exam-name { font-weight: 600; color: var(--text); }
.ec-exam-category { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.ec-score { font-weight: 600; }
.ec-score-pct { font-size: 12px; color: var(--text-muted); }
.ec-view-all { font-size: 13px; color: var(--primary); font-weight: 500; }
.ec-view-all:hover { text-decoration: underline; }

.ec-test-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.ec-test-score, .ec-test-attempts, .ec-test-retakes, .ec-test-questions, .ec-test-time { font-size: 0.75rem; color: var(--text-muted); }
.ec-test-score { font-weight: 600; color: var(--text); }

/* ============================================================
   MOBILE RESPONSIVE
============================================================ */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  /* BUG FIX: sidebar slides in from left, doesn't use width:0 */
  .edudash-sidebar {
    width: 260px;
    transform: translateX(-260px);
    box-shadow: none;
  }
  .edudash-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .edudash-main { margin-left: 0; width: 100%; }

  .topbar-mobile-toggle { display: flex; }
  /* Show mobile sign-out button in topbar */
  .topbar-signout-mobile { display: flex; }

  .topbar-search { display: none; }
  .edudash-topbar { gap: 8px; padding: 0 14px; }

  .edudash-content { padding: 16px; }

  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; }
  .stat-value { font-size: 1.3rem; }

  .dashboard-welcome { padding: 18px 16px; margin-bottom: 18px; }
  .welcome-name { font-size: 1.3rem; }

  .schedule-active-card { flex-direction: column; gap: 14px; padding: 16px; }
  .schedule-active-right {
    width: 100%; min-width: unset;
    flex-direction: row; align-items: center; justify-content: space-between;
  }
  .schedule-test-countdown { padding: 10px 14px; width: auto; }
  .schedule-countdown-number { font-size: 1.5rem; }
  .schedule-test-btn { width: auto; }
  .schedule-upcoming-meta { display: none; }

  .course-block-title { font-size: 0.875rem; }
  .course-block-btn span { display: none; }
  .course-block-btn { padding: 8px 10px; }
  .course-block-header { flex-wrap: wrap; gap: 8px; }

  .form-row { grid-template-columns: 1fr; }
  .admin-table { display: block; overflow-x: auto; }
  .ec-progress-grid { grid-template-columns: 1fr 1fr; }

  /* Sidebar overlay */
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;
    display: none;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.visible { display: block; }
}

@media (max-width: 480px) {
  .login-card { padding: 26px 20px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .schedule-active-right { flex-direction: column; align-items: stretch; }
  .schedule-test-btn { width: 100%; }
  .ec-progress-grid { grid-template-columns: 1fr; }
  .ec-results-table th:nth-child(4), .ec-results-table td:nth-child(4) { display: none; }
}

/* ============================================================
   PRINT
============================================================ */
@media print {
  .edudash-sidebar, .edudash-topbar { display: none; }
  .edudash-main { margin-left: 0; }
}

/* ============================================================
   PAGE & POST CONTENT LAYOUT (page.php / single.php)
============================================================ */

/* Two-column layout: main content + sidebar */
.content-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}

/* Main article area */
.content-main {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  min-width: 0; /* prevent overflow in grid */
}

.content-main h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.25;
}

/* Date / author meta row */
.content-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.content-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.content-meta-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-light);
}

/* Prose body — style WordPress block content */
.content-body {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.75;
}

.content-body h2,
.content-body h3,
.content-body h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  margin: 1.6em 0 0.6em;
  line-height: 1.3;
}

.content-body h2 { font-size: 1.35rem; }
.content-body h3 { font-size: 1.15rem; }
.content-body h4 { font-size: 1rem; }

.content-body p { margin-bottom: 1.1em; }

.content-body ul,
.content-body ol {
  list-style: revert;
  padding-left: 1.4em;
  margin-bottom: 1.1em;
}

.content-body li { margin-bottom: 0.35em; }

.content-body a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.content-body a:hover { color: var(--primary-dark); }

.content-body blockquote {
  border-left: 3px solid var(--primary);
  padding: 12px 18px;
  margin: 1.4em 0;
  background: var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-style: italic;
}

.content-body img {
  border-radius: var(--radius-sm);
  margin: 1em 0;
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1.2em 0;
}

.content-body th,
.content-body td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}

.content-body th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text);
}

.content-body pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.875rem;
  margin-bottom: 1.2em;
}

.content-body code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.875em;
}

.content-body pre code {
  background: none;
  border: none;
  padding: 0;
}

/* Right sidebar column */
.content-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Individual sidebar card (widget or back button) */
.sidebar-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.sidebar-card .widget-title,
.sidebar-card h2,
.sidebar-card h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-card ul { list-style: none; padding: 0; }
.sidebar-card ul li { padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 0.875rem; }
.sidebar-card ul li:last-child { border-bottom: none; }
.sidebar-card ul li a { color: var(--text); }
.sidebar-card ul li a:hover { color: var(--primary); }

/* ============================================================
   RESPONSIVE — collapse to single column on tablet/mobile
============================================================ */
@media (max-width: 900px) {
  .content-layout {
    grid-template-columns: 1fr;
  }

  .content-sidebar {
    order: -1; /* move sidebar above content on mobile */
  }
}

@media (max-width: 600px) {
  .content-main {
    padding: 22px 18px;
  }

  .content-main h1 {
    font-size: 1.4rem;
  }
}

/* ============================================================
   SCROLLING TICKER BANNER
   ============================================================ */
.edudash-ticker {
    display: flex;
    align-items: center;
    overflow: hidden;
    height: 36px;
    flex-shrink: 0;
}
.edudash-ticker-track {
    display: flex;
    flex: 1;
    overflow: hidden;
    align-items: center;
    height: 100%;
}
.edudash-ticker-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 600;
    animation: edudash-ticker-scroll var(--ticker-speed, 22s) linear infinite;
    padding-right: 40px;
    flex-shrink: 0;
}
.edudash-ticker-sep {
    font-size: 1rem;
    opacity: 0.4;
}
@keyframes edudash-ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}
.edudash-ticker-cta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0 14px;
    height: 100%;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.edudash-ticker-cta:hover { opacity: 0.75; }

/* ============================================================
   SIDEBAR NAV BADGE (announcement count)
   ============================================================ */
.sidebar-nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* ============================================================
   DASHBOARD — Announcement chip inside Today's Focus
   ============================================================ */
.schedule-announcement-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 99px;
    padding: 5px 12px;
    text-decoration: none;
    transition: background 0.15s, gap 0.15s;
    width: fit-content;
}
.schedule-announcement-chip:hover {
    background: #dbeafe;
    gap: 9px;
    color: var(--primary-dark);
}

/* ============================================================
   INSTRUCTIONS PAGE — Announcements CTA link card
   ============================================================ */
.ins-announcements-cta {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 22px 24px;
    text-decoration: none;
    border: 2px solid transparent;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.15s;
    margin-bottom: 8px;
}
.ins-announcements-cta:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 20px rgba(26,86,219,0.10);
    transform: translateY(-2px);
}
.ins-ann-cta-icon {
    width: 50px; height: 50px;
    border-radius: 14px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ins-ann-cta-icon svg { width: 24px; height: 24px; }
.ins-ann-cta-body { flex: 1; min-width: 0; }
.ins-ann-cta-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ins-ann-cta-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}
.ins-ann-cta-sub {
    font-size: 0.835rem;
    color: var(--text-muted);
    line-height: 1.55;
}
.ins-ann-cta-arrow {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.ins-announcements-cta:hover .ins-ann-cta-arrow {
    background: var(--primary);
    color: #fff;
}

/* ============================================================
   PWA — INSTALL BUTTON, OFFLINE BANNER, TOAST
   ============================================================ */

/* Install button in topbar */
.pwa-install-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1.5px solid #bfdbfe;
    border-radius: 10px;
    padding: 7px 13px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
    font-family: inherit;
    white-space: nowrap;
}
.pwa-install-btn:hover {
    background: #dbeafe;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(26,86,219,0.15);
}
.pwa-install-label { display: none; }
@media (min-width: 540px) { .pwa-install-label { display: inline; } }

/* Offline banner — slides up from bottom */
#edudash-offline-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #1e293b;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 20px;
    font-size: 0.83rem;
    font-weight: 500;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
}
#edudash-offline-banner svg { color: #94a3b8; flex-shrink: 0; }
#edudash-offline-banner.visible { transform: translateY(0); }

/* Toast notifications */
.edudash-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 10000;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    white-space: nowrap;
    max-width: calc(100vw - 48px);
    text-align: center;
}
.edudash-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.edudash-toast-success { background: #166534; color: #dcfce7; }
.edudash-toast-info    { background: #1e40af; color: #dbeafe; }
.edudash-toast-warning { background: #92400e; color: #fef3c7; }
.edudash-toast-danger  { background: #991b1b; color: #fee2e2; }

/* Adjust offline banner when topbar is showing */
@media (min-width: 769px) {
    #edudash-offline-banner {
        left: var(--sidebar-width, 240px);
    }
}

/* ============================================================
   SIDEBAR — category count badge
   ============================================================ */
.sidebar-cat-count {
    margin-left: auto;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}
.sidebar-nav-link.active .sidebar-cat-count {
    background: rgba(255,255,255,0.25);
    border-color: transparent;
    color: #fff;
}

/* ============================================================
   CATEGORY TESTS PAGE
   ============================================================ */

/* ── Page header ── */
.cat-page-header { align-items: flex-start; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.cat-page-title-group { display: flex; align-items: flex-start; gap: 14px; flex: 1; min-width: 0; }
.cat-page-icon {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
}
.cat-page-icon svg { width: 22px; height: 22px; }
.cat-page-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.cat-page-meta-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Chips ── */
.cat-chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.73rem; font-weight: 600;
    background: var(--bg); border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 10px; border-radius: 99px;
    white-space: nowrap;
}
.cat-chip-ec {
    background: var(--primary-light);
    border-color: transparent;
    color: var(--primary);
}
.cat-chip-sm {
    display: inline-flex; align-items: center;
    font-size: 0.68rem; font-weight: 600;
    background: var(--primary-light); color: var(--primary);
    padding: 2px 7px; border-radius: 99px;
}

/* ── Sibling category tabs ── */
.cat-tabs {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap; margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.cat-tab {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.8rem; font-weight: 600;
    padding: 6px 14px; border-radius: 99px;
    background: var(--bg-white); border: 1.5px solid var(--border);
    color: var(--text-muted);
    transition: all var(--transition);
    white-space: nowrap;
}
.cat-tab:hover { border-color: var(--primary); color: var(--primary); }
.cat-tab-count {
    font-size: 0.65rem; font-weight: 700;
    background: var(--bg); color: var(--text-light);
    padding: 1px 6px; border-radius: 99px;
}

/* ── ExamCraft shortcode wrapper ── */
.cat-ec-section { margin-bottom: 32px; }
.cat-ec-shortcode-wrap {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

/* ── Fallback test list ── */
.cat-tests-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; }
.cat-test-row {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}
.cat-test-row:hover { transform: translateX(3px); box-shadow: var(--shadow-md); }
.cat-test-num {
    flex-shrink: 0;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--primary-light); color: var(--primary);
    font-weight: 800; font-size: 0.82rem;
    display: flex; align-items: center; justify-content: center;
}
.cat-test-info { flex: 1; min-width: 0; }
.cat-test-title { font-weight: 600; font-size: 0.92rem; color: var(--text); }
.cat-test-meta {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap; margin-top: 4px;
    font-size: 0.75rem; color: var(--text-muted);
}
.cat-test-meta span::before { content: '·'; margin-right: 10px; }
.cat-test-meta span:first-child::before { content: none; }
.cat-test-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ── Responsive ── */
@media (max-width: 640px) {
    .cat-page-header { flex-direction: column; }
    .cat-ec-shortcode-wrap { padding: 16px; }
    .cat-test-row { padding: 12px 14px; gap: 10px; }
}
