/* ═══════════════════════════════════════════════════════════
   Sidebar Panels — Shared 3-column layout + widget styles
   Extracted from dashboard.html, extended for all pages.
   ═══════════════════════════════════════════════════════════ */

/* ── 3-Column Page Layout ─────────────────────────────── */
.page-layout {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  min-height: calc(100vh - 58px);
}

.page-layout > .sidebar-left,
.page-layout > .sidebar-right {
  position: sticky;
  top: 74px;
  height: fit-content;
  max-height: calc(100vh - 74px);
  overflow-y: auto;
  padding: 20px 14px;
}

.page-layout > .sidebar-left {
  background: linear-gradient(180deg, rgba(0,212,212,0.025) 0%, transparent 50%);
  border-right: 1px solid var(--border);
}

.page-layout > .sidebar-right {
  background: linear-gradient(180deg, rgba(124,95,191,0.025) 0%, transparent 50%);
  border-left: 1px solid var(--border);
}

.page-layout > .sidebar-left::-webkit-scrollbar,
.page-layout > .sidebar-right::-webkit-scrollbar {
  width: 3px;
}
.page-layout > .sidebar-left::-webkit-scrollbar-thumb,
.page-layout > .sidebar-right::-webkit-scrollbar-thumb {
  background: #C5C0B8;
  border-radius: 2px;
}

/* Center column gets its own padding when inside page-layout */
.page-layout > .page-center {
  padding: 32px 28px 60px;
  min-width: 0;
}

/* ── Sidebar Widget Card (.sw) ────────────────────────── */
.sw {
  background: var(--bg-card, #FAF9F7);
  border: 1px solid var(--border, #DDD9D3);
  border-radius: var(--radius-lg, 8px);
  padding: 20px;
  margin-bottom: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  overflow: hidden;
}
.sw:hover {
  border-color: var(--accent-border, rgba(185,74,47,0.18));
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  transform: translateY(-2px);
}

.sw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sw-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #7D766D);
}
.sw-badge {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
}
.sw-badge.green  { background: rgba(34,197,94,0.12); color: #22c55e; }
.sw-badge.amber  { background: rgba(234,179,8,0.12);  color: #eab308; }
.sw-badge.red    { background: rgba(239,68,68,0.12);  color: #ef4444; }
.sw-badge.blue   { background: rgba(59,130,246,0.12); color: #3b82f6; }
.sw-badge.purple { background: rgba(124,95,191,0.12); color: #7c5fbf; }

/* ── Panel-specific styles ────────────────────────────── */

/* Progress ring */
.sp-ring-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.sp-ring {
  width: 56px; height: 56px;
  position: relative;
  flex-shrink: 0;
}
.sp-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sp-ring-bg { fill: none; stroke: var(--border, #DDD9D3); stroke-width: 5; }
.sp-ring-fill { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.sp-ring-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono, monospace); font-size: 13px; font-weight: 700;
  color: var(--text-primary, #1B1918);
}
.sp-ring-detail { font-size: 13px; color: var(--text-secondary, #7D766D); line-height: 1.5; }

/* Mini checklist */
.sp-checklist { list-style: none; padding: 0; margin: 0; }
.sp-checklist li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border, #DDD9D3);
  font-size: 13px; color: var(--text-primary, #1B1918); cursor: pointer;
}
.sp-checklist li:last-child { border-bottom: none; }
.sp-checklist li.done { color: var(--text-muted, #9B9488); text-decoration: line-through; }
.sp-check {
  width: 18px; height: 18px; border-radius: 4px;
  border: 2px solid var(--border, #DDD9D3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: transparent; transition: all 0.15s;
}
.sp-checklist li.done .sp-check {
  background: #22c55e; border-color: #22c55e; color: #fff;
}

/* Accordion */
.sp-accordion {}
.sp-acc-item { border-bottom: 1px solid var(--border, #DDD9D3); }
.sp-acc-item:last-child { border-bottom: none; }
.sp-acc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text-primary, #1B1918);
}
.sp-acc-head::after { content: '+'; font-size: 16px; color: var(--text-muted, #9B9488); transition: transform 0.2s; }
.sp-acc-item.open .sp-acc-head::after { content: '\2212'; }
.sp-acc-body {
  max-height: 0; overflow: hidden; transition: max-height 0.25s ease;
  font-size: 12px; color: var(--text-secondary, #7D766D); line-height: 1.6;
}
.sp-acc-item.open .sp-acc-body { max-height: 400px; padding-bottom: 8px; }

/* Stat rows */
.sp-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border, #DDD9D3);
  font-size: 13px;
}
.sp-stat-row:last-child { border-bottom: none; }
.sp-stat-label { color: var(--text-secondary, #7D766D); }
.sp-stat-value { font-family: var(--font-mono, monospace); font-weight: 600; color: var(--text-primary, #1B1918); }

/* Mini calculator inputs */
.sp-calc-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.sp-calc-label {
  font-size: 12px; color: var(--text-secondary, #7D766D); min-width: 70px;
}
.sp-calc-input {
  flex: 1; padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--border, #DDD9D3);
  background: var(--bg-input, #E8E5E0);
  font-family: var(--font-mono, monospace); font-size: 13px;
  color: var(--text-primary, #1B1918); outline: none;
  box-sizing: border-box; min-width: 0; max-width: 100%;
}
.sp-calc-input:focus { border-color: var(--accent, #B94A2F); }
.sp-calc-result {
  margin-top: 10px; padding: 10px; border-radius: 6px;
  background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.15);
  font-size: 13px; color: var(--text-primary, #1B1918);
}
.sp-calc-result strong { font-family: var(--font-mono, monospace); }

/* Select dropdown in panels */
.sp-select {
  width: 100%; padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--border, #DDD9D3);
  background: var(--bg-input, #E8E5E0);
  font-size: 13px; color: var(--text-primary, #1B1918);
  margin-bottom: 10px; outline: none;
  box-sizing: border-box; max-width: 100%;
}
.sp-select:focus { border-color: var(--accent, #B94A2F); }

/* Timeline / recent items */
.sp-timeline { list-style: none; padding: 0; margin: 0; }
.sp-timeline li {
  position: relative; padding: 8px 0 8px 18px;
  border-left: 2px solid var(--border, #DDD9D3);
  font-size: 12px; color: var(--text-secondary, #7D766D); line-height: 1.5;
}
.sp-timeline li::before {
  content: ''; position: absolute; left: -5px; top: 12px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent, #B94A2F); border: 2px solid var(--bg-card, #FAF9F7);
}
.sp-timeline li strong { color: var(--text-primary, #1B1918); }

/* Project list links */
.sp-project-link {
  display: block; padding: 8px 10px; border-radius: 6px; margin-bottom: 4px;
  font-size: 12px; color: var(--text-primary, #1B1918);
  text-decoration: none; transition: background 0.15s;
}
.sp-project-link:hover { background: rgba(0,0,0,0.04); }
.sp-project-sub { font-size: 11px; color: var(--text-muted, #9B9488); }

/* Quick links */
.sp-quick-links { list-style: none; padding: 0; margin: 0; }
.sp-quick-links li {
  padding: 7px 0; border-bottom: 1px solid var(--border, #DDD9D3);
}
.sp-quick-links li:last-child { border-bottom: none; }
.sp-quick-links a {
  font-size: 13px; color: var(--accent, #B94A2F); text-decoration: none; font-weight: 500;
}
.sp-quick-links a:hover { text-decoration: underline; }

/* Severity badges */
.sp-severity {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 6px;
  border-radius: 4px; text-transform: uppercase; letter-spacing: 0.03em;
}
.sp-severity.warning { background: rgba(234,179,8,0.12); color: #d97706; }
.sp-severity.stop    { background: rgba(239,68,68,0.12); color: #ef4444; }

/* Donut chart */
.sp-donut-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.sp-donut { width: 64px; height: 64px; flex-shrink: 0; }
.sp-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sp-donut-bg   { fill: none; stroke: var(--border, #DDD9D3); stroke-width: 6; }
.sp-donut-seg  { fill: none; stroke-width: 6; stroke-linecap: round; }
.sp-donut-legend { font-size: 11px; color: var(--text-secondary, #7D766D); line-height: 1.7; }
.sp-donut-legend span { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* Bar chart (horizontal) */
.sp-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sp-bar-label { font-size: 11px; color: var(--text-secondary); min-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-bar-track { flex: 1; height: 8px; background: var(--border, #DDD9D3); border-radius: 4px; overflow: hidden; }
.sp-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.sp-bar-value { font-family: var(--font-mono, monospace); font-size: 11px; font-weight: 600; color: var(--text-primary); min-width: 30px; text-align: right; }

/* System status dots */
.sp-status-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  font-size: 13px; color: var(--text-primary, #1B1918);
}
.sp-status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.sp-status-dot.green  { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.4); }
.sp-status-dot.red    { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.sp-status-dot.amber  { background: #eab308; box-shadow: 0 0 6px rgba(234,179,8,0.4); }

/* Compact form (quick add) */
.sp-form-group { margin-bottom: 10px; }
.sp-form-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.sp-form-input {
  width: 100%; padding: 7px 10px; border-radius: 6px;
  border: 1px solid var(--border, #DDD9D3);
  background: var(--bg-input, #E8E5E0);
  font-size: 13px; color: var(--text-primary); outline: none; box-sizing: border-box;
}
.sp-form-input:focus { border-color: var(--accent, #B94A2F); }
.sp-btn-sm {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px; border-radius: 6px; border: none;
  background: var(--accent, #B94A2F); color: #fff;
  font-size: 12px; font-weight: 700; cursor: pointer; transition: opacity 0.15s;
}
.sp-btn-sm:hover { opacity: 0.85; }

/* Empty state */
.sp-empty {
  text-align: center; padding: 16px 8px; color: var(--text-muted, #9B9488);
  font-size: 12px; font-style: italic;
}

/* ── Reveal Animations ────────────────────────────────── */
.reveal-left {
  opacity: 0; transform: translateX(-40px);
  transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1), transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.reveal-left.visible { opacity: 1; transform: translateX(0); }

.reveal-right {
  opacity: 0; transform: translateX(40px);
  transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1), transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.reveal-right.visible { opacity: 1; transform: translateX(0); }

/* ── Dark Theme Overrides (for settings.html) ─────────── */
.dark-panels .sw {
  background: var(--bg-card, #18181E);
  border-color: var(--border, #252530);
}
.dark-panels .sw:hover {
  border-color: rgba(185,74,47,0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.dark-panels .sp-calc-input,
.dark-panels .sp-form-input,
.dark-panels .sp-select {
  background: var(--bg-input, #0E0E12);
  border-color: var(--border, #252530);
  color: var(--text-primary, #E8E6E1);
}
.dark-panels .sp-calc-result {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.2);
}
.dark-panels .sidebar-left {
  background: linear-gradient(180deg, rgba(185,74,47,0.03) 0%, transparent 50%);
  border-right-color: var(--border, #252530);
}
.dark-panels .sidebar-right {
  background: linear-gradient(180deg, rgba(124,95,191,0.03) 0%, transparent 50%);
  border-left-color: var(--border, #252530);
}
.dark-panels .sidebar-left::-webkit-scrollbar-thumb,
.dark-panels .sidebar-right::-webkit-scrollbar-thumb {
  background: #333;
}

/* ── Responsive Breakpoints ───────────────────────────── */
@media (max-width: 1599px) {
  .page-layout { grid-template-columns: 1fr 280px; }
  .page-layout > .sidebar-left { display: none; }
}
@media (max-width: 1439px) {
  .page-layout { grid-template-columns: 1fr; }
  .page-layout > .sidebar-left,
  .page-layout > .sidebar-right { display: none; }
  .page-layout > .page-center { padding: 32px 28px 60px; }
}
@media (max-width: 768px) {
  .page-layout > .page-center { padding: 20px 16px calc(40px + env(safe-area-inset-bottom, 20px)); }
}
