/**
 * DosiPlot v5.0 — Simulation Monte Carlo Interactive
 * © 2025 Pr. Yassine OULHOUQ
 * Université Mohammed Premier (UMP) — Oujda, Maroc
 * Module: Sidebar — Layout, Panels, Collapsible Sections, Result Cards Grid
 */

/* ============================================
   SIDEBAR LAYOUT
   ============================================ */
.sb {
  background: linear-gradient(180deg, var(--bg1), var(--bg0));
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  position: relative;
}

/* Sidebar subtle top border glow */
.sb::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 180, 255, 0.15), transparent);
  pointer-events: none;
}

/* ============================================
   PANEL SECTIONS
   ============================================ */
.pnl {
  margin-bottom: 14px;
}

.pnl-t {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--t3);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pnl-t::before {
  content: '';
  width: 3px;
  height: 12px;
  background: linear-gradient(180deg, var(--blue), var(--cyan));
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0, 180, 255, 0.3);
  flex-shrink: 0;
}

.pnl-t.elec::before {
  background: linear-gradient(180deg, var(--amber), #ff8c00);
  box-shadow: 0 0 8px rgba(255, 176, 32, 0.3);
}

/* ============================================
   COLLAPSIBLE SECTIONS
   ============================================ */
.sb-section {
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sb-section:hover {
  border-color: var(--border2);
}

.sb-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  background: var(--bg2);
  transition: background 0.2s;
}

.sb-section-header:hover {
  background: var(--bg3);
}

.sb-section-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sb-section-arrow {
  font-size: 10px;
  color: var(--t3);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sb-section.open .sb-section-arrow {
  transform: rotate(180deg);
}

.sb-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sb-section.open .sb-section-body {
  max-height: 1000px;
}

.sb-section-content {
  padding: 12px;
}

/* ============================================
   RESULT CARDS GRID (in sidebar)
   ============================================ */
.pg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Individual result card glassmorphism variant */
.pc.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
}

/* ============================================
   SIDEBAR PANEL VARIANTS
   ============================================ */

/* Sidebar content for individual tab panels */
[id^="sb-"] {
  /* Sidebar content panels share these defaults */
}

/* Hidden sidebar panels */
[id^="sb-"][style*="display:none"],
[id^="sb-"][style*="display: none"] {
  display: none;
}

/* ============================================
   PHYSICS ANNOTATIONS PANEL
   ============================================ */
.phys-panel {
  margin: 12px 0 4px;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(100, 160, 255, 0.12);
  background: var(--bg1);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.phys-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: 0.3px;
  transition: background 0.2s;
}

.phys-toggle:hover {
  background: rgba(100, 160, 255, 0.06);
}

.phys-toggle .phys-icon {
  font-size: 16px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.phys-toggle.open .phys-icon {
  transform: rotate(90deg);
}

.phys-toggle .phys-label {
  flex: 1;
}

.phys-toggle .phys-arrow {
  font-size: 10px;
  opacity: 0.5;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.phys-toggle.open .phys-arrow {
  transform: rotate(90deg);
}

.phys-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.phys-body.open {
  max-height: 2000px;
}

.phys-content {
  padding: 0 14px 14px;
}

/* --- Understand Panel --- */
.phys-understand {
  background: linear-gradient(135deg, rgba(100, 160, 255, 0.06), rgba(0, 200, 180, 0.04));
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--t2);
}

.phys-understand strong {
  color: var(--t1);
  font-weight: 600;
}

.phys-understand .phys-clinical {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(100, 160, 255, 0.1);
  color: var(--blue);
  font-size: 10.5px;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.3px;
}

.phys-understand .phys-clinical.elec {
  background: rgba(0, 200, 180, 0.1);
  color: var(--cyan);
}

/* --- Zone Annotations --- */
.phys-zones {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.phys-zone {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg0);
  border-left: 3px solid var(--blue);
  transition: background 0.2s;
}

.phys-zone:hover {
  background: rgba(100, 160, 255, 0.06);
}

.phys-zone.elec {
  border-left-color: var(--cyan);
}

.phys-zone-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.phys-zone-content {
  flex: 1;
}

.phys-zone-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.phys-zone.elec .phys-zone-title {
  color: var(--cyan);
}

.phys-zone-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  line-height: 1.65;
  color: var(--t2);
}

/* ============================================
   EMPIRICAL RULES PANEL
   ============================================ */
.empirical-panel {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.empirical-title {
  font-size: 11px;
  font-weight: 700;
  color: #8b5cf6;
  margin-bottom: 6px;
  font-family: 'IBM Plex Mono', monospace;
}

.empirical-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  padding: 3px 0;
  font-family: 'IBM Plex Mono', monospace;
}

.empirical-row .emp-label {
  color: var(--t2);
}

.empirical-row .emp-val {
  color: #a78bfa;
  font-weight: 600;
}

.empirical-row .emp-ok {
  color: #10b981;
}

.empirical-row .emp-warn {
  color: #f59e0b;
}
