/* public/css/style.css */
/* Vision 2026 Design System */

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

:root {
  --font-primary: 'Sarabun', sans-serif;
  --font-title: 'Outfit', sans-serif;

  /* Color Palette - Premium Medical/Clinical Indigo & Teal */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-light: #ccfbf1;
  
  --danger: #ef4444;
  --danger-light: #fee2e2;
  
  --success: #22c55e;
  --success-light: #dcfce7;
  
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  
  --border-color: #e2e8f0;
  --border-focus: #a5b4fc;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 30px;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Titles, Headings, Header & Navigation (ฟอนต์หัวข้อหลัก Outfit) */
h1, h2, h3, h4, h5, h6,
.hero h2,
.card-title,
.section-subtitle,
.modal-header h3,
.logo-text h1,
.logo-text p,
.homepage-section-title,
.homepage-section-subtitle,
header,
.nav-link,
.auth-bar,
.auth-info,
.auth-badge,
.lang-switcher,
.lang-btn,
.btn {
  font-family: var(--font-title) !important;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Header & Navigation */
header {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-menu {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

/* Buttons */
.btn {
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.65rem 1.6rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.btn:hover {
  transform: translateY(-2px);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%) !important;
  color: white !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #4f46e5 100%) !important;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45) !important;
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #14b8a6 100%) !important;
  color: white !important;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.btn-accent:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #0d9488 100%) !important;
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.45) !important;
}

.btn-secondary {
  background-color: #ffffff !important;
  color: var(--text-secondary) !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05) !important;
}

.btn-secondary:hover {
  background-color: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: var(--text-primary) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #f87171 100%) !important;
  color: white !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45) !important;
}

/* Authentication Header Control */
.auth-bar {
  background: linear-gradient(90deg, #1e1b4b, #312e81);
  color: white;
  padding: 0.5rem 2rem;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.auth-badge {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.mock-login-trigger {
  cursor: pointer;
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-weight: 600;
  transition: background 0.2s;
}

.mock-login-trigger:hover {
  background-color: var(--accent-hover);
}

/* Modal Styling */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.modal-content {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 2rem;
  width: 100%;
  max-width: 550px;
  box-shadow: var(--shadow-lg);
  position: relative;
  margin: 2rem auto;
  box-sizing: border-box;
}

body.modal-open {
  overflow: hidden !important;
  height: 100vh !important;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

input, select, textarea {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
  background-color: #ffffff;
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Containers & Layouts */
.main-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 350px 1fr;
  }
}

/* Cards */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--primary);
}

/* Public Home Hero */
.hero {
  background: linear-gradient(135deg, #e0e7ff 0%, #ccfbf1 100%) !important;
  color: #1e1b4b !important;
  border-radius: 40px !important;
  padding: 4.5rem 3rem;
  text-align: center;
  margin-bottom: 3.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 
    15px 15px 35px rgba(163, 177, 198, 0.25), 
    -15px -15px 35px rgba(255, 255, 255, 0.75),
    inset -10px -10px 20px rgba(0, 0, 0, 0.03),
    inset 10px 10px 20px rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(226, 232, 240, 0.8) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
  pointer-events: none;
}

.hero h2 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  letter-spacing: -1px;
  color: var(--primary) !important;
}

.hero p {
  font-size: 1.15rem;
  max-width: 720px;
  margin: 0 auto 2.5rem;
  opacity: 0.9;
  color: var(--text-secondary) !important;
  font-weight: 500;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* Public News and Guide Cards */
.info-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3.5rem;
}

.info-card {
  background: var(--bg-secondary) !important;
  border: 1px solid rgba(226, 232, 240, 0.8) !important;
  border-radius: 20px !important;
  padding: 1.5rem !important;
  box-shadow: 
    10px 10px 22px rgba(163, 177, 198, 0.08), 
    -10px -10px 22px rgba(255, 255, 255, 0.75) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  gap: 1.5rem !important;
  height: auto !important;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 
    14px 14px 28px rgba(163, 177, 198, 0.14), 
    -14px -14px 28px rgba(255, 255, 255, 0.9) !important;
}

.info-card h3 {
  font-size: 1.15rem;
  color: var(--primary);
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 700;
  line-height: 1.4;
}

.info-card p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}

.info-card-img {
  width: 140px !important;
  height: 140px !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
  border-radius: 12px !important;
  margin: 0 !important;
  display: block;
  background: #f1f5f9;
  flex-shrink: 0 !important;
}

@media (min-width: 769px) {
  .info-section {
    grid-template-columns: 1fr 1fr !important;
    justify-content: center !important;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 991px) {
  .info-section {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    padding: 0 1rem;
  }
  .info-card {
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 1.25rem !important;
    padding: 1.25rem !important;
  }
  .info-card-img {
    width: 120px !important;
    height: 120px !important;
  }
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  background: white;
  margin-bottom: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background-color: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 1.1rem 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: background-color 0.15s ease;
}

tr:hover td {
  background-color: rgba(79, 70, 229, 0.03);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-normal {
  background-color: rgba(34, 197, 94, 0.06);
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.2);
}

.badge-abnormal {
  background-color: rgba(239, 68, 68, 0.06);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.2);
}

.badge-glasses {
  background-color: rgba(245, 158, 11, 0.06);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.2);
}

/* Print Barcode Layout (Isolating barcode element for stickers) */
#barcode-print-section {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }
  
  #barcode-print-section, #barcode-print-section * {
    visibility: visible;
  }
  
  #barcode-print-section {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: white;
    color: black;
    padding: 1.5in 0;
    box-sizing: border-box;
  }
  
  #barcode-print-section svg {
    width: 2.5in;
    height: auto;
  }
  
  .barcode-meta {
    font-family: monospace;
    font-size: 14pt;
    text-align: center;
    margin-top: 10px;
  }
  
  .barcode-student-name {
    font-family: var(--font-primary);
    font-size: 16pt;
    font-weight: bold;
    text-align: center;
    margin-top: 5px;
  }
}

/* Vision Screening Form Styling */
.section-subtitle {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  margin: 1.5rem 0 0.5rem;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 0.25rem;
}

.vision-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.vision-grid-header {
  font-weight: bold;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
}

.vision-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-box {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  margin-top: 1rem;
}

.status-box.active-success {
  border-left: 4px solid var(--success);
}
.status-box.active-danger {
  border-left: 4px solid var(--danger);
}
.status-box.active-warning {
  border-left: 4px solid var(--warning);
}

/* Utility classes */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.full-width { width: 100%; }

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--border-color);
}

/* Language Switcher Styling */
.lang-switcher {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--bg-secondary);
  margin-left: 1rem;
}

.lang-btn {
  background: none;
  border: none;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.lang-btn:hover {
  background-color: var(--border-color);
}

.lang-btn.active {
  background-color: var(--primary);
  color: white;
}

/* Optometrist Refraction Form Tables */
.exam-table {
  width: 100%;
  border-collapse: collapse;
}

.exam-table th, .exam-table td {
  padding: 0.5rem 0.75rem !important;
  font-size: 0.9rem !important;
  vertical-align: middle;
}

.exam-table input {
  width: 100%;
  padding: 0.4rem 0.6rem !important;
  font-size: 0.85rem !important;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.exam-table input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light) !important;
}

/* Optometrist Queue Card Layout */
#queue-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding: 0.25rem;
}

.queue-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.queue-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.queue-card.border-abnormal {
  border-left: 4px solid var(--danger);
}

.queue-card.border-glasses {
  border-left: 4px solid var(--warning);
}

.queue-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.4rem;
}

.queue-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.queue-card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.4rem;
}

.queue-card-va {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: var(--text-secondary);
  width: fit-content;
}

/* ======================================== */
/* SHOP PORTAL STYLES                       */
/* ======================================== */

/* Shop Statistics Cards */
.shop-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.shop-stat-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  text-align: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.shop-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border-color: var(--primary-light);
}

.shop-stat-card .stat-icon {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.shop-stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.shop-stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Shop Filter Tabs */
.shop-filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 6px;
  background: #f1f5f9;
  border-radius: 14px;
  border: none;
  width: fit-content;
  max-width: 100%;
}

.shop-filter-tab {
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  font-family: var(--font-primary);
}

.shop-filter-tab:hover {
  color: var(--primary);
  background-color: rgba(255, 255, 255, 0.5);
}

.shop-filter-tab.active {
  background: white !important;
  color: var(--primary) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.shop-filter-tab .filter-count {
  background: rgba(0,0,0,0.1);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.shop-filter-tab.active .filter-count {
  background: rgba(255,255,255,0.3);
}

/* Shop Search Bar */
.shop-search-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.shop-search-bar input {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: var(--font-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.shop-search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Shop Order Cards Grid */
.shop-orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1rem;
}

.shop-order-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.shop-order-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.shop-order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border-bottom: 1px solid var(--border-color);
}

.shop-order-card-header .student-info {
  flex: 1;
}

.shop-order-card-header .student-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin: 0;
}

.shop-order-card-header .student-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.shop-order-card-body {
  padding: 0.75rem 1rem;
}

/* Prescription Grid inside order card */
.shop-rx-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr 1fr 1fr;
  gap: 0;
  font-size: 0.78rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.shop-rx-grid .rx-header {
  background: #f1f5f9;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 4px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.shop-rx-grid .rx-cell {
  padding: 5px 8px;
  text-align: center;
  font-family: 'Outfit', monospace;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid #f1f5f9;
}

.shop-rx-grid .rx-label {
  background: #f8fafc;
  font-weight: 700;
  color: var(--primary);
  padding: 5px 8px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid #f1f5f9;
}

/* Lens Match Badge */
.shop-lens-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 6px 10px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px dashed var(--border-color);
  font-size: 0.8rem;
}

.shop-lens-info .lens-label {
  font-weight: 700;
  color: var(--text-secondary);
}

.shop-lens-info .lens-value {
  font-weight: 700;
  color: var(--primary);
}

/* Order Status Badges */
.order-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.order-status-badge.status-pending {
  background: #fef3c7;
  color: #b45309;
}

.order-status-badge.status-ordered {
  background: #dbeafe;
  color: #1d4ed8;
}

.order-status-badge.status-arrived {
  background: #e0e7ff;
  color: #4338ca;
}

.order-status-badge.status-assembled {
  background: #ccfbf1;
  color: #0d9488;
}

.order-status-badge.status-delivered {
  background: #dcfce7;
  color: #16a34a;
}

/* Order Card Actions */
.shop-order-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border-color);
  background: #fafbfc;
}

.shop-order-card-actions select {
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-primary);
  font-weight: 600;
  outline: none;
  cursor: pointer;
  background: white;
  transition: border-color 0.2s;
}

.shop-order-card-actions select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.shop-order-card-actions .btn-sm {
  padding: 5px 12px;
  font-size: 0.78rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: var(--font-primary);
}

.shop-order-card-actions .btn-print-order {
  background: var(--accent);
  color: white;
}

.shop-order-card-actions .btn-print-order:hover {
  background: var(--accent-hover);
}

.alien-tag {
  background: #fecdd3;
  color: #e11d48;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

/* Shop empty state */
.shop-empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.shop-empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

/* ========================================================================= */
/* RESPONSIVE STYLING FOR ALL DEVICES (Mobile, Tablet, Desktop)              */
/* ========================================================================= */

/* Tablets and Mobile Devices (< 900px) */
@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
  
  .layout-editor-container {
    grid-template-columns: 1fr !important;
  }
  
  .editor-sidebar {
    position: static !important;
    max-height: none !important;
    width: 100% !important;
  }
  
  .editor-canvas-container {
    padding: 15px !important;
  }
}

/* Mobile Devices (< 991px) */
@media (max-width: 991px) {
  header {
    flex-direction: column !important;
    gap: 1rem !important;
    padding: 1rem !important;
    text-align: center;
  }

  .logo-container {
    flex-direction: column !important;
    gap: 0.25rem !important;
  }

  .nav-menu {
    flex-wrap: wrap;
    justify-content: center !important;
    gap: 0.5rem !important;
    width: 100%;
  }

  .nav-link {
    font-size: 0.85rem !important;
    padding: 0.4rem 0.8rem !important;
  }

  .lang-switcher {
    margin-left: 0 !important;
    margin-top: 0.5rem;
  }

  /* Title and action button bar stacking */
  .main-container .flex.justify-between.align-center {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
  }

  .main-container .flex.justify-between.align-center > div {
    text-align: center;
  }

  .main-container .flex.gap-1 {
    flex-wrap: wrap;
    justify-content: center !important;
  }

  /* Make header elements inside profile card stay horizontal */
  #profile-details-content .flex.justify-between.align-center {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  /* Tabs Navigation wrapping */
  .tabs-nav, #teacher-tabs-nav, #opto-tabs-nav {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 5px !important;
  }

  .tab-btn, #teacher-tabs-nav button, #opto-tabs-nav button {
    font-size: 0.85rem !important;
    padding: 8px 12px !important;
  }

  /* Hero Section responsive sizing */
  .hero {
    padding: 2.5rem 1.5rem !important;
    margin-bottom: 2rem !important;
  }

  .hero h2 {
    font-size: 1.8rem !important;
  }

  .hero p {
    font-size: 1rem !important;
    margin-bottom: 1.5rem !important;
  }

  /* Cards responsive padding */
  .card {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  /* General Grid filters stacking */
  .card .form-row {
    grid-template-columns: 1fr !important;
  }

  /* Optometrist Queue elements */
  #queue-cards-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Very Small Mobile Devices (< 600px) */
@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
  
  /* Force stack any row style defined inline */
  .form-row[style*="display: grid"],
  .form-row[style*="display: flex"] {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }

  /* Modal contents spacing */
  .modal-content {
    padding: 1.25rem !important;
    width: 95% !important;
    margin: 10px !important;
  }

  /* Stacking the action bars (search + prints) */
  .actions-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .search-wrapper {
    max-width: none !important;
    width: 100% !important;
  }

  .print-actions {
    justify-content: space-between !important;
    width: 100% !important;
  }
}

/* Small Screens Card Grid Sizing Override */
@media (max-width: 480px) {
  .shop-orders-grid {
    grid-template-columns: 1fr !important;
  }
  
  .main-container .flex.gap-1 .btn {
    flex: 1 1 100% !important;
    width: 100% !important;
  }
}

/* Ensure tables do not break layout and scroll smoothly */
.table-container {
  -webkit-overflow-scrolling: touch;
}

.exam-table select, .exam-table input {
  min-width: 70px;
}


/* Brand Logo Image */
.logo-img {
  width: 45px;
  height: 45px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--primary-light);
  box-shadow: var(--shadow-sm);
}

/* Redesigned Premium Access Denied Screen */
.premium-denied {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.1), var(--shadow-md);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2.5rem;
  max-width: 520px;
  margin: 5rem auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modalFadeIn 0.5s ease-out;
}

.denied-icon {
  font-size: 2.5rem;
  background-color: var(--danger-light);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(239, 68, 68, 0.15);
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.1);
}

.premium-denied h3 {
  color: #1e293b;
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.5px;
}

.premium-denied p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* User Profile Header Dropdown */
.user-profile-header {
  position: relative;
  display: inline-block;
}

.profile-info-trigger {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.profile-info-trigger:hover {
  background-color: rgba(79, 70, 229, 0.08);
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.header-username {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chevron-icon {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.user-profile-header.active .chevron-icon {
  transform: rotate(180deg);
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: 120%;
  width: 270px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.15), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
  border: 1px solid var(--border-color);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  transform-origin: top right;
}

.profile-dropdown.active {
  display: flex;
  animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-5px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dropdown-header {
  padding: 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.dropdown-fullname {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.dropdown-role {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}

.dropdown-school {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  cursor: pointer;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
}

.dropdown-item:hover {
  background-color: #f1f5f9;
  color: var(--primary);
}

.dropdown-item.text-danger {
  color: var(--danger);
  border-top: 1px solid var(--border-color);
}

.dropdown-item.text-danger:hover {
  background-color: var(--danger-light);
  color: var(--danger);
}

/* Custom SweetAlert Styles to Match Design System */
.premium-swal-popup {
  font-family: var(--font-primary) !important;
  border-radius: var(--radius-md) !important;
}

.premium-swal-button {
  font-family: var(--font-primary) !important;
  font-weight: 600 !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.625rem 1.5rem !important;
  font-size: 0.95rem !important;
}

/* Subtle Claymorphism Accents */
.clay-card {
  background: var(--bg-secondary) !important;
  border-radius: var(--radius-lg) !important;
  border: 1px solid rgba(226, 232, 240, 0.8) !important;
  box-shadow: 
    10px 10px 20px rgba(163, 177, 198, 0.15), 
    -10px -10px 20px rgba(255, 255, 255, 0.7),
    inset -6px -6px 12px rgba(0, 0, 0, 0.02),
    inset 6px 6px 12px rgba(255, 255, 255, 0.7) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.clay-card:hover {
  transform: translateY(-2px);
  box-shadow: 
    12px 12px 24px rgba(163, 177, 198, 0.22), 
    -12px -12px 24px rgba(255, 255, 255, 0.95),
    inset -4px -4px 8px rgba(0, 0, 0, 0.02),
    inset 4px 4px 8px rgba(255, 255, 255, 0.75) !important;
}

/* Claymorphic Buttons */
.btn-primary.clay-btn {
  background-color: var(--primary) !important;
  border-radius: 9999px !important;
  box-shadow: 
    4px 4px 10px rgba(79, 70, 229, 0.2), 
    inset -4px -4px 8px rgba(0, 0, 0, 0.15), 
    inset 4px 4px 8px rgba(255, 255, 255, 0.25) !important;
  border: none !important;
}

.btn-primary.clay-btn:hover {
  background-color: var(--primary-hover) !important;
  transform: translateY(1px);
  box-shadow: 
    2px 2px 6px rgba(79, 70, 229, 0.15), 
    inset -3px -3px 6px rgba(0, 0, 0, 0.2), 
    inset 3px 3px 6px rgba(255, 255, 255, 0.2) !important;
}

.btn-accent.clay-btn {
  background-color: var(--accent) !important;
  border-radius: 9999px !important;
  box-shadow: 
    4px 4px 10px rgba(13, 148, 136, 0.2), 
    inset -4px -4px 8px rgba(0, 0, 0, 0.15), 
    inset 4px 4px 8px rgba(255, 255, 255, 0.25) !important;
  border: none !important;
}

.btn-accent.clay-btn:hover {
  background-color: var(--accent-hover) !important;
  transform: translateY(1px);
  box-shadow: 
    2px 2px 6px rgba(13, 148, 136, 0.15), 
    inset -3px -3px 6px rgba(0, 0, 0, 0.2), 
    inset 3px 3px 6px rgba(255, 255, 255, 0.2) !important;
}

.btn-secondary.clay-btn {
  background-color: #f1f5f9 !important;
  color: var(--text-secondary) !important;
  border-radius: 9999px !important;
  box-shadow: 
    3px 3px 8px rgba(148, 163, 184, 0.15), 
    inset -3px -3px 6px rgba(0, 0, 0, 0.05), 
    inset 3px 3px 6px rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(226, 232, 240, 0.6) !important;
}

.btn-secondary.clay-btn:hover {
  background-color: #e2e8f0 !important;
  transform: translateY(1px);
  box-shadow: 
    1px 1px 4px rgba(148, 163, 184, 0.1), 
    inset -2px -2px 4px rgba(0, 0, 0, 0.05), 
    inset 2px 2px 4px rgba(255, 255, 255, 0.8) !important;
}

/* Claymorphic Badges */
.badge.clay-badge {
  border-radius: 9999px !important;
  padding: 0.35rem 0.75rem !important;
  font-weight: 700 !important;
  box-shadow: 
    2px 2px 4px rgba(0, 0, 0, 0.03),
    inset -2px -2px 4px rgba(0, 0, 0, 0.06),
    inset 2px 2px 4px rgba(255, 255, 255, 0.3) !important;
}

/* Mobile Navigation Hamburger Menu */
.header-right-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-toggle {
  display: none;
  position: relative;
  width: 24px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
}

.mobile-menu-toggle span {
  display: block;
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--text-primary);
  border-radius: 9999px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu-toggle span:nth-child(1) {
  top: 0;
}

.mobile-menu-toggle span:nth-child(2) {
  top: 7px;
}

.mobile-menu-toggle span:nth-child(3) {
  bottom: 0;
}

/* Hamburger active animation */
.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
  background-color: var(--primary);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
  background-color: var(--primary);
}

/* Responsiveness */
@media (max-width: 991px) {
  header {
    padding: 0.5rem 0.75rem !important;
    height: 60px !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .logo-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .logo-img {
    width: 32px !important;
    height: 32px !important;
    flex-shrink: 0 !important;
  }

  .logo-text {
    flex: 1 !important;
    min-width: 0 !important;
  }

  .logo-text h1 {
    font-size: 0.95rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    display: block !important;
  }

  .logo-text p {
    display: none !important;
  }

  .header-right-actions {
    gap: 0.4rem !important;
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }

  .lang-switcher {
    margin-left: 0 !important;
    margin-top: 0 !important;
  }
  
  .lang-btn {
    padding: 0.2rem 0.5rem !important;
    font-size: 0.75rem !important;
  }

  .header-username {
    display: none !important;
  }

  .chevron-icon {
    display: none !important;
  }

  .profile-info-trigger {
    padding: 0.2rem !important;
    gap: 0 !important;
  }

  .header-avatar {
    width: 30px !important;
    height: 30px !important;
  }

  .mobile-menu-toggle {
    display: block !important;
  }
  
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 3.5rem 1.25rem 1.5rem;
    gap: 1rem;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
  }
  
  .nav-menu.active {
    right: 0;
  }
  
  .nav-link {
    font-size: 1.1rem;
    padding: 0.75rem 1.25rem;
    text-align: left;
  }
}

/* Article Content Inline Styling */
.article-inline-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm, 8px);
  margin: 1.25rem 0;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.1));
  display: block;
}

.article-inline-album {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 1.5rem 0;
}

.inline-album-img {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border-color, #e2e8f0);
  cursor: pointer;
}

.inline-album-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.inline-album-img:hover img {
  transform: scale(1.06);
}

/* Responsive Modal Overrides for Mobile devices */
@media (max-width: 991px) {
  .modal {
    display: none;
    overflow-y: auto !important;
    padding: 1rem 0.5rem !important;
    -webkit-overflow-scrolling: touch;
  }
  .modal.active {
    display: block !important;
  }
  .modal-content {
    padding: 1.25rem !important;
    margin: 1.5rem auto !important;
    width: 92% !important;
    max-width: 92% !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box;
  }
}

/* Premium Homepage Custom Sections */
.homepage-section {
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.homepage-section-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.homepage-section-subtitle {
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

/* 1. Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

.stat-card {
  background: linear-gradient(135deg, #f0f7ff 0%, #e0f2fe 100%);
  padding: 1.75rem 1rem;
  border-radius: 16px;
  border: 1px solid #bae6fd;
  text-align: center;
  box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.08), 0 2px 4px -1px rgba(14, 165, 233, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  min-height: 170px;
  box-sizing: border-box;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.15), 0 4px 6px -4px rgba(14, 165, 233, 0.1);
  border-color: #38bdf8;
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: 850;
  color: #0369a1;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.82rem;
  color: #475569;
  font-weight: 700;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.stat-unit {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
  margin-top: auto;
}

/* 2. Platform Value Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  text-align: left;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.feature-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: #f0fdf4;
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

.feature-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 3. Workflow Steps */
.workflow-steps-wrapper {
  overflow-x: auto;
  padding: 1rem 0;
  margin-bottom: 2rem;
}

.workflow-steps {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  min-width: 800px;
  position: relative;
}

.workflow-steps::before {
  content: '';
  position: absolute;
  top: 45px;
  left: 10%;
  right: 10%;
  height: 2px;
  border-top: 2px dashed #cbd5e1;
  z-index: 1;
}

.workflow-step {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 10px;
}

.workflow-number-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #10b981;
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}

.workflow-icon-circle {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: white;
  border: 1px solid #e2e8f0;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  margin-bottom: 1rem;
}

.workflow-step:hover .workflow-icon-circle {
  border-color: #10b981;
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-lg);
}

.workflow-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

/* 4. Stakeholder Roles */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

.role-card {
  background: white;
  padding: 2rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: all 0.3s ease;
}

.role-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.role-avatar {
  font-size: 2.8rem;
  margin-bottom: 1rem;
}

.role-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.role-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 5. Pattani Map & Regional Summary */
.map-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.map-wrapper {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 380px;
}

.svg-pattani-map {
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: 12px;
  overflow: hidden;
}

.svg-district-path {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1.5;
  transition: all 0.2s ease;
  cursor: pointer;
}

.svg-district-path:hover,
.svg-district-path.highlighted {
  fill: rgba(79, 70, 229, 0.18);
  stroke: var(--primary, #4f46e5);
  stroke-width: 2px;
}

.map-pin {
  display: none;
}

.map-pin text {
  font-size: 0.62rem;
  font-weight: 700;
  fill: #334155;
  pointer-events: none;
}

.map-stats-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.map-stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.map-stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.map-stat-label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* 6. Benefits List */
.benefits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.benefit-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.benefit-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--success-light);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.benefit-text {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.5;
}

/* 7. Interactive Dashboard Preview */
.dashboard-preview-card {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: white;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  margin-top: 1rem;
}

.db-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1rem;
}

.db-preview-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
}

.db-preview-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.db-preview-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.db-chart-container {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.db-chart-bars {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 160px;
  padding-top: 10px;
}

.db-chart-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 12%;
}

.db-chart-bar {
  width: 100%;
  background: linear-gradient(to top, var(--primary), var(--accent));
  border-radius: 4px 4px 0 0;
  transition: height 1s ease-in-out;
}

.db-chart-bar-label {
  font-size: 0.7rem;
  margin-top: 6px;
  color: var(--text-muted);
}

.db-list-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.db-list-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.db-item-meta h4 {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0;
}

.db-item-meta p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.db-item-status {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}

.db-status-normal {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.db-status-abnormal {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* 8. Partners Grid */
.partners-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 3rem;
  opacity: 0.75;
  margin-top: 1rem;
}

.partner-logo {
  height: 50px;
  width: auto;
  filter: grayscale(1);
  transition: all 0.3s ease;
}

.partner-logo:hover {
  filter: grayscale(0);
  opacity: 1;
  transform: scale(1.05);
}

/* 9. Contact Section */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.contact-card {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.contact-icon {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.contact-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.contact-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Modal enhancements */
@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal.active .modal-content {
  animation: modalSlideUp 0.3s ease-out forwards;
}

.modal-content {
  word-break: break-word;
  overflow-wrap: break-word;
}

#full-article-body {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Mobile Media Query overrides */
@media (max-width: 991px) {
  .map-summary-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  .benefits-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .dashboard-preview-card {
    padding: 1.25rem !important;
  }
  .db-preview-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }
  .db-preview-body {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  .map-stats-panel {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
  .stat-card {
    padding: 1rem !important;
    min-height: 130px !important;
  }
  .stat-number {
    font-size: 1.6rem !important;
  }
  .workflow-steps {
    min-width: auto !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1.5rem !important;
    padding-left: 2rem !important;
  }
  .workflow-steps::before {
    top: 0 !important;
    left: 48px !important;
    bottom: 0 !important;
    width: 2px !important;
    height: auto !important;
    border-left: 2px dashed #cbd5e1 !important;
    border-top: none !important;
  }
  .workflow-step {
    flex-direction: row !important;
    align-items: center !important;
    text-align: left !important;
    gap: 1rem !important;
  }
  .workflow-number-badge {
    margin-bottom: 0 !important;
  }
  .workflow-icon-circle {
    margin-bottom: 0 !important;
    width: 46px !important;
    height: 46px !important;
    font-size: 1.25rem !important;
  }
  .homepage-section {
    padding: 2.5rem 1rem !important;
  }
  .homepage-section-title {
    font-size: 1.6rem !important;
  }
}

#elearning-progress-bars-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  width: 100%;
}

@media (max-width: 767px) {
  #elearning-progress-bars-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
}

.portal-wrapper {
  display: flex;
  min-height: 100vh;
  background-color: #f8fafc; /* Premium soft grayish-blue background */
}

/* Sidebar backdrop overlay on mobile */
body.portal-page::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
body.portal-page.sidebar-active::after {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar panel */
.portal-sidebar {
  width: 260px;
  background-color: #0f172a; /* Sleek slate 900 */
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid #1e293b; /* Slate 800 */
}

.sidebar-logo-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  object-fit: cover;
}

.sidebar-logo-text h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}

.sidebar-logo-text span {
  font-size: 0.7rem;
  color: #94a3b8; /* Slate 400 */
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  color: #94a3b8;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.sidebar-menu-item:hover {
  color: #ffffff;
  background-color: #1e293b;
  padding-left: 1.4rem;
}

.sidebar-menu-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%) !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4) !important;
}

.sidebar-menu-item .menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid #1e293b;
}

.sidebar-menu-item.exit-link {
  color: #ef4444; /* Soft red for exit link */
}

.sidebar-menu-item.exit-link:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.nav-link-highlight {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(99, 102, 241, 0.18) 100%) !important;
  border: 1.5px solid rgba(79, 70, 229, 0.3) !important;
  color: var(--primary) !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
  position: relative;
}

.nav-link-highlight:hover {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.15) 0%, rgba(99, 102, 241, 0.25) 100%) !important;
  border-color: rgba(79, 70, 229, 0.45) !important;
  color: var(--primary) !important;
  transform: translateY(-1px);
}

.nav-link-highlight::before {
  content: '';
  width: 8px;
  height: 8px;
  background-color: #f59e0b; /* Amber */
  border-radius: 50%;
  display: inline-block;
  animation: pulseDot 1.5s infinite ease-in-out;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

@keyframes pulseDot {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

.sidebar-menu-item.highlighted-menu {
  background: rgba(99, 102, 241, 0.15) !important;
  border: 1px dashed rgba(99, 102, 241, 0.4) !important;
  color: #a5b4fc !important;
}

.sidebar-menu-item.highlighted-menu:hover {
  background: rgba(99, 102, 241, 0.25) !important;
  color: #ffffff !important;
  padding-left: 1.4rem;
}

.sidebar-menu-item.highlighted-menu.active {
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%) !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

.elearning-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white !important;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: auto;
  font-weight: 700;
  animation: pulseBadge 1.8s infinite ease-in-out;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

@keyframes pulseBadge {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

.elearning-promo-banner {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(99, 102, 241, 0.15) 100%);
  border: 1.5px solid rgba(79, 70, 229, 0.25);
  border-radius: var(--radius-lg, 16px);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.05);
}

.elearning-promo-banner:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12) 0%, rgba(99, 102, 241, 0.2) 100%);
  border-color: rgba(79, 70, 229, 0.4);
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.15);
}

.elearning-promo-banner .promo-icon {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: white;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.elearning-promo-banner .promo-content {
  flex-grow: 1;
}

.elearning-promo-banner .promo-content h4 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 4px 0;
}

.elearning-promo-banner .promo-content p {
  font-size: 0.88rem;
  color: var(--text-secondary, #475569);
  margin: 0;
}

.elearning-promo-banner .promo-action {
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .elearning-promo-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 1.5rem;
    gap: 1rem;
  }
  .elearning-promo-banner .promo-icon {
    margin: 0 auto;
  }
  .elearning-promo-banner .promo-action button {
    width: 100%;
  }
}

/* Main Content Area */
.portal-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Topbar style for header loaded dynamically */
body.portal-page header {
  position: sticky !important;
  top: 0 !important;
  left: 260px !important;
  right: 0 !important;
  z-index: 90 !important;
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  padding: 0.75rem 2rem !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
  display: flex !important;
  justify-content: flex-end !important;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Adjust title placement in portal page topbar */
body.portal-page header .logo-container {
  display: none !important; /* logo in sidebar instead */
}

/* Hide standard horizontal nav-links on portal page */
body.portal-page header #header-nav {
  display: none !important;
}

body.portal-page .portal-content {
  padding: 2rem;
  flex: 1;
  max-width: 100%;
}

/* Override .main-container inside portal since wrapper already defines structure */
body.portal-page .main-container {
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Mobile Sidebar drawer responsiveness */
@media (max-width: 991px) {
  .portal-sidebar {
    left: auto !important;
    right: 0 !important;
    transform: translateX(100%);
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.05) !important;
  }
  
  .portal-sidebar.active {
    transform: translateX(0);
  }
  
  .portal-main {
    margin-left: 0;
  }
  
  body.portal-page header {
    padding: 0.5rem 0.75rem !important;
    left: 0 !important;
    justify-content: space-between !important;
  }

  body.portal-page header .logo-container {
    display: flex !important;
    gap: 0.5rem !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  body.portal-page header .logo-text {
    flex: 1 !important;
    min-width: 0 !important;
  }

  body.portal-page header .logo-text h1 {
    font-size: 1.05rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    display: block !important;
  }

  body.portal-page header .logo-text p {
    display: none !important;
  }
  
  body.portal-page header .mobile-menu-toggle {
    display: block !important;
  }
}

/* ==========================================
   STYLES COPIED FROM admin.html
   ========================================== */

    /* Article Editor Toolbar Styles */
    .editor-toolbar {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      padding: 8px 12px;
      background: #f8fafc;
      border: 1px solid var(--border-color, #e2e8f0);
      border-bottom: none;
      border-top-left-radius: 8px;
      border-top-right-radius: 8px;
      align-items: center;
    }
    .editor-toolbar button {
      background: #ffffff;
      border: 1px solid var(--border-color, #cbd5e1);
      color: var(--text-secondary, #475569);
      border-radius: 4px;
      padding: 5px 10px;
      font-size: 0.85rem;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-weight: 600;
      transition: all 0.2s ease;
    }
    .editor-toolbar button:hover {
      background: var(--primary-light, #e0e7ff);
      border-color: var(--primary, #4f46e5);
      color: var(--primary, #4f46e5);
      transform: translateY(-1px);
    }
    .editor-toolbar button:active {
      transform: translateY(0);
    }
    .editor-toolbar-separator {
      width: 1px;
      height: 18px;
      background: var(--border-color, #cbd5e1);
      margin: 0 6px;
    }
    .editor-textarea-wrapper textarea {
      border-top-left-radius: 0 !important;
      border-top-right-radius: 0 !important;
      border-top: none !important;
    }
    .gallery-item.selected {
      border: 3px solid var(--primary, #4f46e5) !important;
      position: relative;
    }
    .gallery-item.selected::after {
      content: '✓';
      position: absolute;
      top: 5px;
      right: 5px;
      background: var(--primary, #4f46e5);
      color: white;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: bold;
      z-index: 2;
    }

    /* Admin specific styles */
    .tabs-nav {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      border-bottom: 2px solid var(--border-color);
      margin-bottom: 20px;
      padding-bottom: 0px;
    }
    .tab-btn {
      background: none;
      border: none;
      padding: 10px 20px;
      font-size: 1rem;
      font-weight: 600;
      color: var(--text-secondary);
      cursor: pointer;
      border-bottom: 3px solid transparent;
      transition: all 0.2s;
    }
    .tab-btn.active {
      color: var(--primary);
      border-bottom-color: var(--primary);
    }
    .tab-content {
      display: none;
    }
    .tab-content.active {
      display: block;
    }
    .actions-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 15px;
      gap: 15px;
      flex-wrap: wrap;
    }
    .search-wrapper {
      position: relative;
      flex-grow: 1;
      max-width: 400px;
    }
    .search-input {
      width: 100%;
      padding: 10px 15px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border-color);
      font-size: 0.95rem;
    }
    .print-actions {
      display: flex;
      gap: 10px;
      align-items: center;
    }
    .selection-badge {
      background-color: var(--primary-light);
      color: var(--primary);
      padding: 5px 10px;
      border-radius: var(--radius-sm);
      font-size: 0.85rem;
      font-weight: bold;
    }
    .pill-status {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 12px;
      font-size: 0.75rem;
      font-weight: bold;
    }
    .pill-glasses {
      background-color: var(--primary-light);
      color: var(--primary);
    }
    .pill-normal {
      background-color: var(--success-light);
      color: var(--success);
    }
    .pill-abnormal {
      background-color: var(--danger-light);
      color: var(--danger);
    }
    .pill-warning {
      background-color: var(--warning-light);
      color: var(--warning);
    }
    
    /* Layout Editor Styling */
    .layout-editor-container {
      display: grid;
      grid-template-columns: 350px 1fr;
      gap: 20px;
      margin-top: 15px;
      align-items: start;
    }
    
    .editor-sidebar {
      background: var(--bg-secondary);
      border-radius: var(--radius-md);
      padding: 20px;
      border: 1px solid var(--border-color);
      box-shadow: var(--shadow-md);
      position: sticky;
      top: 90px;
      max-height: calc(100vh - 120px);
      overflow-y: auto;
    }
    
    .editor-canvas-container {
      background: #cbd5e1;
      border-radius: var(--radius-md);
      padding: 30px;
      display: flex;
      justify-content: center;
      align-items: center;
      border: 1px solid var(--border-color);
      box-shadow: var(--shadow-sm);
      overflow: auto;
    }
    
    /* A4 preview scale: 600px width, 848.5px height (1:1.414 aspect ratio) */
    .editor-canvas {
      position: relative;
      width: 600px;
      height: 848.5px;
      box-shadow: 0 10px 25px rgba(0,0,0,0.3);
      user-select: none;
      background-color: #fff;
      overflow: hidden;
    }
    
    /* Rich Menu Editor override: use LINE's 2500x1686 aspect ratio instead of A4 */
    #richmenu-editor-canvas {
      width: 100% !important;
      max-width: 100% !important;
      height: auto !important;
      aspect-ratio: 2500 / 1686 !important;
      background-color: #e2e8f0 !important;
      box-shadow: var(--shadow-md) !important;
    }
    
    .grid-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 5;
      background-size: 5% 5%, 1% 1%;
      background-image: 
        linear-gradient(to right, rgba(79, 70, 229, 0.12) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(79, 70, 229, 0.12) 1px, transparent 1px),
        linear-gradient(to right, rgba(79, 70, 229, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(79, 70, 229, 0.03) 1px, transparent 1px);
      display: none;
    }
    
    .editor-canvas.show-grid .grid-overlay {
      display: block;
    }
    
    .editor-field {
      position: absolute;
      color: #0022ff; /* Royal blue */
      font-size: 11px; /* Scaled down: 14px * 0.78 = ~11px */
      font-weight: 600;
      font-family: 'Sarabun', sans-serif;
      white-space: nowrap;
      user-select: none;
      cursor: move;
      z-index: 10;
      background: transparent;
      border: 1px solid transparent;
      padding: 0;
      margin: 0;
      box-sizing: border-box;
      line-height: 1;
      pointer-events: auto;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    
    .editor-field:hover {
      outline: 1px dashed rgba(0, 34, 255, 0.45);
      outline-offset: 2px;
      z-index: 20;
    }
    
    .editor-field.selected {
      outline: 1.5px solid #0022ff;
      outline-offset: 2px;
      background: rgba(0, 34, 255, 0.07);
      z-index: 30;
    }

    /* Checkbox character styling */
    .editor-field.checkbox-field {
      font-size: 14px; /* Scaled: 18px * 0.78 = ~14px */
      font-weight: bold;
    }
    
    /* Category Header */
    .field-category {
      margin-bottom: 15px;
    }
    
    .category-title {
      font-size: 0.85rem;
      font-weight: bold;
      color: var(--text-primary);
      border-bottom: 1px solid var(--border-color);
      padding-bottom: 5px;
      margin-bottom: 8px;
    }
    
    .fields-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    
    .field-btn {
      background: #f1f5f9;
      border: 1px solid var(--border-color);
      padding: 4px 8px;
      font-size: 0.75rem;
      border-radius: 4px;
      cursor: pointer;
      color: var(--text-secondary);
      transition: all 0.2s;
    }
    
    .field-btn:hover {
      background: var(--primary-light);
      color: var(--primary);
    }
    
    .field-btn.selected {
      background: var(--accent-light);
      color: var(--accent);
      border-color: var(--accent);
      font-weight: bold;
    }
    
    /* Control Buttons Group */
    .controls-group {
      margin-top: 20px;
      display: flex;
      flex-direction: column;
      gap: 15px;
    }
    
    .nudge-controls {
      display: grid;
      grid-template-areas: 
        ". up ."
        "left . right"
        ". down .";
      grid-gap: 8px;
      justify-content: center;
      width: 150px;
      margin: 10px auto;
    }
    
    .nudge-btn {
      background: #f1f5f9;
      border: 1px solid var(--border-color);
      width: 40px;
      height: 40px;
      border-radius: 50%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.2rem;
      transition: all 0.2s;
      color: var(--text-secondary);
    }
    
    .nudge-btn:hover {
      background: var(--primary-light);
      color: var(--primary);
      border-color: var(--primary);
    }
    
    .nudge-btn:active {
      transform: scale(0.9);
    }
    
    .nudge-btn.up { grid-area: up; }
    .nudge-btn.down { grid-area: down; }
    .nudge-btn.left { grid-area: left; }
    .nudge-btn.right { grid-area: right; }
    
    .step-controls {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.85rem;
      padding: 0 10px;
    }
    
    .step-select {
      padding: 4px 8px;
      border-radius: 4px;
      border: 1px solid var(--border-color);
      font-family: var(--font-primary);
      outline: none;
    }
    
    .actions-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-top: 15px;
    }
    
    .selected-info-box {
      background: #f8fafc;
      border: 1px solid var(--border-color);
      border-radius: 6px;
      padding: 12px;
      font-size: 0.85rem;
      color: var(--text-secondary);
      margin-bottom: 15px;
      line-height: 1.4;
    }
    
    .selected-info-box strong {
      color: var(--text-primary);
    }

    .editor-status-bar {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 0.85rem;
      color: var(--text-secondary);
      margin-bottom: 12px;
      background: #f1f5f9;
      padding: 6px 12px;
      border-radius: 6px;
    }

    .status-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--success);
    }

    .status-dot.unsaved {
      background: var(--warning);
      animation: pulse 1.5s infinite;
    }

    @keyframes pulse {
      0% { opacity: 0.4; }
      50% { opacity: 1; }
      100% { opacity: 0.4; }
    }
    
    /* Special styling for barcode box in editor */
    .editor-field.barcode-field {
      width: 196px;
      height: 49px;
      background: repeating-linear-gradient(
        90deg,
        #000,
        #000 2px,
        #fff 2px,
        #fff 6px,
        #000 6px,
        #000 7px,
        #fff 7px,
        #fff 10px
      );
      opacity: 0.65;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      color: #000;
      font-weight: bold;
      font-family: monospace;
      font-size: 9px;
      padding: 2px;
      box-sizing: border-box;
      border: 1px solid #000;
      text-shadow: 0 0 3px #fff;
    }
    
    .editor-field.barcode-field.selected {
      border: 2px solid var(--accent);
      box-shadow: 0 0 10px rgba(13, 148, 136, 0.6);
    }
    /* Lens Stock Tab Styles */
    .lens-card {
      background: white;
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      margin-bottom: 15px;
      box-shadow: var(--shadow-sm);
      overflow: hidden;
    }
    .lens-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
      border-bottom: 1px solid var(--border-color);
      cursor: pointer;
      user-select: none;
      transition: background 0.2s;
    }
    .lens-card-header:hover {
      background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    }
    .lens-card-header .lens-name {
      font-weight: 700;
      font-size: 1rem;
      color: var(--primary);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .lens-card-header .lens-count {
      font-size: 0.8rem;
      color: var(--text-secondary);
      font-weight: 500;
    }
    .lens-card-header .chevron {
      transition: transform 0.3s;
      font-size: 1.2rem;
      color: var(--text-secondary);
    }
    .lens-card.open .lens-card-header .chevron {
      transform: rotate(180deg);
    }
    .lens-card-body {
      display: none;
      padding: 16px;
    }
    .lens-card.open .lens-card-body {
      display: block;
    }
    .prescription-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
      gap: 6px;
      margin-top: 10px;
    }
    .prescription-chip {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: #f1f5f9;
      border: 1px solid #e2e8f0;
      border-radius: 6px;
      padding: 4px 8px;
      font-size: 0.8rem;
      font-family: 'Sarabun', monospace;
      font-weight: 600;
      color: #334155;
      transition: all 0.15s;
    }
    .prescription-chip:hover {
      background: #fef2f2;
      border-color: #fca5a5;
    }
    .prescription-chip .remove-rx {
      cursor: pointer;
      color: var(--danger);
      font-weight: bold;
      font-size: 1rem;
      margin-left: 6px;
      line-height: 1;
      opacity: 0.6;
      transition: opacity 0.15s;
    }
    .prescription-chip .remove-rx:hover {
      opacity: 1;
    }
    .pill-lens {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 12px;
      font-size: 0.72rem;
      font-weight: bold;
    }
    .pill-lens-found {
      background-color: #dcfce7;
      color: #16a34a;
    }
    .pill-lens-notfound {
      background-color: #fef2f2;
      color: #dc2626;
    }
    /* Paste Modal */
    .paste-overlay {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.5);
      display: none;
      z-index: 9999;
      align-items: center;
      justify-content: center;
    }
    .paste-overlay.active {
      display: flex;
    }
    .paste-box {
      background: white;
      border-radius: var(--radius-md);
      padding: 24px;
      width: 90%;
      max-width: 500px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    }
    .paste-box textarea {
      width: 100%;
      height: 200px;
      border: 1px solid var(--border-color);
      border-radius: var(--radius-sm);
      padding: 10px;
      font-family: 'Sarabun', monospace;
      font-size: 0.9rem;
      resize: vertical;
      outline: none;
    }
    .paste-box textarea:focus {
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

    /* Media Gallery Styles */
    .gallery-item {
      position: relative;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border-color);
      overflow: hidden;
      cursor: pointer;
      aspect-ratio: 16/10;
      transition: all 0.2s ease-in-out;
      background: #f1f5f9;
    }
    .gallery-item:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      border-color: var(--primary);
    }
    .gallery-item img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .gallery-item-delete {
      position: absolute;
      top: 5px;
      right: 5px;
      background: rgba(239, 68, 68, 0.9);
      color: white;
      border: none;
      border-radius: 50%;
      width: 22px;
      height: 22px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.75rem;
      cursor: pointer;
      opacity: 0;
      transition: opacity 0.2s ease;
      z-index: 10;
    }
    .gallery-item:hover .gallery-item-delete {
      opacity: 1;
    }
    .gallery-item-delete:hover {
      background: rgb(220, 38, 38);
      transform: scale(1.1);
    }
    .gallery-item-info {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(15, 23, 42, 0.75);
      color: white;
      font-size: 0.65rem;
      padding: 3px 6px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      pointer-events: none;
    }
    
    .inline-icon {
      width: 1.1em;
      height: 1.1em;
      stroke-width: 2;
      vertical-align: middle;
      margin-right: 6px;
      display: inline-block;
      flex-shrink: 0;
    }
    .tab-btn .inline-icon {
      margin-right: 8px;
    }

/* ==========================================
   UNIFIED CONTACT & FOOTER SECTION
   ========================================== */
.unified-contact-footer-container {
  background: linear-gradient(180deg, #020a16 0%, #061122 100%) !important;
  color: #f1f5f9 !important;
  border-top: 2px solid #081d38 !important;
  width: 100% !important;
}

#section-contact.homepage-section {
  padding: 3.5rem 2rem 2rem 2rem !important;
  max-width: 1200px;
  margin: 0 auto !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.contact-wrapper-inner {
  display: grid;
  grid-template-columns: 1.2fr 1.3fr 1.2fr;
  align-items: center;
  gap: 2.5rem;
}

.contact-illustration-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.contact-illustration-custom {
  max-width: 450px;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #ffffff;
  padding: 12px;
  transition: transform 0.3s ease;
}

.contact-illustration-custom:hover {
  transform: translateY(-4px) scale(1.02);
}

.contact-info-panel {
  display: flex;
  flex-direction: column;
}

.contact-title-main {
  font-size: 2.2rem !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  margin-bottom: 0.5rem !important;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.contact-subtitle-main {
  font-size: 1.3rem !important;
  font-weight: 600 !important;
  color: #38bdf8 !important; /* Premium sky blue */
  margin: 0 0 0.25rem 0 !important;
}

.contact-desc-main {
  font-size: 0.95rem !important;
  color: #94a3b8 !important;
  margin: 0 0 1.5rem 0 !important;
}

.contact-methods-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.contact-method-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  align-self: flex-start;
}

.contact-method-item:hover {
  color: #ffffff;
  transform: translateX(4px);
}

.contact-method-item .method-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.contact-method-item .method-icon.email-icon {
  background-color: #0d9488; /* Teal */
}

.contact-method-item .method-icon.line-icon {
  background-color: #06c755; /* LINE green */
}

/* Right CTA Panel */
.contact-cta-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.contact-cta-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #06b6d4, #0d9488);
  color: white;
  padding: 0.85rem 1.75rem;
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
  transition: all 0.2s ease;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.contact-cta-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
  background: linear-gradient(135deg, #0891b2, #0f766e);
}

.contact-cta-support-text {
  font-size: 0.9rem !important;
  color: #94a3b8 !important;
  max-width: 250px;
  line-height: 1.5;
  margin: 0 !important;
}

/* Footer Section */
.homepage-footer {
  padding-bottom: 2.5rem;
  background: transparent;
}

.footer-divider {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 1.5rem auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-content-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: #64748b;
}

.footer-left p {
  margin: 0;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-link {
  color: #64748b;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #cbd5e1;
}

.footer-link-sep {
  color: rgba(255, 255, 255, 0.15);
}

/* Responsive adjustment for unified section */
@media (max-width: 1024px) {
  .contact-illustration-container {
    display: none !important;
  }
  .contact-wrapper-inner {
    grid-template-columns: 1.3fr 1.2fr;
  }
}

@media (max-width: 991px) {
  .contact-wrapper-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    text-align: center;
  }
  
  .contact-info-panel {
    align-items: center;
  }
  
  .contact-method-item {
    align-self: center;
  }
  
  .footer-content-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* Ensure Media Gallery and Gallery Picker modals are always on top when opened from another modal (including TinyMCE dialogs) */
#cms-gallery-modal,
#gallery-picker-modal {
  z-index: 999999 !important;
}

/* ==========================================
   RESPONSIVE TABLES SYSTEM (MOBILE & TABLET)
   ========================================== */
@media (max-width: 1024px) {
  /* Ensure no layout breaking overflow on tablet/mobile */
  html, body, .main-container, .portal-main, .portal-content, .portal-wrapper {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Reset main-container padding/margin on tablet/mobile to prevent edge cropping */
  .main-container {
    padding: 0 1rem !important;
    margin: 1rem auto !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Force wrap and stack flex button groups / actions bars */
  .actions-bar,
  .actions-bar > div,
  .main-container .flex,
  .portal-content .flex {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  .actions-bar > div button,
  .main-container .flex button,
  .portal-content .flex button {
    flex: 1 1 auto;
  }

  /* Force stack grid form rows */
  .form-row,
  .card .form-row,
  .form-row[style*="display: grid"],
  .form-row[style*="display: flex"] {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  /* 1. Global standard tables transformed into cards */
  .table-container {
    border: none !important;
    overflow-x: hidden !important;
    background: transparent !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  
  /* Select modal tables and other custom container tables too */
  .table-container table:not(.exam-table):not(.no-responsive),
  .modal-content table:not(.exam-table):not(.no-responsive),
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) {
    display: block;
    width: 100% !important;
    border: none !important;
  }

  .table-container table:not(.exam-table):not(.no-responsive) thead,
  .modal-content table:not(.exam-table):not(.no-responsive) thead,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) thead {
    display: none !important; /* Hide column headers */
  }

  .table-container table:not(.exam-table):not(.no-responsive) tbody,
  .modal-content table:not(.exam-table):not(.no-responsive) tbody,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) tbody {
    display: block;
    width: 100%;
  }

  .table-container table:not(.exam-table):not(.no-responsive) tr,
  .modal-content table:not(.exam-table):not(.no-responsive) tr,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) tr {
    display: block;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1rem 1rem 1rem !important;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    position: relative; /* for absolute checkbox positioning */
    transition: transform 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
  }

  /* Make row layout with checkbox have room */
  .table-container table:not(.exam-table):not(.no-responsive) tr:has(input[type="checkbox"]),
  .modal-content table:not(.exam-table):not(.no-responsive) tr:has(input[type="checkbox"]),
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) tr:has(input[type="checkbox"]) {
    padding-top: 2.25rem !important;
  }

  .table-container table:not(.exam-table):not(.no-responsive) tr:hover,
  .modal-content table:not(.exam-table):not(.no-responsive) tr:hover,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) tr:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }

  .table-container table:not(.exam-table):not(.no-responsive) td,
  .modal-content table:not(.exam-table):not(.no-responsive) td,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) td {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0 !important;
    border-bottom: 1px dashed var(--border-color) !important;
    font-size: 0.9rem;
    text-align: right !important;
    width: 100% !important;
    background: transparent !important;
    min-height: 38px;
    box-sizing: border-box;
  }

  /* Absolute position the checkbox cell in the top corner */
  .table-container table:not(.exam-table):not(.no-responsive) td:first-child:has(input[type="checkbox"]),
  .modal-content table:not(.exam-table):not(.no-responsive) td:first-child:has(input[type="checkbox"]),
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) td:first-child:has(input[type="checkbox"]) {
    position: absolute;
    top: 12px;
    left: 12px;
    width: auto !important;
    border-bottom: none !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: unset;
    z-index: 10;
  }

  .table-container table:not(.exam-table):not(.no-responsive) td:first-child:has(input[type="checkbox"])::before,
  .modal-content table:not(.exam-table):not(.no-responsive) td:first-child:has(input[type="checkbox"])::before,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) td:first-child:has(input[type="checkbox"])::before {
    content: none !important;
  }

  /* Adjust first content column (often HN) if row has a checkbox */
  .table-container table:not(.exam-table):not(.no-responsive) tr:has(input[type="checkbox"]) td:nth-child(2),
  .modal-content table:not(.exam-table):not(.no-responsive) tr:has(input[type="checkbox"]) td:nth-child(2),
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) tr:has(input[type="checkbox"]) td:nth-child(2) {
    padding-top: 0.5rem !important;
  }

  .table-container table:not(.exam-table):not(.no-responsive) tr:has(input[type="checkbox"]) td:nth-child(2)::before,
  .modal-content table:not(.exam-table):not(.no-responsive) tr:has(input[type="checkbox"]) td:nth-child(2)::before,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) tr:has(input[type="checkbox"]) td:nth-child(2)::before {
    margin-left: 2rem; /* Give label visual separation from the absolute checkbox */
  }

  /* Remove border for the last child td */
  .table-container table:not(.exam-table):not(.no-responsive) td:last-child,
  .modal-content table:not(.exam-table):not(.no-responsive) td:last-child,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) td:last-child {
    border-bottom: none !important;
    padding-bottom: 0.5rem !important;
    margin-top: 0.5rem;
    justify-content: flex-end !important;
    gap: 0.5rem;
  }

  /* Left-aligned column titles on mobile */
  .table-container table:not(.exam-table):not(.no-responsive) td::before,
  .modal-content table:not(.exam-table):not(.no-responsive) td::before,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-primary);
    text-align: left;
    margin-right: 1.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
  }

  /* Hide headers label when it is empty or is a selection checkbox column */
  .table-container table:not(.exam-table):not(.no-responsive) td[data-label=""]::before,
  .table-container table:not(.exam-table):not(.no-responsive) td[data-label="เลือก"]::before,
  .table-container table:not(.exam-table):not(.no-responsive) td[data-label="Select"]::before,
  .modal-content table:not(.exam-table):not(.no-responsive) td[data-label=""]::before,
  .modal-content table:not(.exam-table):not(.no-responsive) td[data-label="เลือก"]::before,
  .modal-content table:not(.exam-table):not(.no-responsive) td[data-label="Select"]::before,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) td[data-label=""]::before,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) td[data-label="เลือก"]::before,
  div[style*="overflow-y"] table:not(.exam-table):not(.no-responsive) td[data-label="Select"]::before {
    content: none !important;
  }

  /* Align avatar/thumbnail cell properly */
  .table-container table:not(.exam-table):not(.no-responsive) td img,
  .modal-content table:not(.exam-table):not(.no-responsive) td img {
    max-height: 48px;
    width: auto;
    border-radius: 50%;
  }

  /* 2. Custom Optometrist Refraction Entry Tables (.exam-table) */
  table.exam-table, 
  table.exam-table thead, 
  table.exam-table tbody, 
  table.exam-table tr, 
  table.exam-table td {
    display: block !important;
    width: 100% !important;
  }
  
  table.exam-table thead {
    display: none !important;
  }
  
  table.exam-table tr {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    box-shadow: var(--shadow-sm) !important;
    box-sizing: border-box;
  }
  
  table.exam-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.6rem 0 !important;
    border-bottom: 1px dashed var(--border-color) !important;
    text-align: right !important;
    background: transparent !important;
    box-sizing: border-box;
  }
  
  table.exam-table td:first-child {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    border-bottom: 2px solid var(--primary) !important;
    padding-bottom: 0.75rem !important;
    color: var(--primary) !important;
    justify-content: center !important;
    text-align: center !important;
  }
  
  table.exam-table td:last-child {
    border-bottom: none !important;
  }
  
  table.exam-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-primary);
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  table.exam-table select, 
  table.exam-table input {
    width: 60% !important;
    min-width: unset !important;
    height: 38px !important;
  }
}

/* ==========================================
   CAMERA SCANNER OVERLAY & GUIDE STYLES
   Premium barcode/QR scanning experience
   ========================================== */

/* ─── Container ─── */
.camera-scanner-wrap {
  display: none;
  margin: 15px auto;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--primary);
  position: relative;
  max-width: 520px;
  width: 100%;
  background: #000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.camera-scanner-wrap.active {
  display: block;
}

/* ─── Camera reader region ─── */
.camera-scanner-wrap .camera-reader-region {
  width: 100%;
  position: relative;
}

.camera-scanner-wrap .camera-reader-region video {
  width: 100% !important;
  height: auto !important;
  display: block;
  object-fit: cover;
}

/* ─── Override html5-qrcode library default inline styles ─── */
/* Shaded overlay region around the scanning box */
.camera-scanner-wrap #qr-shaded-region {
  border-color: rgba(0, 0, 0, 0.55) !important;
}

/* The scanning box border — make it invisible (we use custom corners instead) */
.camera-scanner-wrap [style*="border: 1px solid"] {
  border: none !important;
}

/* Hide any library-generated UI buttons */
.camera-scanner-wrap button.html5-qrcode-element,
.camera-scanner-wrap select.html5-qrcode-element {
  display: none !important;
}

/* ─── Custom scanning guide overlay with animated corners ─── */
.scanner-guide-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  height: 150px;
  pointer-events: none;
  z-index: 10;
}

/* Corner brackets */
.scanner-guide-overlay::before,
.scanner-guide-overlay::after,
.scanner-guide-overlay .corner-bl::before,
.scanner-guide-overlay .corner-br::before {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: #22d3ee;
  border-style: solid;
  border-width: 0;
  transition: border-color 0.3s;
}

/* Top-left corner */
.scanner-guide-overlay::before {
  top: 0; left: 0;
  border-top-width: 3px;
  border-left-width: 3px;
  border-top-left-radius: 8px;
}

/* Top-right corner */
.scanner-guide-overlay::after {
  top: 0; right: 0;
  border-top-width: 3px;
  border-right-width: 3px;
  border-top-right-radius: 8px;
}

/* Bottom-left corner */
.scanner-guide-overlay .corner-bl::before {
  bottom: 0; left: 0;
  border-bottom-width: 3px;
  border-left-width: 3px;
  border-bottom-left-radius: 8px;
}

/* Bottom-right corner */
.scanner-guide-overlay .corner-br::before {
  bottom: 0; right: 0;
  border-bottom-width: 3px;
  border-right-width: 3px;
  border-bottom-right-radius: 8px;
}

/* ─── Animated horizontal scan line ─── */
.scanner-guide-overlay .scan-line {
  position: absolute;
  top: 0;
  left: 8px;
  right: 8px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #22d3ee 20%, #06b6d4 50%, #22d3ee 80%, transparent 100%);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.5), 0 0 20px rgba(34, 211, 238, 0.2);
  animation: scanLineMove 2.2s ease-in-out infinite;
  border-radius: 2px;
  opacity: 0.9;
}

@keyframes scanLineMove {
  0%   { top: 4px;  opacity: 0.4; }
  50%  { top: calc(100% - 6px); opacity: 0.9; }
  100% { top: 4px;  opacity: 0.4; }
}

/* ─── Hint text below scan region ─── */
.scanner-hint {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  z-index: 11;
  pointer-events: none;
}

/* ─── Loading spinner ─── */
.scanner-loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-family: inherit;
  font-size: 0.9rem;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.scanner-loading-indicator .spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #22d3ee;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Responsive: Mobile optimizations ─── */
@media (max-width: 600px) {
  .camera-scanner-wrap {
    max-width: 100%;
    border-radius: 10px;
    margin: 10px 0;
  }

  .scanner-guide-overlay {
    width: 240px;
    height: 120px;
  }

  .scanner-guide-overlay::before,
  .scanner-guide-overlay::after,
  .scanner-guide-overlay .corner-bl::before,
  .scanner-guide-overlay .corner-br::before {
    width: 22px;
    height: 22px;
  }

  .scanner-hint {
    font-size: 0.68rem;
    bottom: 6px;
  }
}

@media (max-width: 400px) {
  .scanner-guide-overlay {
    width: 200px;
    height: 100px;
  }

  .scanner-guide-overlay::before,
  .scanner-guide-overlay::after,
  .scanner-guide-overlay .corner-bl::before,
  .scanner-guide-overlay .corner-br::before {
    width: 18px;
    height: 18px;
  }
}

/* ─── Desktop: slightly larger scan area ─── */
@media (min-width: 768px) {
  .scanner-guide-overlay {
    width: 320px;
    height: 170px;
  }

  .scanner-guide-overlay::before,
  .scanner-guide-overlay::after,
  .scanner-guide-overlay .corner-bl::before,
  .scanner-guide-overlay .corner-br::before {
    width: 32px;
    height: 32px;
    border-width: 0;
  }

  .scanner-guide-overlay::before { border-top-width: 3.5px; border-left-width: 3.5px; }
  .scanner-guide-overlay::after { border-top-width: 3.5px; border-right-width: 3.5px; }
  .scanner-guide-overlay .corner-bl::before { border-bottom-width: 3.5px; border-left-width: 3.5px; }
  .scanner-guide-overlay .corner-br::before { border-bottom-width: 3.5px; border-right-width: 3.5px; }
}

/* ==========================================
   E-LEARNING SYSTEM STYLES
   ========================================== */
.elearning-card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.elearning-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08) !important;
}

#elearning-modal .modal-content, 
#elearning-detail-modal .modal-content {
  border-radius: 20px;
  border: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

#elearning-modal .modal-header,
#elearning-detail-modal .modal-header {
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
  padding: 1.25rem 1.5rem;
}

#elearning-modal .modal-body,
#elearning-detail-modal .modal-body {
  padding: 1.5rem;
}

#elearning-modal video {
  outline: none;
  background: #000;
}

#elearning-modal iframe {
  border: none;
  border-radius: 12px;
}

/* ==========================================
   PREMIUM E-LEARNING HUB REDESIGN
   ========================================== */

/* Dashboard layout grid */
.elearning-hub-container {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (max-width: 1024px) {
  .elearning-hub-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Featured / Active Lesson Card (Left Column) */
.featured-lesson-card {
  position: relative;
  height: 400px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  background-color: #0f172a;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.featured-lesson-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 35px -5px rgba(79, 70, 229, 0.25), 0 12px 15px -8px rgba(79, 70, 229, 0.15);
}

.featured-lesson-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.65;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.featured-lesson-card:hover .featured-lesson-bg {
  transform: scale(1.04);
}

.featured-lesson-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.1) 0%, rgba(15, 23, 42, 0.9) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  color: white;
  box-sizing: border-box;
}

.featured-lesson-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.featured-lesson-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.featured-lesson-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  line-height: 1.3;
}

.featured-lesson-desc {
  font-size: 0.95rem;
  opacity: 0.9;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  color: #cbd5e1;
}

.featured-lesson-progress-container {
  margin-top: 8px;
}

.featured-lesson-progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.featured-lesson-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #818cf8 0%, #4f46e5 100%);
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.featured-lesson-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.featured-lesson-cta {
  background: white;
  color: #4f46e5;
  padding: 6px 16px;
  border-radius: 9999px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.featured-lesson-card:hover .featured-lesson-cta {
  background: #e0e7ff;
  transform: scale(1.03);
}

/* Horizontal lesson cards (Right Column List) */
.horizontal-lessons-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
}

.horizontal-lessons-list::-webkit-scrollbar {
  width: 6px;
}
.horizontal-lessons-list::-webkit-scrollbar-track {
  background: transparent;
}
.horizontal-lessons-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
.horizontal-lessons-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.horizontal-lesson-card {
  display: flex;
  gap: 16px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px;
  align-items: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.horizontal-lesson-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px) translateX(2px);
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.08);
}

.horizontal-lesson-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.horizontal-lesson-thumb {
  width: 100px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #cbd5e1;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.horizontal-lesson-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.horizontal-lesson-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.horizontal-lesson-progress-bar {
  height: 5px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.horizontal-lesson-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.horizontal-lesson-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.horizontal-lesson-type-badge {
  font-weight: 600;
  color: var(--text-secondary);
}

.horizontal-lesson-cta {
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: color 0.2s;
}

.horizontal-lesson-card:hover .horizontal-lesson-cta {
  color: var(--primary-hover);
}

/* ==========================================
   SPLIT SCREEN COURSE PLAYER VIEW
   ========================================== */
.elearning-player-grid {
  display: grid;
  grid-template-columns: 2.3fr 1fr;
  gap: 24px;
  margin-top: 10px;
  align-items: start;
}

@media (max-width: 1024px) {
  .elearning-player-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.elearning-player-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.player-back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 0;
  transition: color 0.2s, transform 0.2s;
}

.player-back-btn:hover {
  color: var(--primary);
  transform: translateX(-4px);
}

.player-logo-brand {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#elearning-video-wrapper {
  background-color: #000;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  position: relative;
}

.player-warning-banner {
  margin-top: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  background-color: #fffbeb;
  border-left: 4px solid #f59e0b;
  font-size: 0.85rem;
  color: #b45309;
  font-weight: 600;
}

.player-info-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

/* Sidebar Playlist Panel (Right Column) */
.elearning-player-sidebar {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  position: sticky;
  top: 20px;
}

.sidebar-course-meta {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: #f8fafc;
}

.sidebar-course-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  line-height: 1.4;
}

/* Circular Progress Widget */
.sidebar-progress-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  background: white;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.progress-ring-container {
  position: relative;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring-fill {
  transform: rotate(-90deg);
  transform-origin: 35px 35px;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-ring-text {
  position: absolute;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-title);
}

.progress-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.progress-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}

/* Sidebar action buttons */
.sidebar-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-action-btn {
  width: 100%;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-sizing: border-box;
}

.btn-download-docs {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-light);
}

.btn-download-docs:hover {
  background-color: #cbd5e1;
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.btn-certificate {
  background-color: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

.btn-certificate:not([disabled]) {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-certificate:not([disabled]):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

/* Sidebar chapter/episode list (Accordion layout) */
.sidebar-chapters-accordion {
  max-height: 450px;
  overflow-y: auto;
}

.chapter-accordion-item {
  border-bottom: 1px solid var(--border-color);
}

.chapter-accordion-header {
  width: 100%;
  background: white;
  border: none;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s;
}

.chapter-accordion-header:hover {
  background-color: #f8fafc;
}

.chapter-header-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.chapter-check-icon {
  color: #cbd5e1;
  font-size: 1.1rem;
  margin-top: 2px;
  flex-shrink: 0;
  transition: color 0.3s;
}

.chapter-check-icon.completed {
  color: #10b981;
}

.chapter-title-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chapter-title-text {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-meta-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chapter-arrow-icon {
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: 8px;
}

.chapter-accordion-item.open .chapter-arrow-icon {
  transform: rotate(180deg);
}

.chapter-episodes-list {
  display: none;
  background-color: #f8fafc;
  border-top: 1px solid #f1f5f9;
}

.chapter-accordion-item.open .chapter-episodes-list {
  display: block;
}

/* Episode playlist link item */
.chapter-episode-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 12px 48px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid rgba(0, 0, 0, 0.02);
}

.chapter-episode-item:hover {
  background-color: #e2e8f0;
}

.chapter-episode-item.active {
  background-color: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding-left: 45px;
}

.episode-icon {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chapter-episode-item.active .episode-icon {
  color: var(--primary);
}

.episode-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-episode-item.active .episode-title {
  color: var(--primary);
  font-weight: 700;
}

.episode-status-icon {
  font-size: 0.85rem;
  color: #cbd5e1;
}

.episode-status-icon.completed {
  color: #10b981;
}

/* Admin Creator List Row items styling */
.admin-dynamic-row {
  display: flex;
  gap: 10px;
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  align-items: center;
  margin-bottom: 8px;
}

.admin-dynamic-row input {
  margin-bottom: 0 !important;
}

.admin-dynamic-row .btn-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 5px 10px;
  transition: color 0.2s;
}

.admin-dynamic-row .btn-remove:hover {
  color: #dc2626;
}

/* E-learning Rich Text Content Styling */
.rich-content {
  line-height: 1.8 !important;
  font-size: 1.05rem !important;
  color: var(--text-secondary) !important;
}

.rich-content p {
  margin-top: 0 !important;
  margin-bottom: 1.25rem !important;
}

.rich-content h1, 
.rich-content h2, 
.rich-content h3, 
.rich-content h4, 
.rich-content h5, 
.rich-content h6 {
  margin-top: 1.75rem !important;
  margin-bottom: 0.85rem !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  color: var(--primary) !important;
  font-family: var(--font-title) !important;
}

.rich-content h1 { font-size: 1.75rem !important; }
.rich-content h2 { font-size: 1.5rem !important; }
.rich-content h3 { font-size: 1.3rem !important; }
.rich-content h4 { font-size: 1.15rem !important; }

.rich-content ul, 
.rich-content ol {
  margin-top: 0 !important;
  margin-bottom: 1.25rem !important;
  padding-left: 2rem !important;
  display: block !important;
}

.rich-content ul {
  list-style-type: disc !important;
}

.rich-content ol {
  list-style-type: decimal !important;
}

.rich-content li {
  margin-bottom: 0.5rem !important;
  display: list-item !important;
  list-style: inherit !important;
}

.rich-content strong, 
.rich-content b {
  font-weight: 700 !important;
}

.rich-content blockquote {
  border-left: 4px solid var(--primary) !important;
  padding-left: 1rem !important;
  margin: 1.5rem 0 !important;
  color: var(--text-secondary) !important;
  font-style: italic !important;
}

.rich-content table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 1.5rem 0 !important;
}

.rich-content table, 
.rich-content th, 
.rich-content td {
  border: 1px solid var(--border-color) !important;
  padding: 10px 14px !important;
}

.rich-content img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: var(--radius-sm) !important;
  margin: 1rem 0 !important;
  box-shadow: var(--shadow-sm) !important;
}

/* Custom Premium Plyr Theme Settings */
:root {
  --plyr-color-main: #d97706; /* Premium gold/amber color matching e-learning accent */
  --plyr-video-control-color: #ffffff;
  --plyr-video-control-color-hover: #ffffff;
  --plyr-video-control-background-hover: rgba(217, 119, 6, 0.2);
  --plyr-range-track-height: 5px;
  --plyr-range-thumb-height: 13px;
  --plyr-range-thumb-active-scale: 1.3;
  --plyr-font-family: inherit;
}

.plyr {
  border-radius: 14px !important;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
  border: 1px solid var(--border-color);
}

.plyr__controls {
  padding: 14px 16px !important;
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8)) !important;
}

.plyr__control--overlaid {
  background: rgba(217, 119, 6, 0.9) !important;
  padding: 16px !important;
}

.plyr__control--overlaid:hover {
  background: #b45309 !important;
}

.plyr__progress input[type=range] {
  cursor: pointer;
}

/* Notifications System Styles */
.notifications-container {
  display: flex;
  align-items: center;
}

.notifications-bell-btn:hover {
  color: var(--primary) !important;
}

.notifications-dropdown {
  transform-origin: top right;
  animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-5px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.notification-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.82rem;
  text-align: left;
}

.notification-item:hover {
  background-color: #f8fafc;
}

.notification-item.unread {
  background-color: #f0fdfa; /* Light teal for unread */
  border-left: 3px solid var(--accent);
}

.notification-item.unread:hover {
  background-color: #e6fffa;
}

.notification-icon-container {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.notification-item.unread .notification-icon-container {
  background-color: var(--accent-light);
  color: var(--accent);
}

.notification-content {
  flex: 1;
}

.notification-item .notif-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.notification-item .notif-message {
  color: var(--text-secondary);
  line-height: 1.3;
}

.notification-item .notif-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
