/* ═══════════════════════════════════════════════════════════════════════════
   ORL Daily — Professional Medical Newspaper Stylesheet
   © 2026 Mohammad Al-Bar | MIT License
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ──────────────────────────────────────────────────────── */
:root {
  /* Subspecialty accent colors */
  --color-rhinology:   #c0392b;
  --color-skull-base:  #8e44ad;
  --color-laryngology: #d35400;
  --color-otology:     #2980b9;
  --color-head-neck:   #27ae60;
  --color-pediatric:   #e67e22;
  --color-sleep:       #7f8c8d;
  --color-business:    #2c3e50;
  --color-general:     #34495e;

  /* UI palette */
  --color-header:      #1a3a5c;
  --color-header-dark: #122840;
  --color-jc:          #27ae60;
  --color-dw:          #f39c12;
  --color-stars:       #f1c40f;
  --color-bg:          #f4f6f8;
  --color-card:        #ffffff;
  --color-text:        #2c3e50;
  --color-text-mute:   #7f8c8d;
  --color-border:      #e0e6ed;
  --color-accent:      #2980b9;
  --color-modal-bg:    rgba(10, 25, 45, 0.78);

  /* Typography */
  --font-ar: 'Segoe UI', 'Tahoma', 'Arabic Typesetting', 'Amiri', Arial, sans-serif;
  --font-en: 'Georgia', 'Times New Roman', 'Charter', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Geometry */
  --radius:      10px;
  --radius-lg:   16px;
  --shadow-sm:   0 2px 6px rgba(0,0,0,0.07);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.20);
  --transition:  all 0.22s ease;
}

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main.main-content { flex: 1; }

a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ── Language Modes ──────────────────────────────────────────────────────── */
body.lang-ar {
  font-family: var(--font-ar);
  direction: rtl;
  text-align: right;
}

body.lang-en {
  font-family: var(--font-en);
  direction: ltr;
  text-align: left;
}

/* Show/hide language-specific spans */
.lang-ar .show-en { display: none !important; }
.lang-en .show-ar { display: none !important; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--color-header);
  color: #fff;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  height: 64px;
  flex-wrap: nowrap;
}

.site-logo {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-ui);
  flex-shrink: 0;
}

.site-logo:hover { text-decoration: none; }

.site-logo span { color: #5dade2; }

.header-spacer { flex: 1; }

.current-date-display {
  font-size: 0.78rem;
  opacity: 0.6;
  white-space: nowrap;
  font-family: var(--font-ui);
  flex-shrink: 0;
}

/* Search */
.header-search {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-search input {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 24px;
  color: #fff;
  font-size: 0.88rem;
  padding: 0.4rem 2.2rem 0.4rem 1rem;
  width: 190px;
  transition: var(--transition);
  font-family: inherit;
}

.lang-ar .header-search input {
  padding: 0.4rem 1rem 0.4rem 2.2rem;
}

.header-search input::placeholder { color: rgba(255,255,255,0.50); }

.header-search input:focus {
  outline: none;
  background: rgba(255,255,255,0.20);
  width: 240px;
  border-color: rgba(255,255,255,0.45);
}

.search-icon {
  position: absolute;
  right: 0.7rem;
  color: rgba(255,255,255,0.55);
  pointer-events: none;
  font-size: 0.88rem;
}

.lang-ar .search-icon { right: auto; left: 0.7rem; }

/* Language toggle button */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 0.18rem 0.3rem;
  border: 1px solid rgba(255,255,255,0.2);
}

.lang-btn {
  background: transparent;
  border: none;
  border-radius: 16px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.22rem 0.65rem;
  transition: var(--transition);
  font-family: var(--font-ui);
  white-space: nowrap;
}

.lang-btn:hover { color: #fff; background: rgba(255,255,255,0.15); }

.lang-btn.active {
  background: rgba(255,255,255,0.25);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
}

/* Date picker */
.date-picker-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.date-picker-wrap select {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 0.84rem;
  padding: 0.35rem 0.6rem;
  transition: var(--transition);
  font-family: inherit;
}

.date-picker-wrap select option {
  background: var(--color-header);
  color: #fff;
}

.date-picker-wrap select:focus { outline: none; }

/* ── Filter Bar ──────────────────────────────────────────────────────────── */
/* ── Article Count Bar ── */
.article-count-bar {
  background: var(--color-primary);
  color: #fff;
  text-align: center;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: none;
}
.article-count-bar.visible { display: block; }

.filter-bar {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 64px;
  z-index: 800;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.filter-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  height: 48px;
}

.filter-inner::-webkit-scrollbar { display: none; }

.filter-tab {
  background: none;
  border: none;
  border-radius: 20px;
  color: var(--color-text-mute);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.35rem 1rem;
  white-space: nowrap;
  transition: var(--transition);
  font-family: inherit;
  flex-shrink: 0;
  line-height: 1.3;
}

.filter-tab:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.filter-tab.active {
  background: var(--color-header);
  color: #fff;
  font-weight: 600;
}

.filter-tab[data-filter="jc"].active  { background: var(--color-jc); }
.filter-tab[data-filter="dw"].active  { background: var(--color-dw); }

/* Article count badge on filter tabs */
.tab-count {
  display: inline-block;
  background: rgba(0,0,0,0.18);
  color: inherit;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0 5px;
  margin-left: 4px;
  line-height: 1.5;
  vertical-align: middle;
}
.filter-tab.active .tab-count {
  background: rgba(255,255,255,0.25);
}

/* Active subspecialty tab coloring */
.filter-tab[data-filter="rhinology"].active   { background: var(--color-rhinology); }
.filter-tab[data-filter="laryngology"].active { background: var(--color-laryngology); }
.filter-tab[data-filter="otology"].active     { background: var(--color-otology); }
.filter-tab[data-filter="head_neck"].active   { background: var(--color-head-neck); }
.filter-tab[data-filter="pediatric"].active   { background: var(--color-pediatric); }
.filter-tab[data-filter="sleep"].active       { background: var(--color-sleep); }

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
}

/* ── Article Grid ────────────────────────────────────────────────────────── */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

/* ── Article Card ────────────────────────────────────────────────────────── */
.article-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid var(--color-border);
  position: relative;
}

.article-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: #c9d3dc;
}

/* Subspecialty color bar at top of card */
.card-subspecialty-bar {
  height: 4px;
  flex-shrink: 0;
}

.card-subspecialty-bar.rhinology   { background: var(--color-rhinology); }
.card-subspecialty-bar.skull_base  { background: var(--color-skull-base); }
.card-subspecialty-bar.laryngology { background: var(--color-laryngology); }
.card-subspecialty-bar.otology     { background: var(--color-otology); }
.card-subspecialty-bar.head_neck   { background: var(--color-head-neck); }
.card-subspecialty-bar.pediatric   { background: var(--color-pediatric); }
.card-subspecialty-bar.sleep       { background: var(--color-sleep); }
.card-subspecialty-bar.business    { background: var(--color-business); }
.card-subspecialty-bar.general     { background: var(--color-general); }

.card-body {
  padding: 1rem 1.1rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  display: inline-block;
  font-family: var(--font-ui);
  line-height: 1.4;
}

/* Subspecialty badges */
.badge.subspecialty { background: #eaf0f6; color: var(--color-text); text-transform: capitalize; }
.badge.subspecialty.rhinology   { background: #fdecea; color: var(--color-rhinology); }
.badge.subspecialty.skull_base  { background: #f3e8fc; color: var(--color-skull-base); }
.badge.subspecialty.laryngology { background: #fef0e6; color: var(--color-laryngology); }
.badge.subspecialty.otology     { background: #e8f4fb; color: var(--color-otology); }
.badge.subspecialty.head_neck   { background: #e9f7ef; color: var(--color-head-neck); }
.badge.subspecialty.pediatric   { background: #fdf3e3; color: var(--color-pediatric); }
.badge.subspecialty.sleep       { background: #f0f1f1; color: var(--color-sleep); }
.badge.subspecialty.business    { background: #eaecee; color: var(--color-business); }
.badge.subspecialty.general     { background: #eaecee; color: var(--color-general); }

/* Star rating badge */
.badge.stars {
  background: #fef9e7;
  color: #b7950b;
  letter-spacing: 0.04em;
}

/* Journal Club & Drug Watch badges */
.badge.jc { background: #e9f7ef; color: var(--color-jc); }
.badge.dw { background: #fef5e7; color: var(--color-dw); }
.badge.confidence { background: transparent; padding: 0.1rem 0.25rem; font-size: 1rem; line-height: 1; }

.card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--color-text);
}

.card-meta {
  color: var(--color-text-mute);
  font-size: 0.8rem;
  font-style: italic;
}

.card-summary {
  color: #4a5568;
  font-size: 0.88rem;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* Card action buttons */
.card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem 0.9rem;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.42rem 0.9rem;
  transition: var(--transition);
  font-family: inherit;
  line-height: 1.3;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-read {
  background: var(--color-header);
  color: #fff;
  flex: 1;
  justify-content: center;
}
.btn-read:hover { background: var(--color-header-dark); }

.btn-audio {
  background: #eaf4fb;
  color: #2471a3;
}
.btn-audio:hover { background: #d0e8f5; }

.btn-flash {
  background: #f0f3f4;
  color: var(--color-text);
}
.btn-flash:hover { background: #dce1e3; }

/* ── Loading / State Cards ───────────────────────────────────────────────── */
.state-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 3.5rem 2rem;
  text-align: center;
  grid-column: 1 / -1;
  color: var(--color-text-mute);
  font-size: 1rem;
  border: 1px solid var(--color-border);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 1.2rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal Base ──────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-modal-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  overflow-y: auto;
  padding: 2rem 1rem 3rem;
}

.modal-overlay.open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.modal-box {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 800px;
  width: 100%;
  overflow: hidden;
  animation: slideUp 0.26s ease;
  margin: auto;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Modal header */
.modal-header {
  background: var(--color-header);
  color: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 2;
}

.modal-header-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.modal-header-meta {
  font-size: 0.8rem;
  opacity: 0.75;
  margin-top: 0.25rem;
}

.modal-close {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  height: 34px;
  width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: rgba(255,255,255,0.3); }

/* Modal body */
.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* ── Modal Section Blocks ────────────────────────────────────────────────── */
.section-block {
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}

.section-block h4 {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.68;
}

.section-block p {
  font-size: 0.94rem;
  line-height: 1.8;
}

/* Colored left/right border per block type (RTL-aware) */
.block-summary   { background: #f7f9fc; border-right: 4px solid var(--color-accent); }
.block-practice  { background: #e8f8f5; border-right: 4px solid #1abc9c; }
.block-future    { background: #fef9e7; border-right: 4px solid var(--color-dw); }
.block-why       { background: #f0e6fb; border-right: 4px solid var(--color-pediatric); }
.block-vs        { background: #eaf4fb; border-right: 4px solid var(--color-otology); }
.block-research  { background: #fdecea; border-right: 4px solid var(--color-rhinology); }

.lang-en .block-summary  { border-right: none; border-left: 4px solid var(--color-accent); }
.lang-en .block-practice { border-right: none; border-left: 4px solid #1abc9c; }
.lang-en .block-future   { border-right: none; border-left: 4px solid var(--color-dw); }
.lang-en .block-why      { border-right: none; border-left: 4px solid var(--color-pediatric); }
.lang-en .block-vs       { border-right: none; border-left: 4px solid var(--color-otology); }
.lang-en .block-research { border-right: none; border-left: 4px solid var(--color-rhinology); }

/* ── Drug Watch Banner ───────────────────────────────────────────────────── */
.drug-watch-banner {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  border-radius: var(--radius);
  color: #fff;
  padding: 0.85rem 1.1rem;
  font-weight: 600;
  font-size: 0.93rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.6;
}

/* ── Stars Row ───────────────────────────────────────────────────────────── */
.stars-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.85rem;
  background: var(--color-bg);
  border-radius: var(--radius);
}

.stars-display {
  font-size: 1.3rem;
  color: var(--color-stars);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.stars-reason {
  color: var(--color-text-mute);
  font-size: 0.85rem;
  font-style: italic;
  flex: 1;
}

/* ── Audio Player ────────────────────────────────────────────────────────── */
.audio-player {
  background: #f0f4f8;
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border: 1px solid var(--color-border);
}

.audio-play-btn {
  background: var(--color-header);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  height: 44px;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.audio-play-btn:hover { background: var(--color-header-dark); transform: scale(1.06); }

.audio-info {
  flex: 1;
  min-width: 0;
}

.audio-title {
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--color-text);
}

audio {
  width: 100%;
  margin-top: 0.4rem;
  height: 30px;
  border-radius: 4px;
}

/* Audio script fallback */
.audio-script-fallback {
  font-size: 0.86rem;
  line-height: 1.75;
  white-space: pre-line;
  color: #4a5568;
  padding: 0.5rem 0;
}

/* ── MCQ ─────────────────────────────────────────────────────────────────── */
.mcq-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.mcq-header {
  background: var(--color-header);
  color: #fff;
  padding: 0.65rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.mcq-question {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
}
.mcq-question:last-child { border-bottom: none; }

.mcq-q-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.mcq-q-text {
  font-weight: 600;
  font-size: 0.93rem;
  margin-bottom: 0.7rem;
  line-height: 1.5;
}

.mcq-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mcq-option {
  background: #f7f9fc;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  padding: 0.55rem 0.9rem;
  text-align: right;
  transition: var(--transition);
  font-family: inherit;
  width: 100%;
  line-height: 1.45;
}

.lang-en .mcq-option { text-align: left; }

.mcq-option:hover:not(:disabled) {
  background: #e8f4fb;
  border-color: var(--color-accent);
  transform: translateX(-2px);
}

.lang-en .mcq-option:hover:not(:disabled) {
  transform: translateX(2px);
}

.mcq-option.correct {
  background: #e9f7ef;
  border-color: #27ae60;
  color: #1e8449;
  font-weight: 600;
}

.mcq-option.wrong {
  background: #fdecea;
  border-color: #e74c3c;
  color: #c0392b;
  text-decoration: line-through;
  opacity: 0.85;
}

.mcq-option.revealed {
  background: #e9f7ef;
  border-color: #27ae60;
}

.mcq-option:disabled { cursor: default; }

.mcq-explanation {
  background: #f7f9fc;
  border-radius: 6px;
  color: #4a5568;
  font-size: 0.84rem;
  line-height: 1.65;
  margin-top: 0.6rem;
  padding: 0.65rem 0.9rem;
  display: none;
  border-right: 3px solid var(--color-accent);
  animation: fadeIn 0.2s ease;
}

.lang-en .mcq-explanation {
  border-right: none;
  border-left: 3px solid var(--color-accent);
}

.mcq-explanation.visible { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Modal Links Row ─────────────────────────────────────────────────────── */
.modal-links {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding-top: 0.2rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

.btn-link {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  text-decoration: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: inherit;
  line-height: 1.3;
}

.btn-link:hover {
  background: var(--color-header);
  border-color: var(--color-header);
  color: #fff;
  text-decoration: none;
}

/* ── Flash Card Modal ────────────────────────────────────────────────────── */
.flash-card-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-modal-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  overflow-y: auto;
  padding: 2rem 1rem 3rem;
}

.flash-card-modal.open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.flash-card-box {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  overflow: hidden;
  animation: slideUp 0.26s ease;
  margin: auto;
}

/* Flash card top controls bar */
.flash-card-controls {
  background: var(--color-header);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  gap: 0.5rem;
}

.flash-card-controls > span {
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-ui);
}

.flash-controls-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.btn-fc-action {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  transition: var(--transition);
  font-family: inherit;
  line-height: 1.3;
}

.btn-fc-action:hover { background: rgba(255,255,255,0.3); }

/* ── Flash Card Print Layout ─────────────────────────────────────────────── */
.flash-card-print {
  /* this is the screenshotted / printed element */
}

.fc-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: var(--color-header);
  color: #fff;
  font-size: 0.76rem;
  font-family: var(--font-ui);
}

.fc-top-badges {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.fc-body {
  border: 2px solid var(--color-border);
  border-top: none;
}

.fc-section {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.88rem;
  line-height: 1.6;
}

.fc-section:last-child { border-bottom: none; }

.fc-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.5;
  margin-bottom: 0.3rem;
  font-family: var(--font-ui);
}

.fc-title {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.4;
}

.fc-journal {
  font-size: 0.78rem;
  color: var(--color-text-mute);
  margin-top: 0.2rem;
  font-style: italic;
}

.fc-bullet {
  font-size: 0.83rem;
  line-height: 1.6;
  margin-bottom: 0.3rem;
}
.fc-bullet:last-child { margin-bottom: 0; }

.fc-mcq-q {
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.86rem;
}

.fc-mcq-opts {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: #4a5568;
}

.fc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.73rem;
  color: var(--color-text-mute);
  background: #f7f9fc;
  border-top: 1px solid var(--color-border);
}

.fc-footer-brand { font-weight: 700; font-size: 0.8rem; color: var(--color-text); }

/* QR code placeholder / container */
.fc-qr-container {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.fc-qr-placeholder {
  width: 60px;
  height: 60px;
  border: 2px dashed var(--color-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  color: var(--color-text-mute);
  text-align: center;
  line-height: 1.3;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--color-header);
  color: rgba(255,255,255,0.6);
  padding: 1rem 1.5rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  font-family: var(--font-ui);
  justify-content: center;
}

.footer-inner a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: var(--transition);
}
.footer-inner a:hover { color: #fff; }

.footer-sep { opacity: 0.3; }

/* ── Utility classes ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.badge-count {
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  margin-right: 0.3rem;
  font-family: var(--font-ui);
}
.lang-ar .badge-count { margin-right: 0; margin-left: 0.3rem; }

/* ── Responsive — Tablet ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

/* ── Responsive — Mobile ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner {
    height: auto;
    padding: 0.5rem 0;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header-spacer { flex: 1; }

  .site-logo { font-size: 1.1rem; }

  /* Lang switcher: always visible on mobile */
  .lang-switcher { order: -1; flex-shrink: 0; }

  /* Push search + date picker to second row */
  .header-search { order: 10; flex-basis: 100%; }
  .header-search input { width: 100%; box-sizing: border-box; }
  .header-search input:focus { width: 100%; }

  .date-picker-wrap { order: 11; }
  .current-date-display { display: none; }

  .filter-bar { top: 0; position: relative; }
  .articles-grid { grid-template-columns: 1fr; }
  .main-content { padding: 0.85rem; }

  .modal-overlay { padding: 0; }
  .modal-box { border-radius: 0; min-height: 100vh; }
  .modal-body { padding: 1rem; }

  .flash-card-modal { padding: 0; }
  .flash-card-box { border-radius: 0; min-height: 100vh; }
}

@media (max-width: 480px) {
  .card-actions { flex-direction: column; }
  .btn-read { flex: none; width: 100%; }
  .modal-links { gap: 0.4rem; }
}

/* ── Print Styles ────────────────────────────────────────────────────────── */
@media print {
  /* Hide everything except the flash card print element */
  .site-header,
  .filter-bar,
  .main-content,
  .site-footer,
  .modal-overlay,
  .flash-card-controls { display: none !important; }

  .flash-card-modal {
    display: block !important;
    position: static !important;
    background: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .flash-card-box {
    box-shadow: none !important;
    max-width: 100% !important;
    border-radius: 0 !important;
  }

  .flash-card-print {
    page-break-inside: avoid;
  }

  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
