/* ==========================================================================
   Learning Platform - 2027 Ultra-Responsive Design System
   Full Viewport Coverage: 320px -> 1920px
   RTL-First, Mobile-First, Touch-Optimized
   ========================================================================== */

/* Universal High-Contrast Selection: Fix text disappearing when highlighted */
*::selection,
::selection {
  background-color: #EA580C !important;
  color: #FFFFFF !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45) !important;
  -webkit-text-fill-color: #FFFFFF !important;
}
*::-moz-selection,
::-moz-selection {
  background-color: #EA580C !important;
  color: #FFFFFF !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45) !important;
  -webkit-text-fill-color: #FFFFFF !important;
}

/* --------------------------------------------------------------------------
   1. Root & Reset Rules (Zero Horizontal Overflow Guarantee)
   -------------------------------------------------------------------------- */
:root {
  --screen-xs: 320px;
  --screen-sm: 640px;
  --screen-md: 768px;
  --screen-lg: 1024px;
  --screen-xl: 1280px;
  --screen-2xl: 1536px;
  --screen-3xl: 1920px;
}

html, body {
  width: 100% !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}

*, *::before, *::after {
  box-sizing: border-box !important;
}

#root,
.min-h-screen {
  width: 100% !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
}

/* --------------------------------------------------------------------------
   2. Fluid Typography & Dynamic Spacing (clamp)
   -------------------------------------------------------------------------- */
h1 {
  font-size: clamp(1.25rem, 3.5vw + 0.5rem, 2.25rem) !important;
  line-height: 1.3 !important;
}

h2 {
  font-size: clamp(1.1rem, 2.8vw + 0.4rem, 1.75rem) !important;
  line-height: 1.35 !important;
}

h3 {
  font-size: clamp(1rem, 2.2vw + 0.3rem, 1.4rem) !important;
  line-height: 1.4 !important;
}

/* Big Lesson Title Badge */
label.inline-block.rounded-2xl {
  font-size: clamp(0.95rem, 3vw, 1.25rem) !important;
  padding: clamp(0.5rem, 1.8vw, 0.85rem) clamp(1rem, 3.5vw, 2.25rem) !important;
  max-width: 100% !important;
  word-break: break-word !important;
}

/* --------------------------------------------------------------------------
   3. Mobile-First Form & Layout Rules (<= 640px)
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  /* Reduce outer container margins and paddings */
  main {
    padding-left: 0.625rem !important; /* 10px */
    padding-right: 0.625rem !important;
    padding-top: 0.75rem !important;
    padding-bottom: 2rem !important;
    max-width: 100% !important;
  }

  /* Main Card Containers */
  .bg-white.border.border-slate-200.rounded-2xl {
    padding: 0.875rem !important;
    border-radius: 1rem !important;
  }

  /* Title Card */
  .bg-gradient-to-r.from-amber-50 {
    padding: 0.75rem !important;
    border-radius: 1rem !important;
  }

  /* Force min-w-0 on flex children to prevent overflow */
  .min-w-\[280px\],
  .lg\:min-w-\[420px\] {
    min-width: 0 !important;
    width: 100% !important;
  }

  /* Action Buttons grid under Title */
  .shrink-0.grid.grid-cols-2 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.4rem !important;
    width: 100% !important;
    margin-top: 0.5rem !important;
  }

  .shrink-0.grid.grid-cols-2 > button,
  .shrink-0.grid.grid-cols-2 > div > label {
    padding: 0.5rem 0.4rem !important;
    font-size: 0.72rem !important;
    min-height: 40px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* 18 Question Types Grid on Mobile: Pure single column */
  .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Question Card Inner Layout on Mobile */
  [id^="tool-box-"] {
    padding: 0.85rem !important;
    border-radius: 1rem !important;
  }

  /* Question Card Header */
  [id^="tool-box-"] > div:first-child > div.flex.items-start.justify-between {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  /* Question Card Footer controls */
  [id^="tool-box-"] > div.border-t {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    justify-content: space-between !important;
  }

  /* Generate Buttons Stack */
  #btn-generate-fresh,
  #btn-generate-append,
  button:has([class*="lucide-sparkles"]),
  .space-y-2\.5 > button {
    width: 100% !important;
    padding: 0.85rem 1rem !important;
    font-size: 0.95rem !important;
  }

  /* Header adjustments on mobile */
  header {
    height: 3.5rem !important;
  }

  header > div {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  /* User button on mobile */
  header button {
    max-width: 100% !important;
  }
}

/* --------------------------------------------------------------------------
   4. Touch-Screen Enhancements (Always show reorder arrows on touch/mobile)
   -------------------------------------------------------------------------- */
@media (max-width: 768px), (hover: none) {
  /* Make Up / Down reorder arrows visible on mobile instead of requiring hover */
  [id^="tool-box-"] .opacity-0,
  [id^="draggable-output-"] .opacity-0,
  .group .opacity-0 {
    opacity: 1 !important;
  }

  /* Larger touch targets for buttons */
  button, 
  [role="button"],
  input[type="button"],
  input[type="submit"] {
    min-height: 38px;
  }

  /* Increment / Decrement touch buttons */
  [id^="decrement-"],
  [id^="increment-"] {
    width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
  }
}

/* --------------------------------------------------------------------------
   5. Tablet Layout Rules (768px <= width <= 1024px)
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1024px) {
  main {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
    max-width: 100% !important;
  }

  /* Balanced 2-column grid on Tablet */
  .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem !important;
  }

  /* Title action buttons */
  .shrink-0.grid.grid-cols-2 {
    grid-template-columns: repeat(2, auto) !important;
  }

  /* Additional options grid */
  .grid.grid-cols-1.md\:grid-cols-12 {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  }
}

/* --------------------------------------------------------------------------
   6. Desktop & Ultra-Wide Monitor Rules (>= 1025px and >= 1920px)
   -------------------------------------------------------------------------- */
@media (min-width: 1025px) {
  /* Prevent awkward stretching on huge displays */
  main,
  header > div,
  footer > div {
    max-width: 1280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* 3-column question grid on Desktop */
  .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 1.15rem !important;
  }
}

@media (min-width: 1920px) {
  /* Elegant max-width containment on 1920px+ monitors */
  main,
  header > div {
    max-width: 1400px !important;
  }
}

/* --------------------------------------------------------------------------
   7. Modals & Dialogs Responsiveness (PDF Viewer, Photo Studio, Auth)
   -------------------------------------------------------------------------- */
.fixed.inset-0.z-50 {
  padding: clamp(0.5rem, 2vw, 1.5rem) !important;
}

@media (max-width: 640px) {
  /* Full screen modal on mobile with zero wasted margin */
  .fixed.inset-0.z-50.flex.items-stretch {
    padding: 0 !important;
  }

  .fixed.inset-0.z-50 > div.bg-white {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
  }

  /* PDF Viewer Toolbar on Mobile */
  .fixed.inset-0.z-50 header,
  .fixed.inset-0.z-50 .border-b {
    padding: 0.5rem !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
  }

  .fixed.inset-0.z-50 header button,
  .fixed.inset-0.z-50 .border-b button {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.72rem !important;
  }
}

/* --------------------------------------------------------------------------
   8. Tables & Markdown Responsive Wrap
   -------------------------------------------------------------------------- */
table {
  width: 100% !important;
  max-width: 100% !important;
  border-collapse: collapse !important;
}

/* Make every table horizontally scrollable on mobile without leaking */
.overflow-x-auto,
div:has(> table) {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* Ensure code blocks and pre wrap or scroll cleanly */
pre, code {
  max-width: 100% !important;
  word-break: break-word !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* Word break for all paragraphs and headings */
p, span, div, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
}

/* --------------------------------------------------------------------------
   9. Interactive Quiz & Drag-and-Drop Order Manager Responsiveness
   -------------------------------------------------------------------------- */
[id^="draggable-output-"] {
  width: 100% !important;
  max-width: 100% !important;
}

@media (max-width: 640px) {
  [id^="draggable-output-"] {
    padding: 0.65rem !important;
    gap: 0.5rem !important;
  }

  [id^="draggable-output-"] .text-sm,
  [id^="draggable-output-"] h4 {
    font-size: 0.8rem !important;
  }

  /* Quiz option buttons */
  .quiz-option-button,
  button:has([class*="lucide-circle-check"]) {
    width: 100% !important;
    padding: 0.75rem 0.85rem !important;
  }
}

/* --------------------------------------------------------------------------
   10. Custom Scrollbar for Sleek 2027 Aesthetic
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}


/* ========================================================
   PREMIUM 2027 GENERATION BUTTONS LAYOUT & SIZING
   ======================================================== */
#sequential-generate-btn,
#sequential-append-generate-btn {
  width: 100% !important;
  min-height: 64px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  padding: 14px 18px !important;
  border-radius: 14px !important;
  box-sizing: border-box !important;
  text-align: right !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#sequential-generate-btn:hover,
#sequential-append-generate-btn:hover {
  transform: translateY(-1px) !important;
}

#sequential-generate-btn:active,
#sequential-append-generate-btn:active {
  transform: scale(0.99) !important;
}


/* ========================================================
   CRITICAL FIX: 2027 FULL-WIDTH GENERATION BUTTONS
   ======================================================== */
.generation-buttons-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 16px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  clear: both !important;
}

@media (max-width: 768px) {
  .generation-buttons-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

#sequential-generate-btn,
#sequential-append-generate-btn {
  width: 100% !important;
  min-height: 68px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 14px !important;
  padding: 14px 20px !important;
  border-radius: 16px !important;
  box-sizing: border-box !important;
  text-align: right !important;
  cursor: pointer !important;
  position: relative !important;
  z-index: 10 !important;
  pointer-events: auto !important;
  overflow: hidden !important;
}

#sequential-generate-btn:disabled,
#sequential-append-generate-btn:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
}

#btn-bar-run-ai-extract, #btn-page-open-ai-extract { white-space: nowrap !important; }


/* ==========================================================================
   Interactive 3D Flashcards & Focus Mode Styles (2027 Standard)
   ========================================================================== */
.flashcard-perspective {
  perspective: 1200px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 320px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  cursor: pointer;
}

.flashcard-inner.is-flipped {
  transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem;
  box-sizing: border-box;
}

.flashcard-front {
  transform: rotateY(0deg);
}

.flashcard-back {
  transform: rotateY(180deg);
}

/* Fullscreen Flashcards Focus Mode */
.flashcards-focus-mode {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  background: rgba(15, 23, 42, 0.94) !important;
  backdrop-filter: blur(14px) !important;
  padding: 1.25rem !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  overflow-y: auto !important;
}

.flashcards-focus-container {
  width: 100% !important;
  max-width: 780px !important;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 15px rgba(99, 102, 241, 0.2); }
  50% { box-shadow: 0 0 30px rgba(99, 102, 241, 0.45); }
}

.pulse-glow {
  animation: pulseGlow 2.5s infinite ease-in-out;
}


/* ==========================================================================
   Utilities & Breakpoint Fixes for Custom Views
   ========================================================================== */
@media (min-width: 640px) {
  .sm\:hidden {
    display: none !important;
  }
  .sm\:flex {
    display: flex !important;
  }
  .sm\:block {
    display: block !important;
  }
  .sm\:inline {
    display: inline !important;
  }
  .sm\:flex-row {
    flex-direction: row !important;
  }
}

@media (max-width: 639px) {
  .sm\:hidden {
    display: flex !important;
  }
}

/* ==========================================================================
   Micro Header Capsules (Prayer Countdown & Pomodoro Timer)
   ========================================================================== */
#header-capsules-root {
  display: flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
  flex-shrink: 0 !important;
}

#pomo-capsule, #prayer-capsule {
  height: 29px !important;
  white-space: nowrap !important;
  user-select: none !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#pomo-capsule:hover, #prayer-capsule:hover {
  transform: translateY(-1px);
}

@keyframes prayerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.prayer-due-pulse {
  animation: prayerPulse 1.8s infinite !important;
}



/* ==========================================================================
   Fix for Saved Lessons Dropdown & "عرض السجل" History Button Responsiveness
   ========================================================================== */
.border-t.border-amber-200\/80 {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.border-t.border-amber-200\/80 > div {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.border-t.border-amber-200\/80 button {
  max-width: 100% !important;
}

/* Ensure no child spills out of the yellow card */
.bg-gradient-to-r.from-amber-50 {
  max-width: 100% !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

@media (max-width: 1100px) {
  .border-t.border-amber-200\/80 {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
}


/* ==========================================================================
   GLOBAL DUAL THEME SYSTEM: Luminous Day (Silk Porcelain Zinc + Black & Yellow) vs Dark OLED
   ========================================================================== */

/* Global Theme Switcher Button in Header */
.global-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #000000;
  color: #fde047;
  border: 1.5px solid #000000;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 2px 2px 0px #000000;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
  line-height: 1.2;
}
.global-theme-btn:hover {
  transform: translateY(-1px);
  box-shadow: 3px 3px 0px #000000;
}
.global-theme-btn:active {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   1. ☀️ Luminous Day Theme (Silk Porcelain / Luminous Zinc + Neo-Luxury Black & Yellow)
   -------------------------------------------------------------------------- */
html.app-theme-light,
body.app-theme-light {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

html.app-theme-light header {
  background: #ffffff !important;
  border-bottom: 2px solid #000000 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04) !important;
}

/* Yellow and Black Neo-Luxury Accent Titles */
html.app-theme-light [class*="bg-amber-"],
html.app-theme-light [class*="bg-yellow-"],
html.app-theme-light div:has(> h1),
html.app-theme-light .bg-amber-100 {
  border-color: #000000 !important;
}

/* Make headers and major cards high-contrast Neo-Luxury */
html.app-theme-light .rounded-xl,
html.app-theme-light .rounded-2xl {
  border-color: #000000;
}

/* --------------------------------------------------------------------------
   2. 🌙 Dark OLED Theme (Pitch Black OLED + Vibrant Yellow / Gold Accents)
   -------------------------------------------------------------------------- */
html.app-theme-dark,
body.app-theme-dark {
  background-color: #050811 !important;
  color: #f8fafc !important;
}

html.app-theme-dark header {
  background: #090e1a !important;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

html.app-theme-dark header * {
  color: #f8fafc;
}

html.app-theme-dark .bg-\[\#F8FAFC\],
html.app-theme-dark .bg-slate-50,
html.app-theme-dark .bg-slate-100,
html.app-theme-dark .bg-white {
  background-color: #0b1120 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

html.app-theme-dark [class*="border-slate-"],
html.app-theme-dark [class*="border-gray-"] {
  border-color: rgba(255, 255, 255, 0.14) !important;
}

html.app-theme-dark input,
html.app-theme-dark textarea,
html.app-theme-dark select {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
}

html.app-theme-dark input::placeholder,
html.app-theme-dark textarea::placeholder {
  color: #64748b !important;
}

html.app-theme-dark [class*="bg-amber-"],
html.app-theme-dark [class*="bg-yellow-"] {
  background: #1c1917 !important;
  border-color: #fde047 !important;
  color: #fde047 !important;
}

html.app-theme-dark [class*="bg-amber-"] *,
html.app-theme-dark [class*="bg-yellow-"] * {
  color: #fde047 !important;
}

html.app-theme-dark .text-slate-900,
html.app-theme-dark .text-slate-800,
html.app-theme-dark .text-slate-700 {
  color: #f1f5f9 !important;
}

html.app-theme-dark .text-slate-600,
html.app-theme-dark .text-slate-500 {
  color: #94a3b8 !important;
}

html.app-theme-dark .notifications-card {
  background: #0b1120 !important;
  border-color: #fde047 !important;
  box-shadow: 6px 6px 0px #fde047 !important;
  color: #f8fafc !important;
}

html.app-theme-dark .notif-body {
  background: #050811 !important;
}

html.app-theme-dark .notif-item-card {
  background: #0f172a !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f8fafc !important;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.5) !important;
}

html.app-theme-dark .notif-item-title {
  color: #fde047 !important;
}

html.app-theme-dark .notif-item-msg {
  color: #e2e8f0 !important;
}

html.app-theme-dark .notif-footer {
  background: #0b1120 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* --------------------------------------------------------------------------
   3. Notification & Broadcast System Overrides (Strict Bell-Only Architecture)
   -------------------------------------------------------------------------- */
#system-broadcast-banner,
.system-broadcast-banner {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

#btn-propose-broadcast-trigger {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
#btn-propose-broadcast-trigger:hover {
  transform: translateY(-2px) scale(1.01) !important;
  box-shadow: 4px 4px 0px #000000 !important;
}
#btn-propose-broadcast-trigger:active {
  transform: translateY(1px) scale(0.99) !important;
  box-shadow: 1px 1px 0px #000000 !important;
}

html.app-theme-dark #btn-propose-broadcast-trigger {
  background: linear-gradient(135deg, #fef08a 0%, #facc15 100%) !important;
  color: #000000 !important;
  border-color: #000000 !important;
}

/* ==========================================================================
   4. 🎨 VIBRANT SOFT NEO-BRUTALISM DESIGN SYSTEM (النيو-بروتاليزم المبهج)
   مستوحى من تصميمات الجرافيك الحديثة مع الحفاظ التام على الألوان المبهجة:
   (الأزرق الملكي، اللبني السماوي، الأحمر الناري، الأصفر المشمس، الأخضر الزمردي)
   ========================================================================== */

/* --- 4.1. Warm Porcelain Canvas (خلفية عاجية هادئة مريحة للعين) --- */
html.app-theme-light,
body.app-theme-light {
  background-color: #faf9f5 !important;
  color: #0f172a !important;
}

/* --- 4.2. Core Cards & Containers with Crisp 2px Outlines & Hard Shadows --- */
html.app-theme-light .bg-white.border,
html.app-theme-light form > div.bg-white,
html.app-theme-light div.rounded-2xl.border,
html.app-theme-light div.rounded-xl.border {
  border: 2px solid #000000 !important;
  box-shadow: 4px 4px 0px #000000 !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

html.app-theme-light .bg-white.border:hover,
html.app-theme-light div.rounded-2xl.border:hover,
html.app-theme-light div.rounded-xl.border:hover {
  box-shadow: 5px 5px 0px #000000 !important;
}

/* --- 4.3. Joyful Color Palette Mapping (ألوان مبهجة ذات طابع ستيكر صلب) --- */

/* 🔵 1. الأزرق الملكي (Royal Blue) - عارض PDF داخل المحتوى ومفاتيح الأسئلة */
html.app-theme-light main a[href*="research"],
html.app-theme-light button[title*="عارض PDF"],
html.app-theme-light main .bg-indigo-600,
html.app-theme-light main .from-indigo-600 {
  background: #2563eb !important;
  color: #ffffff !important;
  border: 2px solid #000000 !important;
  box-shadow: 3px 3px 0px #000000 !important;
  font-weight: 900 !important;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
html.app-theme-light main a[href*="research"]:hover,
html.app-theme-light button[title*="عارض PDF"]:hover {
  transform: translate(-1.5px, -1.5px) !important;
  box-shadow: 4.5px 4.5px 0px #1d4ed8 !important;
}

/* 🩵 2. اللبني السماوي (Vibrant Cyan / Sky Blue) - مكتبة الكتب داخل المحتوى وأكمل الفراغات والوسوم */
html.app-theme-light main a[href*="library"],
html.app-theme-light .bg-cyan-500,
html.app-theme-light .bg-sky-500 {
  border-color: #0284c7 !important;
}
html.app-theme-light main a[href*="library"] {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 2px solid #000000 !important;
  box-shadow: 3px 3px 0px #0284c7 !important;
  font-weight: 800 !important;
  transition: all 0.15s ease !important;
}
html.app-theme-light main a[href*="library"]:hover {
  background: #bae6fd !important;
  transform: translate(-1.5px, -1.5px) !important;
  box-shadow: 4.5px 4.5px 0px #0284c7 !important;
}

/* 🟢 3. الأخضر الزمردي المنعش (Vibrant Emerald / Mint Green) - استوديو الصور والحفظ والأهداف */
html.app-theme-light label[title*="إرفاق صورة"],
html.app-theme-light button[title*="حفظ"],
html.app-theme-light .bg-emerald-600,
html.app-theme-light .from-emerald-600 {
  background: #16a34a !important;
  color: #ffffff !important;
  border: 2px solid #000000 !important;
  box-shadow: 3px 3px 0px #000000 !important;
  font-weight: 900 !important;
  transition: all 0.15s ease !important;
}
html.app-theme-light label[title*="إرفاق صورة"]:hover,
html.app-theme-light button[title*="حفظ"]:hover {
  transform: translate(-1.5px, -1.5px) !important;
  box-shadow: 4.5px 4.5px 0px #15803d !important;
}

/* 🔴 4. الأحمر الناري المبهج (Ruby Red / Coral) - النجمة وتنبيهات الأخطاء ومحاكاة الصواب والخطأ */
html.app-theme-light .text-red-600,
html.app-theme-light .text-rose-600 {
  color: #e11d48 !important;
  font-weight: 900 !important;
}
html.app-theme-light .bg-rose-50,
html.app-theme-light .bg-red-50 {
  background: #fff1f2 !important;
  border: 2px solid #e11d48 !important;
  box-shadow: 3px 3px 0px #e11d48 !important;
}

/* 🟡 5. الأصفر المشمس (Sunny Gold / Electric Amber) - العنوان الرئيسي والكبسولات والنتائج */
html.app-theme-light label[for="lesson-content-input"],
html.app-theme-light .bg-amber-300,
html.app-theme-light .bg-yellow-300 {
  background: #fde047 !important;
  color: #000000 !important;
  border: 3px solid #000000 !important;
  box-shadow: 4px 4px 0px #000000 !important;
  font-weight: 900 !important;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
html.app-theme-light label[for="lesson-content-input"]:hover {
  transform: translate(-2px, -2px) !important;
  box-shadow: 6px 6px 0px #000000 !important;
}

/* --- 4.4. Big Action Button ("توليد مخرجات الدرس") --- */
html.app-theme-light button[type="submit"],
html.app-theme-light .btn-generate-main {
  border: 3px solid #000000 !important;
  box-shadow: 5px 5px 0px #000000 !important;
  border-radius: 1rem !important;
  font-weight: 900 !important;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
html.app-theme-light button[type="submit"]:hover {
  transform: translate(-2px, -2px) !important;
  box-shadow: 7px 7px 0px #000000 !important;
}
html.app-theme-light button[type="submit"]:active {
  transform: translate(2px, 2px) !important;
  box-shadow: 2px 2px 0px #000000 !important;
}

/* --- 4.5. Header Micro Capsules (Clean, non-tilted, elegant alignment) --- */
#header-capsules-root > div,
#header-capsules-root > div:nth-child(odd),
#header-capsules-root > div:nth-child(even) {
  transform: none !important;
}
#header-capsules-root > div:hover {
  transform: none !important;
}

/* Tool Selector Grid Cards (كروت أنواع الأسئلة الـ 18) - الظل الأحمر الحاد بدلاً من الأسود */
html.app-theme-light div.rounded-2xl.border:has(button[id^="checkbox-"]),
html.app-theme-light div.rounded-2xl:has(button[id^="checkbox-"]),
html.app-theme-light [class*="grid-cols-"] > div:has(button[id^="checkbox-"]),
html.app-theme-light [class*="grid-cols-"] > div.relative,
html.app-theme-light .grid > div.relative,
html.app-theme-light [class*="grid-cols-"] > div:has(input[type="checkbox"]) {
  border: 2px solid #000000 !important;
  box-shadow: 4px 4px 0px #dc2626 !important; /* الظل الأحمر الحاد */
  border-radius: 1rem !important;
  background-color: #ffffff !important;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

html.app-theme-light div.rounded-2xl.border:has(button[id^="checkbox-"]):hover,
html.app-theme-light [class*="grid-cols-"] > div:has(button[id^="checkbox-"]):hover,
html.app-theme-light .grid > div.relative:hover {
  transform: translate(-1.5px, -1.5px) !important;
  box-shadow: 6px 6px 0px #b91c1c !important; /* ظل أحمر أعمق عند التمرير */
}

/* الكروت النشطة / المفعلة (Active / Selected) مع ظل أحمر بارز */
html.app-theme-light div.rounded-2xl.border:has(button[id^="checkbox-"]:not(.bg-white)),
html.app-theme-light [class*="grid-cols-"] > div:has(button[id^="checkbox-"]:not(.bg-white)) {
  border: 2.5px solid #000000 !important;
  box-shadow: 5px 5px 0px #dc2626 !important;
  background-color: #fffdfd !important;
}

/* زر التفعيل داخل كروت الأسئلة */
html.app-theme-light button[id^="checkbox-"] {
  border: 2px solid #000000 !important;
  border-radius: 0.65rem !important;
  font-weight: 900 !important;
  transition: all 0.15s ease !important;
}
html.app-theme-light button[id^="checkbox-"]:hover {
  transform: scale(1.03) !important;
}
/* عند التفعيل (مفعّل): أحمر ناري مبهج وجريء */
html.app-theme-light button[id^="checkbox-"]:not(.bg-white):not([class*="bg-slate"]) {
  background: #dc2626 !important;
  color: #ffffff !important;
  box-shadow: 2px 2px 0px #000000 !important;
}

/* عداد الأرقام والأزرار + و - داخل كرت السؤال */
html.app-theme-light div:has(button[id^="checkbox-"]) button:hover {
  color: #dc2626 !important;
}
html.app-theme-light div:has(button[id^="checkbox-"]) div.border {
  border-color: #000000 !important;
  box-shadow: 1.5px 1.5px 0px #dc2626 !important;
}

/* بادج "مستبعد" بطابع أحمر هادئ */
html.app-theme-light div:has(button[id^="checkbox-"]) span.bg-slate-200 {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  border: 1px solid #fecdd3 !important;
  font-weight: 800 !important;
}

/* عنوان قسم أنواع الأسئلة مع ظل أحمر مبهج */
html.app-theme-light div:has(> label[for="lesson-content-input"]) ~ div div:has(> [style*="fontSize"]),
html.app-theme-light div:has(> [style*="fontSize: 20px"]),
html.app-theme-light [style*="fontSize: 20px"] {
  box-shadow: 4px 4px 0px #dc2626 !important;
}

/* كروت المخرجات والأسئلة المولدة (Quiz, True/False, Reasoning) بظل أحمر مبهج */
html.app-theme-light .quiz-question-card,
html.app-theme-light [id^="question-card-"],
html.app-theme-light div.rounded-2xl.border:has(> div > div > .text-rose-600),
html.app-theme-light div.rounded-2xl.border:has(> div > div > .text-red-600) {
  border: 2px solid #000000 !important;
  box-shadow: 4px 4px 0px #dc2626 !important;
}

/* بادجات ووسوم حمراء مبهجة (مثل بادج تقرير المصادر في الصورة المرجعية) */
html.app-theme-light span[class*="text-rose-"],
html.app-theme-light span[class*="text-red-"] {
  border: 1.5px solid #dc2626 !important;
  color: #dc2626 !important;
  background: #fff1f2 !important;
  box-shadow: 2px 2px 0px #dc2626 !important;
  font-weight: 800 !important;
}

/* أزرار الإجراءات السريعة باللون الأحمر المبهج عند التمرير */
html.app-theme-light button:has(> span:contains("إلغاء التحديد")):hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border-color: #dc2626 !important;
}

/* Inputs & Textareas */
html.app-theme-light input[type="text"],
html.app-theme-light textarea {
  border: 2px solid #000000 !important;
  box-shadow: 2.5px 2.5px 0px #000000 !important;
  border-radius: 0.75rem !important;
  transition: all 0.15s ease !important;
}
html.app-theme-light input[type="text"]:focus,
html.app-theme-light textarea:focus {
  border-color: #000000 !important;
  box-shadow: 4px 4px 0px #000000 !important;
}

/* --- 4.6. Dark Mode Neo-Brutalist Evolution (High Contrast Neon Accents) --- */
html.app-theme-dark .bg-white.border,
html.app-theme-dark div.rounded-2xl.border,
html.app-theme-dark div.rounded-xl.border {
  border: 2px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 4px 4px 0px #000000 !important;
}
html.app-theme-dark .bg-white.border:hover,
html.app-theme-dark div.rounded-2xl.border:hover {
  border-color: #fde047 !important;
  box-shadow: 4px 4px 0px #fde047 !important;
}
html.app-theme-dark label[for="lesson-content-input"] {
  background: #1c1917 !important;
  color: #fde047 !important;
  border: 3px solid #fde047 !important;
  box-shadow: 4px 4px 0px #fde047 !important;
}
html.app-theme-dark button[type="submit"] {
  border: 2.5px solid #fde047 !important;
  box-shadow: 4px 4px 0px #fde047 !important;
}




/* ==========================================================================
   Mobile-First Responsiveness & Vertical Stacking (Max-Width 768px)
   Matches user specs: CSS Flexbox, Grid & Media Queries, vertical stacking on mobile,
   touch targets 44px+, crisp typography, preserving desktop layout on min-width 1024px.
   ========================================================================== */

@media (max-width: 768px) {
  /* 1. Vertical Stacking of Lesson Title Card & Inputs */
  .bg-gradient-to-r.from-amber-50,
  div:has(> #lesson-title-input),
  div:has(> label[for="lesson-title-input"]) {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    padding: 12px !important;
    gap: 12px !important;
  }

  /* Force the flex row containing title input and buttons to stack vertically */
  .bg-gradient-to-r.from-amber-50 > div.flex.flex-col.sm\:flex-row,
  .bg-gradient-to-r.from-amber-50 > div:first-child {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 12px !important;
  }

  /* Full-width Title Input with touch height */
  #lesson-title-input {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 15px !important;
    padding: 12px 14px !important;
    border-radius: 12px !important;
    border-width: 2px !important;
  }

  /* 2. 2x2 Grid for Action Buttons with 48px Touch Targets */
  .bg-gradient-to-r.from-amber-50 .shrink-0.grid.grid-cols-2,
  .bg-gradient-to-r.from-amber-50 div:has(> button:contains("التصوير بالكاميرا")) {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .bg-gradient-to-r.from-amber-50 .shrink-0.grid.grid-cols-2 button,
  .bg-gradient-to-r.from-amber-50 .shrink-0.grid.grid-cols-2 div > label {
    min-height: 46px !important;
    height: auto !important;
    padding: 10px 8px !important;
    font-size: 13.5px !important;
    font-weight: 800 !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    touch-action: manipulation !important;
  }

  /* 3. Batch OCR Bar Full Width */
  div.bg-red-500,
  div:has(> span:contains("Batch OCR")),
  div[class*="Batch OCR"] {
    width: 100% !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    border-radius: 10px !important;
    text-align: center !important;
  }

  /* 4. Editor Toolbar Wrapping & Easy-to-Touch Controls */
  div:has(> button:contains("تسجيل وتفريغ صوتي")),
  div:has(> button:contains("نص ماركداون خام")) {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    padding: 8px !important;
  }

  div:has(> button:contains("تسجيل وتفريغ صوتي")) button,
  div:has(> button:contains("نص ماركداون خام")) button {
    min-height: 42px !important;
    padding: 8px 12px !important;
    font-size: 12.5px !important;
    font-weight: 800 !important;
    border-radius: 10px !important;
  }

  /* 5. Subject Tabs Horizontal Scroll on Mobile */
  .subject-tabs-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding-bottom: 4px !important;
  }
  .subject-tabs-container::-webkit-scrollbar {
    display: none !important;
  }
}

/* Desktop Preservation (Min-Width 1024px) */
@media (min-width: 1024px) {
  .bg-gradient-to-r.from-amber-50 > div.flex.flex-col.sm\:flex-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
  }

  #lesson-title-input {
    min-width: 420px !important;
  }
}


/* ==========================================================================
   Question / Tool Output Cards: 100% Pure Bold Black (#000000) Typography
   Guarantees maximum contrast and crisp readability regardless of activation state
   ========================================================================== */

[id^="tool-box-"],
[id^="tool-box-"] * {
  color: #000000 !important;
}

[id^="tool-box-"] h4 {
  color: #000000 !important;
  font-weight: 900 !important;
  font-size: 13.5px !important;
  line-height: 1.4 !important;
}

[id^="tool-box-"] p {
  color: #000000 !important;
  font-weight: 700 !important;
  font-size: 11.5px !important;
  line-height: 1.55 !important;
  opacity: 1 !important;
}

[id^="tool-box-"] span.font-mono,
[id^="tool-box-"] [class*="text-slate-400"],
[id^="tool-box-"] [class*="text-slate-500"],
[id^="tool-box-"] [class*="text-slate-600"] {
  color: #000000 !important;
  font-weight: 800 !important;
  opacity: 1 !important;
}

/* Force disabled / unselected cards to keep 100% text opacity and solid contrast */
[id^="tool-box-"].opacity-60,
[id^="tool-box-"]:not(.scale-98) {
  opacity: 1 !important;
  background-color: #FFFFFF !important;
  border-color: #CBD5E1 !important;
}

[id^="tool-box-"] .min-h-\[32px\] {
  color: #000000 !important;
  font-weight: 700 !important;
}

/* Ensure permanent visibility of content manager button */
#open-content-manager-btn,
.btn-content-manager-permanent {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}


/* ==========================================================================
   Clean Main Page: 100% Complete Hiding of Original Input Container
   All inputs, textareas, and media attachments moved to Dedicated Studio View
   ========================================================================== */
form.space-y-6 > div:first-child,
form:has(#lesson-content-input) > div:first-child,
.bg-gradient-to-r.from-amber-50,
#study-subject-bar-root,
#unified-content-hub-tabs,
label[for="lesson-content-input"],
label[for="lesson-title-input"],
div:has(> label[for="lesson-content-input"]) {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Ensure Dedicated Studio View inputs are ALWAYS visible and active when opened */
#dedicated-content-studio-view,
#dedicated-content-studio-view * {
  pointer-events: auto !important;
}
#dedicated-content-studio-view textarea,
#dedicated-content-studio-view input {
  display: block !important;
  visibility: visible !important;
  height: auto !important;
  opacity: 1 !important;
}

/* Permanent Solid Red Button: 📁 إدارة المحتوى (#DC2626) */
#open-red-content-manager-btn,
.btn-content-manager-permanent {
  background-color: #DC2626 !important;
  color: #FFFFFF !important;
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.4), 0 2px 4px -2px rgba(220, 38, 38, 0.3) !important;
}
#open-red-content-manager-btn:hover {
  background-color: #B91C1C !important;
}
#open-red-content-manager-btn * {
  color: #FFFFFF !important;
}


/* ==========================================================================
   User Requests (1, 2, 3, 4) - 2027 Ultra-Modern Responsive Architecture
   ========================================================================== */

/* Request 1: Delete Hero Brand Showcase (الصورة رقم 1) */
#hero-brand-showcase {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Request 3: Delete Loaded Lesson Status Banner (المستطيل رقم 3) */
#loaded-lesson-status-banner {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Request 4: Hide Library & PDF Lab from main top header (Moved inside Content Manager) */
header a[href*="research"],
header a[href*="library"],
header a[title*="مكتبة"],
header a[title*="مختبر"],
#header-library-btn,
#header-research-btn {
  display: none !important;
}

/* Request 2: Ultra-Responsive Control Bar (Flexbox + Grid + Media Queries) */
#main-platform-control-bar {
  width: 100% !important;
  max-width: 1280px !important;
  margin: 0 auto 16px auto !important;
  background: #FFFFFF !important;
  border: 2px solid #E2E8F0 !important;
  border-radius: 20px !important;
  padding: 14px 18px !important;
  box-shadow: 0 4px 15px -3px rgba(15, 23, 42, 0.05) !important;
  box-sizing: border-box !important;
  transition: background-color 0.3s ease, border-color 0.3s ease !important;
}

/* Dark mode for control bar - eliminates the harsh white bar on dark backgrounds */
html.dark #main-platform-control-bar,
body.dark #main-platform-control-bar,
.dark #main-platform-control-bar {
  background: #1E1B4B !important;
  border-color: #3730A3 !important;
  box-shadow: 0 8px 25px -4px rgba(0, 0, 0, 0.5) !important;
}

html.dark #main-platform-control-bar label,
body.dark #main-platform-control-bar label,
.dark #main-platform-control-bar label {
  color: #F8FAFC !important;
}

html.dark #main-platform-control-bar select,
body.dark #main-platform-control-bar select,
.dark #main-platform-control-bar select {
  background: #0F172A !important;
  color: #F8FAFC !important;
  border-color: #475569 !important;
}

.control-bar-inner {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 14px !important;
  width: 100% !important;
}

/* Mode Switchers */
.control-modes-group {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
}

.control-mode-pill {
  padding: 8px 14px !important;
  border-radius: 12px !important;
  font-weight: 800 !important;
  font-size: 13px !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  border: 2px solid #E2E8F0 !important;
  background-color: #F8FAFC !important;
  color: #334155 !important;
  white-space: nowrap !important;
  min-height: 42px !important;
}

.control-mode-pill:hover {
  background-color: #F1F5F9 !important;
  border-color: #CBD5E1 !important;
}

.control-mode-pill.active {
  background-color: #0F172A !important;
  color: #FFFFFF !important;
  border-color: #0F172A !important;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15) !important;
}

/* Dynamic Fields */
.control-fields-group {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  flex: 1 1 500px !important;
  min-width: 0 !important;
}

.control-field-item {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 1 1 170px !important;
  min-width: 0 !important;
}

.control-field-item label {
  white-space: nowrap !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  color: #0F172A !important;
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.control-field-item select,
.control-field-item input {
  width: 100% !important;
  min-width: 0 !important;
  padding: 9px 12px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  border: 2px solid #CBD5E1 !important;
  outline: none !important;
  background-color: #F8FAFC !important;
  color: #0F172A !important;
  transition: all 0.2s ease !important;
  min-height: 42px !important;
}

.control-field-item select:focus,
.control-field-item input:focus {
  border-color: #F97316 !important;
  background-color: #FFFFFF !important;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15) !important;
}

/* Action: Solid Red Button */
.control-actions-group {
  flex-shrink: 0 !important;
}

#open-red-content-manager-btn {
  background-color: #DC2626 !important;
  color: #FFFFFF !important;
  border: 2px solid #B91C1C !important;
  border-radius: 12px !important;
  padding: 9px 18px !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  min-height: 42px !important;
  visibility: visible !important;
  opacity: 1 !important;
  text-decoration: none !important;
}

#open-red-content-manager-btn:hover {
  background-color: #B91C1C !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.45) !important;
  text-decoration: none !important;
}

#open-red-content-manager-btn * {
  color: #FFFFFF !important;
}

/* Mobile & Tablet Responsiveness (< 768px): Vertical Stacking & Touch-Friendly */
@media (max-width: 768px) {
  #main-platform-control-bar {
    padding: 12px !important;
    border-radius: 16px !important;
    margin-bottom: 12px !important;
  }

  .control-bar-inner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .control-modes-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .control-mode-pill {
    width: 100% !important;
    justify-content: center !important;
    padding: 10px 6px !important;
    font-size: 12px !important;
    min-height: 44px !important;
    white-space: normal !important;
    text-align: center !important;
  }

  .control-fields-group {
    flex-direction: column !important;
    width: 100% !important;
    gap: 10px !important;
  }

  .control-field-item {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 4px !important;
  }

  .control-field-item label {
    font-size: 12px !important;
  }

  .control-field-item select,
  .control-field-item input {
    min-height: 44px !important;
    font-size: 13px !important;
  }

  .control-actions-group {
    width: 100% !important;
  }

  #open-red-content-manager-btn {
    width: 100% !important;
    min-height: 46px !important;
    font-size: 14px !important;
  }
}


/* Student Profile Modal Styles */
#student-profile-modal {
  z-index: 99999 !important;
  transition: opacity 0.2s ease-in-out;
}

#student-profile-modal input,
#student-profile-modal select,
#student-profile-modal button {
  font-family: 'Tajawal', sans-serif !important;
}

#close-profile-modal-btn:hover {
  transform: scale(1.1) rotate(90deg) !important;
  background-color: #FEF2F2 !important;
  color: #DC2626 !important;
  border-color: #F87171 !important;
}

#cancel-profile-modal-btn:hover {
  background-color: #CBD5E1 !important;
  color: #0F172A !important;
}

#save-profile-modal-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* Compact Red Content Manager Button - Ultra Compact Footprint */
.compact-red-btn {
  padding: 3px 7px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  border-radius: 7px !important;
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%) !important;
  color: #FFFFFF !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  text-decoration: none !important;
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.2) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  line-height: 1 !important;
  height: 24px !important;
}

.compact-red-btn:hover {
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35) !important;
}

#main-active-lesson-select,
.main-lesson-selector {
  min-height: 40px !important;
  border: 2px solid #CBD5E1 !important;
  border-radius: 12px !important;
  padding: 6px 12px !important;
  background-color: #F8FAFC !important;
  color: #0F172A !important;
  font-weight: 800 !important;
  outline: none !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
  cursor: pointer !important;
}

#main-active-lesson-select:focus,
.main-lesson-selector:focus {
  border-color: #EA580C !important;
  background-color: #FFFFFF !important;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15) !important;
}
