/* ============================================================
   Videe LMS Pro — app.css  (Redesigned v2)
   Brand color: #c6492c  |  Dark maroon: #3d1a10
   Font: Plus Jakarta Sans
   ============================================================ */

@import url('https://fonts.cdnfonts.com/css/opendyslexic');
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --color-brand:        #c6492c;
  --color-brand-dark:   #a33a22;
  --color-brand-light:  #f7ede9;
  --color-maroon:       #3d1a10;
  --color-maroon-mid:   #5c2515;
  --sidebar-width:      240px;
  --transition-base:    150ms ease-in-out;
  --radius-sm:          0.5rem;
  --radius-md:          0.75rem;
  --radius-lg:          0.875rem;
  --radius-xl:          1rem;
}

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Tailwind brand override ──────────────────────────────── */
.bg-brand       { background-color: var(--color-brand) !important; }
.bg-brand-dark  { background-color: var(--color-brand-dark) !important; }
.bg-brand-light { background-color: var(--color-brand-light) !important; }
.text-brand     { color: var(--color-brand) !important; }
.text-brand-dark{ color: var(--color-brand-dark) !important; }
.border-brand   { border-color: var(--color-brand) !important; }
.ring-brand     { --tw-ring-color: var(--color-brand) !important; }

/* ── Accessibility Modes ──────────────────────────────────── */
.dyslexia-font,
.dyslexia-font * {
  font-family: 'OpenDyslexic', 'Comic Sans MS', Arial, sans-serif !important;
}

.large-text                      { font-size: 1.125em !important; line-height: 1.7 !important; }
.large-text h1                   { font-size: 2em !important; }
.large-text h2                   { font-size: 1.75em !important; }
.large-text h3                   { font-size: 1.5em !important; }
.large-text p, .large-text li,
.large-text label, .large-text td,
.large-text th                   { font-size: 1.125em !important; line-height: 1.7 !important; }

.high-contrast                   { background: #000 !important; color: #fff !important; }
.high-contrast .bg-white,
.high-contrast .bg-gray-50,
.high-contrast .bg-gray-100      { background: #1a1a1a !important; }
.high-contrast .text-gray-600,
.high-contrast .text-gray-500,
.high-contrast .text-gray-400    { color: #ccc !important; }
.high-contrast .text-gray-700,
.high-contrast .text-gray-800,
.high-contrast .text-gray-900    { color: #fff !important; }
.high-contrast .border-gray-200,
.high-contrast .border-gray-300  { border-color: #555 !important; }
.high-contrast .card             { background: #1a1a1a !important; border: 1px solid #555 !important; }
.high-contrast a                 { color: #ffdd57 !important; }
.high-contrast button:focus,
.high-contrast a:focus,
.high-contrast input:focus       { outline: 3px solid #ffdd57 !important; outline-offset: 2px !important; }

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid #f0f0f0;
  overflow: hidden;
}
.card-header {
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid #f5f5f5;
}
.card-footer {
  padding: 0.875rem 1.5rem;
  border-top: 1px solid #f5f5f5;
  background: #fafafa;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background var(--transition-base), transform 0.1s, box-shadow var(--transition-base);
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--color-brand);
  color: white;
}
.btn-primary:hover {
  background: var(--color-brand-dark);
  box-shadow: 0 4px 12px rgba(198,73,44,0.3);
}

.btn-secondary {
  background: var(--color-brand-light);
  color: var(--color-brand-dark);
}
.btn-secondary:hover { background: #eeddd8; }

.btn-ghost {
  background: transparent;
  color: #374151;
}
.btn-ghost:hover { background: #f3f4f6; }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ── Input fields ─────────────────────────────────────────── */
.input-base {
  display: block;
  width: 100%;
  padding: 0.6rem 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: #111827;
  background: #fafafa;
  border: 1.5px solid #e5e7eb;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
  appearance: none;
  outline: none;
}
.input-base:focus {
  border-color: var(--color-brand);
  background: white;
  box-shadow: 0 0 0 3px rgba(198,73,44,0.12);
}
.input-base::placeholder { color: #9ca3af; }
.input-base:disabled     { background: #f3f4f6; cursor: not-allowed; opacity: 0.6; }
.input-error             { border-color: #ef4444 !important; }
.input-error:focus       { box-shadow: 0 0 0 3px rgba(239,68,68,0.12) !important; }

/* ── Sidebar ──────────────────────────────────────────────── */
#app-sidebar {
  width: var(--sidebar-width);
  transition: transform var(--transition-base);
  will-change: transform;
}
#app-sidebar.sidebar-hidden {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 39;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

@media (max-width: 1023px) {
  #app-sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 40;
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }
  #app-sidebar.sidebar-open { transform: translateX(0); }
  #main-content { margin-left: 0 !important; }
}

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
}
.badge-brand   { background: var(--color-brand-light); color: var(--color-brand-dark); }
.badge-green   { background: #dcfce7; color: #166534; }
.badge-yellow  { background: #fef9c3; color: #854d0e; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: #f3f4f6; color: #374151; }

/* ── Table ────────────────────────────────────────────────── */
.table-base { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table-base th {
  background: #fafafa;
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #f0f0f0;
}
.table-base td {
  padding: 0.75rem 1rem;
  color: #374151;
  border-bottom: 1px solid #f9f9f9;
}
.table-base tr:last-child td { border-bottom: none; }
.table-base tbody tr:hover   { background: #fafafa; }

/* ── Toast ────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 240px;
  max-width: 380px;
  animation: slideUp 0.25s ease-out both;
}
.toast--success { background: #dcfce7; color: #166534; border-left: 4px solid #16a34a; }
.toast--error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #dc2626; }
.toast--warning { background: #fef9c3; color: #854d0e; border-left: 4px solid #ca8a04; }
.toast--info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #2563eb; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease both;
  backdrop-filter: blur(3px);
}
.modal-box {
  background: white;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideUp 0.25s ease both;
}

/* ── Radial progress ──────────────────────────────────────── */
.radial-progress { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.radial-progress svg { transform: rotate(-90deg); }
.radial-progress .progress-track { fill: none; stroke: #e5e7eb; }
.radial-progress .progress-fill  { fill: none; stroke: var(--color-brand); stroke-linecap: round; transition: stroke-dashoffset 0.6s ease-in-out; }
.radial-progress .progress-label { position: absolute; font-size: 0.875rem; font-weight: 700; color: #111827; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity:0 } to { opacity:1 } }
@keyframes slideUp { from { opacity:0; transform:translateY(16px) } to { opacity:1; transform:translateY(0) } }
@keyframes slideDown { from { opacity:0; transform:translateY(-8px) } to { opacity:1; transform:translateY(0) } }
@keyframes countdown { from { stroke-dashoffset:0 } to { stroke-dashoffset:283 } }

.fade-in  { animation: fadeIn  0.25s ease-in-out both; }
.slide-up { animation: slideUp 0.3s ease-out both; }
.slide-down { animation: slideDown 0.25s ease-out both; }

.timer-ring__circle {
  stroke-dasharray: 283;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
  transition: stroke-dashoffset 1s linear;
}
.timer-ring__circle--warning { stroke: #f59e0b; }
.timer-ring__circle--danger  { stroke: #ef4444; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar        { width:5px; height:5px; }
::-webkit-scrollbar-track  { background:#f3f4f6; border-radius:3px; }
::-webkit-scrollbar-thumb  { background:#d1d5db; border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:#9ca3af; }
* { scrollbar-width:thin; scrollbar-color:#d1d5db #f3f4f6; }

/* ── Utility ──────────────────────────────────────────────── */
.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
