/* static/theme.css */

/* LIGHT MODE (default) */
:root{
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel2: #f1f5f9;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --ring: rgba(15, 23, 42, .14);
  --shadow: 0 10px 30px rgba(15,23,42,.08);
}

/* DARK MODE */
html.dark{
  --bg: #0b1220;
  --panel: rgba(15, 23, 42, .78);
  --panel2: rgba(30, 41, 59, .60);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, .18);
  --ring: rgba(226, 232, 240, .14);
  --shadow: 0 12px 40px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }

html, body{
  height:100%;
  overflow-x:hidden;
}

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

/* Layout */
.shell{
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Topbar */
.topbar{
  position: relative;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px){
  .topbar{
    position: sticky;
    top: 0;
  }
}

.topbar-inner{
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight: 900;
  letter-spacing: .2px;
  font-size: 26px;
}

/* Nav */
.nav{
  display:flex;
  flex-wrap:wrap;
  gap: 6px;
  align-items:center;
}

.nav a{
  color: var(--text);
  text-decoration:none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.nav a:hover{
  background: var(--panel2);
  border-color: var(--border);
}

/* Components */
.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card-h{
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.card-b{
  padding: 16px 18px 18px;
}

.h1{
  font-size: 26px;
  font-weight: 900;
  margin: 0;
}

.h2{
  font-size: 18px;
  font-weight: 850;
  margin: 0;
}

.small{
  font-size: 13px;
  color: var(--muted);
}

.muted{
  color: var(--muted);
  font-size: 14px;
}

.label{
  font-size: 14px;
  font-weight: 850;
  color: var(--text);
}

.hstack{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  align-items:center;
}

.spread{
  justify-content:space-between;
}

/* Buttons */
.btn{
  appearance:none;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 12px;
  font-weight: 900;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap: 8px;
  white-space: nowrap;
  line-height: 1.1;
}

.btn:hover{
  filter: brightness(0.98);
}

.btn:active{
  transform: translateY(1px);
}

.btn-primary{
  background: var(--text);
  color: var(--bg);
  border-color: color-mix(in srgb, var(--text) 70%, transparent);
}

html.dark .btn-primary{
  background: #e5e7eb;
  color: #0b1220;
  border-color: rgba(229,231,235,.2);
}

.btn-danger{
  background: #ef4444;
  color: white;
  border-color: rgba(239,68,68,.3);
}

/* Theme selector: System | Light | Dark */
.themeModeBar{
  display: inline-flex;
  align-items: stretch;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}

.themeModeBtn{
  appearance: none;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  min-width: 64px;
  height: 100%;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}

.themeModeBtn:last-child{
  border-right: 0;
}

.themeModeBtn:hover{
  background: var(--panel2);
  color: var(--text);
}

.themeModeBtn.is-active{
  background: var(--text);
  color: var(--bg);
}

html.dark .themeModeBtn.is-active{
  background: #e5e7eb;
  color: #0b1220;
}

/* Inputs */
.input, .select, .textarea{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  outline:none;
}

.input:focus, .select:focus, .textarea:focus{
  box-shadow: 0 0 0 4px var(--ring);
  border-color: color-mix(in srgb, var(--text) 28%, var(--border));
}

/* Badges */
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:max-content;
  max-width:none;
  flex:0 0 auto;
  white-space:nowrap;
  word-break:normal;
  overflow-wrap:normal;
  line-height:1;

  padding:.32rem .7rem;
  border-radius:999px;
  font-size:.78rem;
  font-weight:900;

  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
}

.table .badge{
  max-width:none !important;
}

/* Tables */
.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  table-layout: fixed;
}

.table th, .table td{
  text-align:left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.table td a{
  overflow-wrap: anywhere;
}

.table th{
  background: var(--panel2);
  font-weight: 900;
}

.table tr:last-child td{
  border-bottom:none;
}

.hr{
  height:1px;
  background: var(--border);
  border:none;
  margin: 14px 0;
}

/* Helpers */
.clamp-1{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clamp-2{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.break-anywhere{
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Toolbars / filter rows */
.toolbar{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.toolbar > *{
  flex: 1 1 180px;
  min-width: 0;
}

.actions{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Mobile */
@media (max-width: 640px){
  .topbar-inner{
    align-items:flex-start;
    flex-direction: column;
  }

  .toolbar > *{
    flex: 1 1 100%;
  }

  .actions .btn,
  .toolbar .btn{
    width: 100%;
    justify-content: center;
  }

  .nav a{
    padding: 10px 10px;
  }

  .themeModeBar{
    width: 100%;
  }

  .themeModeBtn{
    flex: 1;
    min-width: 0;
  }
}

/* Generic table helpers */
.table-wrap{
  overflow-x: auto;
}

.table-fixed{
  table-layout: fixed;
  width: 100%;
}

.table-fixed th,
.table-fixed td{
  vertical-align: top;
  overflow: hidden;
}

/* =========================================================
   Local utility compatibility layer
   Replaces the Tailwind CDN for the classes used by templates
   ========================================================= */

/* Display */
.hidden{ display:none !important; }
.block{ display:block !important; }
.flex{ display:flex !important; }
.inline-flex{ display:inline-flex !important; }
.grid{ display:grid !important; }

/* Flex */
.flex-col{ flex-direction:column !important; }
.flex-row{ flex-direction:row !important; }
.flex-wrap{ flex-wrap:wrap !important; }
.flex-1{ flex:1 1 0% !important; }

/* Grid */
.grid-cols-1{ grid-template-columns:repeat(1,minmax(0,1fr)) !important; }

/* Alignment */
.items-center{ align-items:center !important; }
.items-start{ align-items:flex-start !important; }
.items-end{ align-items:flex-end !important; }
.justify-between{ justify-content:space-between !important; }

/* Gaps */
.gap-2{ gap:.5rem !important; }
.gap-3{ gap:.75rem !important; }
.gap-4{ gap:1rem !important; }
.gap-5{ gap:1.25rem !important; }
.gap-6{ gap:1.5rem !important; }

/* Spacing */
.mt-1{ margin-top:.25rem !important; }
.mt-2{ margin-top:.5rem !important; }
.mt-3{ margin-top:.75rem !important; }
.mt-4{ margin-top:1rem !important; }
.mt-5{ margin-top:1.25rem !important; }
.mt-6{ margin-top:1.5rem !important; }

.mb-2{ margin-bottom:.5rem !important; }

.p-0{ padding:0 !important; }
.p-5{ padding:1.25rem !important; }
.p-6{ padding:1.5rem !important; }

.px-5{
  padding-left:1.25rem !important;
  padding-right:1.25rem !important;
}

.py-3{
  padding-top:.75rem !important;
  padding-bottom:.75rem !important;
}

.py-4{
  padding-top:1rem !important;
  padding-bottom:1rem !important;
}

.py-5{
  padding-top:1.25rem !important;
  padding-bottom:1.25rem !important;
}

.py-6{
  padding-top:1.5rem !important;
  padding-bottom:1.5rem !important;
}

.pt-3{ padding-top:.75rem !important; }
.pb-4{ padding-bottom:1rem !important; }
.pb-6{ padding-bottom:1.5rem !important; }
.pr-3{ padding-right:.75rem !important; }

/* Space between children */
.space-y-2 > * + *{ margin-top:.5rem !important; }
.space-y-3 > * + *{ margin-top:.75rem !important; }
.space-y-5 > * + *{ margin-top:1.25rem !important; }

/* Width / height */
.w-full{ width:100% !important; }
.w-3{ width:.75rem !important; }
.h-3{ height:.75rem !important; }
.min-w-0{ min-width:0 !important; }

/* Max width */
.max-w-md{ max-width:28rem !important; }
.max-w-2xl{ max-width:42rem !important; }
.max-w-3xl{ max-width:48rem !important; }
.max-w-4xl{ max-width:56rem !important; }

/* Overflow */
.overflow-hidden{ overflow:hidden !important; }
.overflow-x-auto{ overflow-x:auto !important; }

/* Text */
.text-left{ text-align:left !important; }
.text-xs{ font-size:.75rem !important; line-height:1rem !important; }
.text-sm{ font-size:.875rem !important; line-height:1.25rem !important; }
.text-lg{ font-size:1.125rem !important; line-height:1.75rem !important; }
.text-xl{ font-size:1.25rem !important; line-height:1.75rem !important; }
.text-2xl{ font-size:1.5rem !important; line-height:2rem !important; }

.font-bold{ font-weight:700 !important; }
.font-extrabold{ font-weight:900 !important; }

.uppercase{ text-transform:uppercase !important; }
.tracking-wide{ letter-spacing:.025em !important; }

.truncate{
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
}

.whitespace-pre-wrap{ white-space:pre-wrap !important; }

.underline{ text-decoration:underline !important; }

/* Borders / radius */
.rounded-full{ border-radius:9999px !important; }
.border{ border:1px solid var(--border) !important; }
.border-b{ border-bottom:1px solid var(--border) !important; }

/* Slate compatibility mapped to your theme */
.text-slate-500{
  color:var(--muted) !important;
}

.border-slate-100,
.border-slate-100\/70,
.border-slate-200,
.border-slate-200\/70{
  border-color:var(--border) !important;
}

/* Hover utilities */
.hover\:underline:hover{
  text-decoration:underline !important;
}

.hover\:bg-slate-50:hover,
.hover\:bg-slate-50\/70:hover{
  background:var(--panel2) !important;
}

.hover\:shadow-sm:hover{
  box-shadow:0 4px 14px rgba(15,23,42,.10) !important;
}

.transition-shadow{
  transition:box-shadow 140ms ease !important;
}

/* Dark-mode compatibility */
html.dark .dark\:text-slate-400{
  color:var(--muted) !important;
}

html.dark .dark\:border-slate-700\/70,
html.dark .dark\:border-slate-800\/50{
  border-color:var(--border) !important;
}

html.dark .dark\:hover\:bg-slate-950\/30:hover{
  background:var(--panel2) !important;
}

/* Row helper used in templates */
.row{
  border-top:1px solid var(--border);
}

/* Responsive: sm = 640px */
@media (min-width:640px){
  .sm\:hidden{ display:none !important; }
  .sm\:block{ display:block !important; }
  .sm\:inline{ display:inline !important; }
  .sm\:flex-row{ flex-direction:row !important; }
  .sm\:items-center{ align-items:center !important; }
  .sm\:items-start{ align-items:flex-start !important; }
  .sm\:items-end{ align-items:flex-end !important; }
  .sm\:justify-between{ justify-content:space-between !important; }
  .sm\:grid-cols-2{ grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
}

/* Responsive: md = 768px */
@media (min-width:768px){
  .md\:grid-cols-2{ grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  .md\:grid-cols-4{ grid-template-columns:repeat(4,minmax(0,1fr)) !important; }
  .md\:col-span-2{ grid-column:span 2 / span 2 !important; }
}

/* Responsive: lg = 1024px */
@media (min-width:1024px){
  .lg\:hidden{ display:none !important; }
  .lg\:block{ display:block !important; }
  .lg\:grid-cols-2{ grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  .lg\:grid-cols-3{ grid-template-columns:repeat(3,minmax(0,1fr)) !important; }
  .lg\:grid-cols-4{ grid-template-columns:repeat(4,minmax(0,1fr)) !important; }
  .lg\:col-span-2{ grid-column:span 2 / span 2 !important; }
}

/* =========================================================
   Dashboard Upcoming table fixes
   ========================================================= */

.dashboard-upcoming-wrap{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}

.dashboard-upcoming-table{
  width:100%;
  max-width:100%;
  table-layout:fixed;
}

.dashboard-upcoming-table .dash-col-due{
  width:20%;
}

.dashboard-upcoming-table .dash-col-type{
  width:150px;
}

.dashboard-upcoming-table .dash-col-title{
  width:auto;
}

.dashboard-upcoming-table .dash-col-course{
  width:22%;
}

.dashboard-upcoming-table .dash-col-status{
  width:112px;
}

.dashboard-upcoming-table th,
.dashboard-upcoming-table td{
  overflow-wrap:normal;
  word-break:normal;
}

.dashboard-upcoming-table .dash-due-cell{
  white-space:normal;
  line-height:1.18;
  overflow:hidden;
}

.dashboard-upcoming-table .dash-type-cell,
.dashboard-upcoming-table .dash-status-cell{
  white-space:nowrap;
  overflow:visible;
}

.dashboard-upcoming-table .dashboard-title-cell,
.dashboard-upcoming-table .dash-course-cell{
  min-width:0;
  overflow:hidden;
}

.dashboard-upcoming-table .dash-course-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
  max-width:100%;
}

.dashboard-upcoming-table .dash-course-dot{
  width:10px;
  height:10px;
  flex:0 0 auto;
  border-radius:999px;
  border:1px solid var(--border);
}

.dashboard-upcoming-table .dash-course-name{
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.badge.badge-type{
  width:7.25rem !important;
  min-width:7.25rem !important;
  max-width:7.25rem !important;
  padding:.36rem .7rem !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:clip !important;
  box-sizing:border-box;
}

.badge.badge-status{
  width:4.8rem !important;
  min-width:4.8rem !important;
  max-width:4.8rem !important;
  padding:.36rem .65rem !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  box-sizing:border-box;
}

/* Dashboard title opens item but looks like normal text */
.dashboard-title-cell{
  font-weight:900;
  min-width:0;
}

.dashboard-title-cell form,
.dashboard-title-form{
  margin:0;
  padding:0;
  display:block;
  max-width:100%;
}

.dashboard-title-cell button,
.dashboard-title-button{
  appearance:none;
  border:0;
  background:transparent;
  color:var(--text) !important;
  padding:0;
  margin:0;
  width:100%;
  max-width:100%;

  display:block;
  text-align:left;
  font:inherit;
  font-weight:900;
  line-height:1.2;

  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;

  cursor:pointer;
}

.dashboard-title-cell button:hover,
.dashboard-title-button:hover{
  opacity:.82;
}

.dashboard-title-cell button:focus,
.dashboard-title-button:focus{
  outline:none;
}

.dashboard-title-cell button:focus-visible,
.dashboard-title-button:focus-visible{
  box-shadow:0 0 0 4px var(--ring);
  border-radius:8px;
}