/* ============================================================
   panel.css — EduNudge GeoLab · Plate Tectonics Simulator
   Side panel, tab content areas, detail panels, accordion,
   legend, boundary cards, hotspot detail, process steps,
   example chips and all shared interactive components.
   Depends on: base.css (custom properties, resets)
   ============================================================ */

/* ----------------------------------------------------------
   1. SIDE PANEL SHELL
   ---------------------------------------------------------- */
#side-panel {
  width: var(--panel-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--clr-surface);
  border-left: 1px solid var(--clr-border);
  overflow: hidden;
  position: relative;
  z-index: var(--z-raised);

  /* entrance animation */
  animation: slideInRight var(--dur-slow) var(--ease-out) both;
  animation-delay: 0.15s;
}

/* inner scroll area (below tab strip) */
#side-panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* ----------------------------------------------------------
   2. PANEL SECTION HEADINGS
   ---------------------------------------------------------- */
.panel-section-title {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.panel-section-title i {
  color: var(--clr-orange);
  font-size: var(--fs-base);
}

.panel-section-title .section-count {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--clr-text-muted);
  background: var(--clr-surface-raised);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-full);
  padding: 1px var(--sp-2);
}

/* ----------------------------------------------------------
   3. DETAIL PANELS  (shared base — Tab1, Tab2, Tab3)
   ---------------------------------------------------------- */
.detail-panel {
  margin: 0 var(--sp-4) var(--sp-4);
  padding: var(--sp-4);
  background: var(--clr-surface-raised);
  border: 1px solid var(--clr-border-strong);
  border-radius: var(--radius-lg);
  position: relative;
  animation: scalePop var(--dur-slow) var(--ease-spring) both;
  box-shadow: var(--shadow-md);
}

/* close button (top-right) */
.detail-close {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.detail-close:hover {
  color: var(--clr-white);
  background: var(--clr-orange);
  border-color: var(--clr-orange);
}

/* header row: swatch/icon + name + type */
.detail-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  padding-right: var(--sp-6);
  /* avoid overlap with close btn */
}

.detail-swatch {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.10);
}

.detail-icon {
  font-size: var(--fs-xl);
  flex-shrink: 0;
  line-height: 1;
}

.detail-name {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--clr-text-primary);
  line-height: var(--lh-tight);
}

.detail-type,
.detail-subtitle {
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
  font-weight: var(--fw-medium);
  text-transform: capitalize;
  letter-spacing: 0.03em;
}

.detail-desc {
  font-size: var(--fs-sm);
  color: var(--clr-text-secondary);
  line-height: var(--lh-loose);
  margin-bottom: var(--sp-3);
}

/* ----------------------------------------------------------
   4. HOTSPOT DETAIL ICON  (Tab 3)
   ---------------------------------------------------------- */
.hotspot-detail-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--clr-orange-alpha);
  border: 1px solid var(--clr-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
  color: var(--clr-orange);
  flex-shrink: 0;
  box-shadow: var(--shadow-glow-orange);
  animation: glowBreathe 2.5s ease-in-out infinite;
}

/* ----------------------------------------------------------
   5. BOUNDARY TYPE CARDS  (Tab 2)
   ---------------------------------------------------------- */
.boundary-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--dur-normal) var(--ease-out),
    border-color var(--dur-normal) var(--ease-out),
    transform var(--dur-normal) var(--ease-spring),
    box-shadow var(--dur-normal) var(--ease-out);
}

/* coloured left accent bar */
.boundary-card__bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  flex-shrink: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.boundary-card:hover {
  background: var(--clr-surface-raised);
  border-color: var(--clr-border-strong);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.boundary-card.selected {
  background: var(--clr-surface-raised);
  border-color: var(--clr-orange);
  transform: translateX(4px);
  box-shadow: 0 0 0 1px var(--clr-orange), var(--shadow-md);
}

/* icon */
.boundary-card__icon {
  font-size: var(--fs-lg);
  flex-shrink: 0;
  line-height: 1;
  width: 28px;
  text-align: center;
}

/* text block */
.boundary-card__info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.boundary-card__label {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi);
  color: var(--clr-text-primary);
}

.boundary-card__snippet {
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
  line-height: var(--lh-snug);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* chevron */
.boundary-card__chevron {
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
  flex-shrink: 0;
  transition: transform var(--dur-normal) var(--ease-spring),
    color var(--dur-normal) var(--ease-out);
}

.boundary-card:hover .boundary-card__chevron,
.boundary-card.selected .boundary-card__chevron {
  transform: translateX(3px);
  color: var(--clr-orange);
}

/* boundary cards layout */
#tab2-type-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 0 var(--sp-4) var(--sp-3);
}

/* ----------------------------------------------------------
   6. EXAMPLE CHIPS  (Tab 2 boundary detail)
   ---------------------------------------------------------- */
.detail-examples {
  margin-top: var(--sp-3);
}

.detail-examples__label {
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--fw-semi);
  margin-bottom: var(--sp-2);
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.example-chip {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--clr-text-secondary);
  background: var(--clr-surface);
  border: 1px solid;
  /* colour set inline */
  border-radius: var(--radius-full);
  padding: 3px var(--sp-3);
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.example-chip:hover {
  background: var(--clr-surface-raised);
  color: var(--clr-text-primary);
}

/* ----------------------------------------------------------
   7. PROCESS STEPS  (Tab 2 boundary detail)
   ---------------------------------------------------------- */
.process-steps {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.process-step {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  animation: slideInLeft var(--dur-slow) var(--ease-out) both;
}

.process-step:nth-child(1) {
  animation-delay: 0ms;
}

.process-step:nth-child(2) {
  animation-delay: 60ms;
}

.process-step:nth-child(3) {
  animation-delay: 120ms;
}

.process-step:nth-child(4) {
  animation-delay: 180ms;
}

/* numbered circle */
.process-step__num {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--clr-white);
  flex-shrink: 0;
  /* background set inline */
}

.process-step__icon {
  font-size: var(--fs-base);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  /* colour set inline */
}

.process-step__text {
  font-size: var(--fs-sm);
  color: var(--clr-text-secondary);
  line-height: var(--lh-snug);
}

/* ----------------------------------------------------------
   8. LEGEND  (Tab 2 — bottom of panel)
   ---------------------------------------------------------- */
#tab2-legend {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--clr-border);
  margin-top: auto;
}

.legend-title {
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--fw-semi);
  margin-bottom: var(--sp-2);
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.legend-line {
  display: inline-block;
  width: 24px;
  height: 3px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  /* background set inline */
}

.legend-label {
  font-size: var(--fs-xs);
  color: var(--clr-text-secondary);
  font-weight: var(--fw-medium);
}

/* ----------------------------------------------------------
   9. TAB 2 DETAIL PANEL  (boundary type)
   ---------------------------------------------------------- */
#tab2-detail-panel {
  margin: 0 var(--sp-4) var(--sp-3);
  padding: var(--sp-4);
  background: var(--clr-surface-raised);
  border: 1px solid var(--clr-border-strong);
  border-radius: var(--radius-lg);
  position: relative;
  animation: scalePop var(--dur-slow) var(--ease-spring) both;
  box-shadow: var(--shadow-md);
}

/* ----------------------------------------------------------
   10. TAB 1 DETAIL PANEL  (plate)
   ---------------------------------------------------------- */
#tab1-detail-panel {
  margin: var(--sp-3) var(--sp-4) 0;
  /* ← top margin, no bottom */
  padding: var(--sp-4);
  background: var(--clr-surface-raised);
  border: 1px solid var(--clr-orange);
  /* ← orange border — eye catching */
  border-radius: var(--radius-lg);
  position: relative;
  animation: scalePop var(--dur-slow) var(--ease-spring) both;
  box-shadow: var(--shadow-md),
    0 0 20px rgba(232, 108, 47, 0.15);
  /* ← subtle orange glow */
}


/* ----------------------------------------------------------
   11. TAB 3 DETAIL PANEL  (hotspot)
   ---------------------------------------------------------- */
#tab3-detail-panel {
  margin: 0 var(--sp-4) var(--sp-3);
  padding: var(--sp-4);
  background: var(--clr-surface-raised);
  border: 1px solid var(--clr-orange);
  border-radius: var(--radius-lg);
  position: relative;
  animation: scalePop var(--dur-slow) var(--ease-spring) both;
  box-shadow: var(--shadow-md),
    0 0 20px rgba(232, 108, 47, 0.12);
}

/* ----------------------------------------------------------
   12. QUIZ SECTION WRAPPER  (Tab 3)
   ---------------------------------------------------------- */
#tab3-quiz-section {
  border-top: 1px solid var(--clr-border);
  margin-top: var(--sp-2);
  padding-bottom: var(--sp-4);
}

/* ----------------------------------------------------------
   13. PANEL EMPTY STATE
   Shown when a tab has no content yet.
   ---------------------------------------------------------- */
.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  color: var(--clr-text-muted);
}

.panel-empty i {
  font-size: var(--fs-3xl);
  opacity: 0.30;
  color: var(--clr-orange);
}

.panel-empty__title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  color: var(--clr-text-secondary);
}

.panel-empty__desc {
  font-size: var(--fs-sm);
  max-width: 220px;
  line-height: var(--lh-base);
}

/* ----------------------------------------------------------
   14. PANEL FOOTER
   ---------------------------------------------------------- */
#panel-footer {
  flex-shrink: 0;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--clr-border);
  background: var(--clr-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.panel-footer__brand {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
  font-weight: var(--fw-medium);
}

.panel-footer__brand span {
  color: var(--clr-orange);
}

.panel-footer__link {
  font-size: var(--fs-xs);
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  transition: color var(--dur-fast) var(--ease-out);
}

.panel-footer__link:hover {
  color: var(--clr-orange-light);
  text-decoration: none;
}

/* ----------------------------------------------------------
   15. SCROLLBAR WITHIN PANEL
   ---------------------------------------------------------- */
#side-panel-body::-webkit-scrollbar {
  width: 4px;
}

#side-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

#side-panel-body::-webkit-scrollbar-thumb {
  background: var(--clr-teal-light);
  border-radius: var(--radius-full);
}

#side-panel-body::-webkit-scrollbar-thumb:hover {
  background: var(--clr-orange);
}

/* ----------------------------------------------------------
   16. RESPONSIVE — panel behaviour
   ---------------------------------------------------------- */

/* Narrow panel on tablet */
@media (max-width: 1024px) {
  :root {
    --panel-width: 300px;
  }
}

/* Full-width panel below globe on mobile */
@media (max-width: 768px) {
  #side-panel {
    width: 100%;
    flex-shrink: 0;
    border-left: none;
    border-top: 1px solid var(--clr-border);
    max-height: 50vh;
    animation: slideInLeft var(--dur-slow) var(--ease-out) both;
  }

  #side-panel-body {
    max-height: calc(50vh - var(--header-height));
  }

  #tab2-type-grid,
  #tab1-plate-grid,
  #tab3-hotspot-list {
    padding-bottom: var(--sp-2);
  }

  .detail-panel,
  #tab1-detail-panel,
  #tab2-detail-panel,
  #tab3-detail-panel {
    margin: 0 var(--sp-3) var(--sp-3);
  }

  .process-steps {
    gap: var(--sp-1);
  }
}

/* Stack chips vertically on very small screens */
@media (max-width: 480px) {
  .example-chips {
    flex-direction: column;
  }

  .legend-items {
    flex-direction: column;
    gap: var(--sp-2);
  }

  #tab2-stats-strip {
    padding: var(--sp-2) var(--sp-3);
  }

  .panel-section-title {
    padding: var(--sp-3) var(--sp-3) var(--sp-1);
  }

  #panel-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-1);
  }
}

/* ----------------------------------------------------------
   END panel.css
   ---------------------------------------------------------- */