/* ═══════════════════════════════════════════
   case.css  –  Case Detail Page
   ═══════════════════════════════════════════ */

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

:root {
  --cream:             #f5f3f8;          /* slight purple tint on bg */
  --dark:              #1a1a1a;
  --muted:             #6b6b6b;
  --purple:            #4b3f8f;          /* main purple */
  --purple-light:      #7b6fc4;          /* lighter purple for accents */
  --purple-pale:       #ede9f8;          /* very pale purple for tags/bg */
  --purple-border:     #c9c0e8;          /* purple-tinted border */
  --accent:            #4b3f8f;          /* same as purple — one source of truth */
  --accent-light:      #7b6fc4;
  --border:            #ddd6e8;          /* purple-tinted border */
  --tag-bg:            #ede9f8;
  --btn-primary:       #4b3f8f;
  --btn-primary-hover: #3a3070;
  --btn-ghost-border:  #c9c0e8;
  --thumb-size:        80px;
}

/* ── CASE NAV ── */
.case-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 40px;
  background: #fff;
  border-bottom: 2px solid var(--purple-border);
  gap: 10px;
  flex-wrap: wrap;
}

.case-nav.center-only {
  justify-content: center;
}

/* ── BUTTONS ── */
.btn-ghost {
  padding: 13px 36px;
  border: 1.5px solid var(--btn-ghost-border);
  border-radius: 6px;
  background: var(--purple-pale);
  color: var(--purple);
  font-size: 15px;
  letter-spacing: .05em;
  cursor: not-allowed;
  min-width: 160px;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

/* active ghost (when it's a real <a> link) */
a.btn-ghost {
  cursor: pointer;
}
a.btn-ghost:hover {
  background: var(--purple-border);
  color: var(--purple);
  text-decoration: none;
}

.btn-primary {
  padding: 13px 36px;
  background: var(--btn-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  letter-spacing: .07em;
  cursor: pointer;
  min-width: 160px;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .25s;
}
.btn-primary:hover { background: var(--btn-primary-hover); color: #fff; text-decoration: none; }

.gallery-link {
  font-size: 15px;
  font-weight: 600;
  color: var(--purple);
  text-decoration: none;
  border-bottom: 2px solid var(--purple-border);
  padding-bottom: 2px;
  transition: border-color .2s, color .2s;
}
.gallery-link:hover {
  border-color: var(--purple);
  color: var(--btn-primary-hover);
  text-decoration: none;
}

/* ════════════════════════════
   MAIN SECTION
   ════════════════════════════ */
section.main {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 20px 60px;
}

/* ════════════════════════════
   PHOTO VIEWER
   ════════════════════════════ */
.viewer-wrap {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  align-items: flex-start;
  width: 100%;
}

/* Thumbnails column */
.thumbs-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  width: var(--thumb-size);
}

.thumb {
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: border-color .2s, opacity .2s;
  opacity: .6;
  background: var(--tag-bg);
  flex-shrink: 0;
}
.thumb:hover  { opacity: .88; }
.thumb.active { border-color: var(--purple); opacity: 1; }

.thumb .thumb-inner {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.thumb-placeholder-inner {
  width: 100%;
  height: 100%;
  display: block;
}

/* Main image */
.main-photo {
  flex: 1;
  min-width: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 32px rgba(75, 63, 143, .15);  /* purple shadow */
  position: relative;
  background: var(--purple-pale);
  border: 1px solid var(--purple-border);
}

#main-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

#main-placeholder {
  width: 100%;
  min-height: 420px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .35s;
}

#main-placeholder:has(#main-img[style*="block"]) {
  min-height: unset;
}

/* angle label — centered, no LTR/RTL dependency needed */
.angle-label {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(75, 63, 143, .82);   /* purple label */
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

/* counter stays top-right in LTR, top-left in RTL — handled in RTL block */
.img-counter {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(75, 63, 143, .75);   /* purple counter */
  color: #fff;
  font-size: 11px;
  letter-spacing: .05em;
  padding: 4px 10px;
  border-radius: 12px;
  z-index: 2;
}

/* ── DISCLAIMER ── */
.disclaimer {
  font-size: clamp(12px, 11.45px + 0.17vw, 14px);
  color: var(--muted);
  text-align: center;
  font-style: italic;
  margin: 8px 0 28px;
}

/* ── CONSULT ── */
.consult-wrap { margin-bottom: 32px; }

.btn-consult {
  padding: 12px 28px;
  background: #fff;
  border: 1.5px solid var(--purple);
  border-radius: 6px;
  color: var(--purple);
  font-size: 14px;
  letter-spacing: .07em;
  cursor: pointer;
  transition: all .25s;
}
.btn-consult:hover {
  background: var(--purple);
  color: #fff;
}

/* ── DIVIDER ── */
.section-divider {
  border: none;
  border-top: 1px solid var(--purple-border);
  margin: 0 0 26px;
}

/* ── SECTION HEADER ── */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 10px;
}

.section-title {
  font-size: 26px;
  font-weight: 500;
  color: var(--purple);            /* purple heading */
}

.favorite-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #c0392b;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .2s;
}
.favorite-btn:hover { opacity: .65; }

/* ── PROCEDURE NOTES ── */
.procedure-description {
  font-size: clamp(14px, 12.73px + 0.39vw, 18px);
  color: var(--dark);
  line-height: 1.7;
  margin-bottom: 16px;
  padding: 14px 16px;
  text-align: left;
}

[dir="rtl"] .procedure-description {
  text-align: right;
}

/* ── PROCEDURE LIST ── */
.procedure-list         { list-style: none; margin-bottom: 16px; }
.procedure-list li      { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; }
.procedure-list li::before {
  content: '•';
  color: var(--purple-light);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.procedure-list a       { color: var(--purple); text-decoration: none; font-weight: 500; border-bottom: 1px solid transparent; transition: border-color .2s; }
.procedure-list a:hover { border-color: var(--purple); }

/* ── PROVIDER LINE ── */
.provider-line          { font-size: 13px; color: var(--muted); margin-bottom: 26px; }
.provider-line a        { color: var(--purple); text-decoration: none; font-weight: 500; }
.provider-line a:hover  { text-decoration: underline; }

/* ── ABOUT PATIENT ── */
.about-title {
  font-size: 24px;
  font-weight: 500;
  color: var(--purple);            /* purple heading */
  margin-bottom: 14px;
}

.info-table                { width: 100%; border-collapse: collapse; max-width: 480px; margin-bottom: 8px; }
.info-table td             { padding: 10px 14px; font-size: 13px; border: 1px solid var(--purple-border); }
.info-table td:first-child { background: var(--purple-pale); color: var(--purple); font-weight: 500; width: 45%; }
.info-table td:last-child  { background: #fff; }

.patient-note { font-size: 11px; color: var(--muted); font-style: italic; margin: 8px 0 36px; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 0;
  border-top: 2px solid var(--purple-border);
  gap: 10px;
  flex-wrap: wrap;
}

.bottom-nav.center-only {
  justify-content: center;
}

/* ════════════════════════════════════
   RTL — PROPER FIXES
   ════════════════════════════════════ */

/* 1. Case nav & bottom nav — flex direction reverses so
      Previous stays on the "start" side (right in RTL) and
      Next stays on the "end" side (left in RTL) — that's correct Arabic UX */
[dir="rtl"] .case-nav,
[dir="rtl"] .bottom-nav {
  flex-direction: row-reverse;
}

/* 2. Viewer — thumbnails move to the right side */
[dir="rtl"] .viewer-wrap {
  flex-direction: row-reverse;
}

/* 3. Counter — top-left in RTL (was top-right) */
[dir="rtl"] .img-counter {
  right: auto;
  left: 12px;
}

/* ── RTL TEXT FIXES ── */
[dir="rtl"] .section-title,
[dir="rtl"] .about-title,
[dir="rtl"] .procedure-list,
[dir="rtl"] .provider-line,
[dir="rtl"] .info-table {
  text-align: right;
  direction: rtl;
}

[dir="rtl"] section.main {
  direction: rtl;
}

/* 8. Text alignment for inline text elements */
[dir="rtl"] .disclaimer,
[dir="rtl"] .patient-note {
  text-align: center;  /* stays centered — fine for both */
}


/* ════════════════
   RESPONSIVE
   ════════════════ */
@media (max-width: 768px) {
  :root { --thumb-size: 64px; }

  .case-nav { padding: 10px 16px; }
  section.main { padding: 20px 16px 44px; }

  .btn-ghost,
  .btn-primary { min-width: 100px; padding: 10px 16px; font-size: 13px; }

  #main-placeholder { min-height: 280px; }
}

@media (max-width: 600px) {
  :root { --thumb-size: 56px; }

  /* Stack: big image on top, thumbnails as horizontal row below */
  .viewer-wrap  { flex-direction: column !important; }
  .main-photo   { order: 1; width: 100%; }
  .thumbs-col   {
    order: 2;
    flex-direction: row !important;
    flex-wrap: wrap;
    width: 100%;
    gap: 8px;
  }

  #main-placeholder { min-height: 240px; aspect-ratio: 4/3; }

  .section-title { font-size: 21px; }
  .about-title   { font-size: 19px; }

}

@media (max-width: 420px) {
  .gallery-link { order: -1; width: 100%; text-align: center; }
  .case-nav,
  .bottom-nav   { justify-content: center; }
}