/* ══════════════════════════════════════
   IBD HUB — Shared Styles
   ══════════════════════════════════════ */

:root {
  --accent:        #1565C0;
  --accent-hover:  #0d47a1;
  --accent-light:  #E3F2FD;
  --navy:          #1a2744;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --shadow-sm:     0 1px 4px rgba(0,0,0,0.08);
  --shadow:        0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.14);
  --radius:        14px;
  --radius-sm:     8px;
  --font:          'Heebo', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { font-family: var(--font); -webkit-font-smoothing: antialiased; }

/* ══════════════════════════════════════
   LANDING PAGE
   ══════════════════════════════════════ */

.landing-body {
  background: #ffffff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-wrap {
  width: 100%;
  max-width: 420px;
  padding: 24px 16px;
}

.landing-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding-bottom: 40px;
}

.landing-logo-link { display: block; margin-bottom: 24px; }

.landing-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border-radius: 50%;
}

.landing-illustration-wrap {
  width: 316px;
  height: 316px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.landing-illustration {
  width: 284px;
  height: 284px;
  object-fit: contain;
}

.landing-title {
  font-size: 2.6rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  text-align: center;
}

.landing-subtitle {
  font-size: 1rem;
  color: var(--text);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 32px;
  padding: 0 8px;
  font-weight: 400;
}

.landing-title-light {
  font-weight: 300;
  color: var(--navy);
  letter-spacing: 1px;
}

.landing-btn {
  display: inline-block;
  padding: 12px 36px;
  background: #1565C0;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-align: center;
  text-decoration: none;
  border-radius: 50px;
  box-shadow: 0 2px 12px rgba(21,101,192,0.25);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  margin-bottom: 0;
}

.landing-btn:hover {
  background: #1976D2;
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(21,101,192,0.35);
}

.landing-cred {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--accent-light);
  border: 1px solid #B3D4F5;
  border-radius: var(--radius);
  width: 100%;
  text-align: center;
}

.landing-cred-author {
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 10px;
}

.landing-cred-author strong { color: var(--navy); }

.landing-cred-items {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.landing-disclaimer {
  margin-top: 24px;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.landing-disclaimer a {
  color: var(--text-muted);
  text-decoration: underline;
}
.landing-disclaimer a:hover { color: var(--accent); }

/* ══════════════════════════════════════
   LIBRARY PAGE
   ══════════════════════════════════════ */

.library-body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
#topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 10px 16px 0;
}

#header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

#header-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
}

#brand-block { display: flex; flex-direction: column; }

#brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
}

#brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* ── Search ── */
#search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.search-icon {
  position: absolute;
  right: 12px;
  font-size: 1rem;
  pointer-events: none;
  color: var(--text-muted);
}

#search-input {
  width: 100%;
  padding: 10px 40px 10px 36px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg);
  color: var(--text);
}

#search-input:focus { border-color: var(--accent); background: #fff; }

#search-clear {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 4px;
  line-height: 1;
}

#search-clear:hover { color: var(--text); }

/* ── Tile View ── */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 16px 8px;
}

.topic-tile {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  text-decoration: none;
  font-family: var(--font);
  box-shadow: var(--shadow-sm);
}

.topic-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 28px rgba(21,101,192,0.18);
  transform: translateY(-3px) scale(1.02);
}

.about-tile { border-color: #C5CAE9; }
.about-tile:hover { border-color: #3949AB; box-shadow: 0 4px 16px rgba(57,73,171,0.15); }

.path-grid { padding-top: 0; }

.path-tile { border-color: #B3D4F5; background: #F0F7FF; }
.path-tile:hover { border-color: var(--accent); background: #fff; }

.path-tile .tile-label { color: var(--accent); }

.tile-emoji { font-size: 2.4rem; line-height: 1; }
.tile-icon  { width: 56px; height: 56px; object-fit: contain; }
.tile-label { font-size: 0.85rem; font-weight: 700; color: var(--navy); line-height: 1.3; }
.tile-count { font-size: 0.72rem; color: var(--text-muted); }

.tile-section-label {
  padding: 12px 16px 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.format-tile-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 20px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.format-tile-row::-webkit-scrollbar { display: none; }

.format-tile {
  flex-shrink: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 70px;
  font-family: var(--font);
  box-shadow: var(--shadow-sm);
}
.format-tile:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(21,101,192,0.15); transform: translateY(-2px) scale(1.04); }
.format-tile .tile-emoji { font-size: 1.8rem; }
.format-tile .tile-label { font-size: 0.72rem; font-weight: 600; color: var(--text); }
.format-tile .tile-count { font-size: 0.68rem; color: var(--text-muted); }

/* ── View transitions ── */
@keyframes viewIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes viewOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
.view-enter { animation: viewIn  0.22s ease forwards; }
.view-exit  { animation: viewOut 0.18s ease forwards; }

/* ── Subtopic group headers ── */
.subtopic-header {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 10px 2px 6px;
  border-bottom: 1.5px solid var(--border);
  margin-top: 6px;
  text-align: right;
  letter-spacing: 0.03em;
}
.subtopic-header:first-child { margin-top: 0; }

/* ── Card View Header ── */
#card-view-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 78px;
  z-index: 10;
}

#back-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 6px 16px;
  min-height: 40px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
  transition: all 0.15s;
}
#back-btn:hover { background: var(--accent-hover); }

#card-view-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
}

#results-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Cards Grid ── */
#cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 12px 16px 32px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* Icon card */
.card-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  min-height: 110px;
  background: #F0F7FF;
}


.card-icon {
  width: 88px;
  height: 88px;
  object-fit: contain;
}

.card-icon-lg {
  width: 123px;
  height: 123px;
  object-fit: contain;
}

/* Play button overlay on video cards */
.card-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 44px;
  height: 44px;
  background: rgba(21,101,192,0.75);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  transition: transform 0.15s, background 0.15s;
  pointer-events: none;
}

.card:hover .card-play-btn {
  transform: translate(-50%, -50%) scale(1.1);
  background: var(--accent);
}

/* Focus visible */
.topic-tile:focus-visible,
.format-tile:focus-visible,
.card:focus-visible,
a.about-tile:focus-visible,
#back-btn:focus-visible,
#clear-filters-btn:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
}

/* Active / tap feedback */
.topic-tile:active,
.format-tile:active { transform: scale(0.97); }
.card:active { transform: translateY(0) scale(0.98); box-shadow: var(--shadow-sm); }

/* Format badge */
.card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 9px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
}

.badge-video  { background: #d32f2f; }
.badge-doc    { background: #1565C0; }
.badge-tool   { background: #00838f; }

/* Audience badge */
.card-aud-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 0.62rem;
  font-weight: 600;
}

.card-aud-professional {
  background: #EEF2FF;
  color: #3730A3;
  border: 1px solid #C7D2FE;
}

.card-aud-patient {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}

/* Language badge (for dual-language items) */
.card-lang-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 9px;
  border-radius: 50px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(0,0,0,0.55);
  color: #fff;
}

/* Card body */
.card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card-subtopic {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.card-description {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

/* ── WhatsApp share ── */
.card-share-wa {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 5px 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #15803d;
  text-decoration: none;
  align-self: flex-start;
  transition: background 0.15s, transform 0.1s;
}
.card-share-wa:hover { background: #dcfce7; transform: scale(1.03); }
.card-share-wa:active { transform: scale(0.97); }

/* ── Empty state ── */
#empty-state {
  text-align: center;
  padding: 48px 16px 60px;
  color: var(--text-muted);
}

.empty-icon { font-size: 2rem; margin-bottom: 12px; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-hint  { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 14px; }

#empty-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 22px;
}

#empty-suggestions button {
  padding: 6px 16px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

#empty-suggestions button:hover {
  background: var(--accent);
  color: #fff;
}

#clear-filters-btn {
  padding: 10px 24px;
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

#clear-filters-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ══════════════════════════════════════
   VIDEO MODAL
   ══════════════════════════════════════ */

#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}

#modal-overlay[hidden] { display: none; }

#modal-box {
  background: #000;
  border-radius: var(--radius);
  width: 100%;
  max-width: 800px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg);
}

#modal-close {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  background: rgba(0,0,0,0.7);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#modal-close:hover { background: rgba(255,255,255,0.2); }

#modal-title-bar {
  padding: 10px 50px 10px 14px;
  background: #111;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  direction: rtl;
}

#modal-video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

#modal-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ══════════════════════════════════════
   FOOTER
   ══════════════════════════════════════ */

#site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 16px 20px;
  margin-top: 8px;
}

#footer-inner {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}

#footer-disclaimer {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

#footer-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

#footer-meta a {
  color: var(--text-muted);
  text-decoration: none;
}

#footer-meta a:hover { color: var(--accent); text-decoration: underline; }

.footer-dot { opacity: 0.35; }

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */

@media (max-width: 600px) {

  #cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px 10px 32px;
  }

  .card-icon    { width: 56px; height: 56px; }
  .card-icon-lg { width: 80px; height: 80px; }
  .card-icon-wrap { min-height: 90px; padding: 16px 10px 12px; }
  .card-title { font-size: 0.85rem; }
  .card-body  { padding: 10px 10px 12px; }

  .landing-title { font-size: 2rem; }
  .landing-illustration      { width: 210px; height: 210px; }
  .landing-illustration-wrap { width: 230px; height: 230px; max-width: 100%; }

  #card-view-header { top: 72px; }
}

@media (max-width: 400px) {

  #cards-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px 12px 32px;
  }

  .card-icon-wrap { min-height: 100px; }
  .card-share-wa  { display: none; }
}

/* ── Transcript Snippets ───────────────────────────────── */
.card-snippets {
  width: 100%;
  border-top: 1px solid #e8f0fe;
  padding: 8px 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8fbff;
  border-radius: 0 0 12px 12px;
}

.card-snippet {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  padding: 5px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dbeafe;
  transition: background 0.15s;
  cursor: pointer;
}
.card-snippet:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.snip-time {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  white-space: nowrap;
  padding-top: 1px;
  flex-shrink: 0;
}

.snip-text {
  font-size: 0.78rem;
  color: #374151;
  line-height: 1.45;
  direction: rtl;
  text-align: right;
}

