/* ============================================
   EXPLORER LAYOUT & THEME (Hybrid V5)
   ============================================ */

/* --- SLATE THEME VARIABLES --- */
:root {
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-750: #293548;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-500-10: rgba(59, 130, 246, 0.1);
  --blue-500-20: rgba(59, 130, 246, 0.2);
  
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-500-10: rgba(16, 185, 129, 0.1);
  
  --red-500: #ef4444;
}

/* --- LAYOUT CONTAINERS --- */
.layout-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  height: 100%;
  background-color: var(--slate-950);
  color: var(--slate-300);
}

.content-panes {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* --- HEADER & RIBBON --- */
.finder-header {
  height: 60px;
  background: var(--slate-900);
  border-bottom: 1px solid var(--slate-800);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.header-left, .header-right { display: flex; align-items: center; gap: 12px; }

.breadcrumbs { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  font-family: var(--font-display, sans-serif); 
  font-size: 14px; 
  font-weight: 500; 
  color: var(--slate-400); 
  margin-left: 8px; 
}
.crumb-active { color: white; }

.header-search {
  background: var(--slate-950);
  border: 1px solid var(--slate-700);
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 300px;
}
.header-search input {
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-family: var(--font-body, sans-serif);
  font-size: 13px;
  width: 100%;
}

/* --- BRAND RIBBON --- */
.brand-ribbon {
  height: 70px;
  background: var(--slate-900);
  border-bottom: 1px solid var(--slate-800);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  overflow-x: auto;
  flex-shrink: 0;
}
.brand-ribbon::-webkit-scrollbar { height: 4px; }
.brand-ribbon::-webkit-scrollbar-thumb { background: var(--slate-700); border-radius: 4px; }

.brand-separator { width: 1px; height: 40px; background: var(--slate-700); margin: 0 8px; }

.brand-filter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: 0.2s;
  min-width: 50px;
}
.brand-filter:hover, .brand-filter.active { opacity: 1; }

.brand-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  position: relative;
}
.brand-filter.active .brand-circle {
  border-color: var(--blue-500);
  background: var(--blue-500-10);
}
.energy-icon { font-size: 20px; color: var(--slate-400); }
.brand-filter.active .energy-icon { color: var(--blue-500); }

.brand-circle img { width: 100%; height: 100%; object-fit: contain; filter: invert(1); }
.brand-name { 
  font-family: var(--font-display, sans-serif); 
  font-size: 10px; 
  font-weight: 600; 
  text-align: center; 
  white-space: nowrap; 
}

/* --- LEFT PANE (TREE) --- */
.tree-pane {
  width: 220px;
  background: var(--slate-950);
  border-right: 1px solid var(--slate-800);
  padding: 16px;
  overflow-y: auto;
  transition: width 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
  flex-shrink: 0;
  white-space: nowrap;
}
.tree-pane.collapsed { width: 0; padding: 16px 0; opacity: 0; border-right: none; }

.tree-label { 
  font-family: var(--font-display, sans-serif);
  font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--slate-500); 
  margin-bottom: 12px; letter-spacing: 0.05em; 
}
.tree-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
  color: var(--slate-400); font-family: var(--font-body, sans-serif); font-size: 13px; font-weight: 500;
  cursor: pointer; margin-bottom: 2px;
}
.tree-item:hover { background: var(--slate-800); color: var(--slate-200); }
.tree-item.active { background: var(--blue-500-10); color: var(--blue-500); font-weight: 600; }
.tree-item .material-symbols-rounded { font-size: 18px; }
.tree-group { margin-left: 12px; border-left: 1px solid var(--slate-800); padding-left: 12px; margin-bottom: 8px; }

/* --- CENTER PANE (MAIN) --- */
.center-pane {
  flex: 1;
  background: var(--slate-900);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.main-toolbar {
  padding: 12px 24px;
  border-bottom: 1px solid var(--slate-800);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.95);
  z-index: 10;
}
.mt-left { display: flex; align-items: center; gap: 12px; }
.mt-count { 
  font-family: var(--font-display, sans-serif);
  font-size: 14px; font-weight: 700; color: var(--slate-400); margin-right: 12px; 
}

/* Filter Chips (Shared with main app but styled for Slate) */
.filter-chip {
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  color: var(--slate-400);
  font-family: var(--font-body, sans-serif);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: 0.2s;
  display: flex; align-items: center; gap: 6px;
}
.filter-chip:hover { background: var(--slate-700); color: white; }
.filter-chip.active { background: var(--blue-500); border-color: var(--blue-500); color: white; }

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* --- COMPACT GRID CARDS --- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.sim-card {
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  border-radius: 12px;
  padding: 12px;
  position: relative;
  transition: 0.2s;
  cursor: pointer;
  display: flex; flex-direction: column; height: 110px;
}
.sim-card:hover { transform: translateY(-2px); border-color: var(--slate-500); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.sim-card.selected { border-color: var(--blue-500); background: var(--blue-500-10); box-shadow: 0 0 0 1px var(--blue-500); }

.sim-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sim-brand-icon { width: 20px; height: 20px; object-fit: contain; filter: invert(1); opacity: 0.7; }
.sim-model { 
  font-family: var(--font-display, sans-serif);
  font-size: 14px; font-weight: 700; color: white; 
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; 
}

.sim-info { flex: 1; }
.sim-scenario { font-family: var(--font-body, sans-serif); font-size: 11px; color: var(--slate-400); margin-bottom: 2px; }
.sim-meta-mini { font-family: var(--font-body, sans-serif); font-size: 10px; color: var(--slate-500); display: flex; gap: 6px; font-weight: 500; }

.sim-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; }
.sim-price { font-family: var(--font-display, sans-serif); font-size: 16px; font-weight: 700; color: var(--emerald-500); }

/* --- DETAIL VIEW (Comparison) --- */
.detail-view-container {
  background: var(--slate-950);
  border: 1px solid var(--slate-800);
  border-radius: 16px;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  margin-bottom: 40px;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.detail-header {
  background: var(--slate-800);
  padding: 12px 24px;
  border-bottom: 1px solid var(--slate-700);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.detail-title { font-family: var(--font-display, sans-serif); font-size: 18px; font-weight: 700; color: white; display: flex; align-items: center; gap: 12px; }
.detail-close { cursor: pointer; color: var(--slate-500); transition: 0.2s; }
.detail-close:hover { color: white; }

/* Scenarios Horizontal Scroll */
.scenarios-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
}

/* 5-Scenario Card Styles (Adapted for Slate Theme) */
.scenario-card {
  min-width: 280px;
  width: 280px;
  background: var(--slate-950);
  border: 1px solid var(--slate-800);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.scenario-card.best {
  border-color: var(--emerald-500);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, var(--slate-950) 100%);
}
.sc-header { padding: 16px; border-bottom: 1px solid var(--slate-800); }
.sc-title { font-family: var(--font-display, sans-serif); font-size: 13px; font-weight: 700; color: var(--slate-200); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.badge-best { background: var(--emerald-500); color: white; font-size: 9px; padding: 2px 6px; border-radius: 4px; font-weight: 800; text-transform: uppercase; }
.sc-price-large { font-family: var(--font-display, sans-serif); font-size: 28px; font-weight: 800; color: white; letter-spacing: -0.02em; line-height: 1; margin-bottom: 4px; }
.scenario-card.best .sc-price-large { color: var(--emerald-500); }
.sc-sub-price { font-family: var(--font-body, sans-serif); font-size: 11px; color: var(--slate-500); font-weight: 500; }
.sc-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.stacked-bar { height: 24px; display: flex; border-radius: 6px; overflow: hidden; margin-bottom: 8px; background: var(--slate-800); }
.sb-segment { height: 100%; display: flex; align-items: center; justify-content: center; color: white; font-size: 9px; font-weight: 700; font-family: var(--font-display, sans-serif); text-transform: uppercase; }
.sc-metric-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--slate-800); font-size: 12px; font-family: var(--font-body, sans-serif); }
.sc-metric-row:last-child { border-bottom: none; }
.sc-metric-label { color: var(--slate-400); display: flex; align-items: center; gap: 6px; }
.sc-metric-value { color: var(--slate-200); font-weight: 500; font-family: monospace; }
.sc-icon { font-size: 14px; color: var(--slate-500); }
.sc-total-row { margin-top: auto; padding-top: 12px; border-top: 2px solid var(--slate-800); display: flex; justify-content: space-between; align-items: center; }
.sc-total-label { font-family: var(--font-display, sans-serif); font-weight: 800; color: var(--slate-300); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.sc-total-value { font-family: var(--font-display, sans-serif); font-size: 16px; font-weight: 700; color: white; }
.scenario-card.best .sc-total-value { color: var(--emerald-500); }

/* --- RIGHT PANE (CONTEXT) --- */
.context-pane {
  width: 300px;
  background: var(--slate-950);
  border-left: 1px solid var(--slate-800);
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 24px;
  transition: width 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
  flex-shrink: 0;
  overflow-y: auto;
}
.context-pane.collapsed { width: 0; padding: 24px 0; opacity: 0; border-left: none; }

.context-header { text-align: center; padding-bottom: 20px; border-bottom: 1px solid var(--slate-800); }
.context-icon-wrapper { 
  width: 72px; height: 72px; 
  background: var(--slate-900); 
  border: 1px solid var(--slate-800);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px auto;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}
.context-icon-wrapper img { width: 40px; filter: invert(1); opacity: 0.9; }
.context-title { font-family: var(--font-display, sans-serif); font-size: 20px; font-weight: 700; color: white; margin-bottom: 4px; }
.context-subtitle { font-family: var(--font-body, sans-serif); font-size: 14px; color: var(--slate-500); font-weight: 500; }

/* KPI Cards */
.kpi-card-large {
  background: var(--slate-900);
  border: 1px solid var(--blue-500-20);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-bottom: 12px;
  background: linear-gradient(180deg, var(--slate-900) 0%, rgba(59, 130, 246, 0.05) 100%);
}
.kpi-label { font-family: var(--font-display, sans-serif); font-size: 12px; font-weight: 700; color: var(--blue-500); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.kpi-value-large { font-family: var(--font-display, sans-serif); font-size: 40px; font-weight: 800; color: white; line-height: 1; }
.kpi-unit { font-family: var(--font-body, sans-serif); font-size: 14px; color: var(--slate-400); font-weight: 500; margin-left: 4px; }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi-card-small {
  background: var(--slate-900);
  border: 1px solid var(--slate-800);
  border-radius: 12px;
  padding: 12px;
}
.kpi-label-small { display: flex; align-items: center; gap: 6px; font-family: var(--font-display, sans-serif); font-size: 11px; font-weight: 700; color: var(--slate-500); text-transform: uppercase; margin-bottom: 4px; }
.kpi-value-small { font-family: var(--font-display, sans-serif); font-size: 18px; font-weight: 700; color: var(--slate-200); }

/* Workflow Widget */
.workflow-widget { background: var(--slate-900); border: 1px solid var(--slate-800); border-radius: 12px; padding: 16px; }
.wf-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.wf-label { font-family: var(--font-display, sans-serif); font-size: 11px; font-weight: 700; color: var(--slate-500); text-transform: uppercase; }
.wf-badge { background: var(--blue-500-10); color: var(--blue-500); padding: 2px 8px; border-radius: 4px; font-family: var(--font-display, sans-serif); font-size: 11px; font-weight: 800; border: 1px solid rgba(59, 130, 246, 0.2); }
.wf-actions { display: flex; gap: 8px; }
.wf-btn { flex: 1; background: var(--blue-600); color: white; border: none; border-radius: 8px; padding: 10px; font-family: var(--font-display, sans-serif); font-size: 13px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.wf-btn:hover { background: var(--blue-500); }
.wf-btn.secondary { background: var(--slate-800); color: var(--slate-300); }
.wf-btn.secondary:hover { background: var(--slate-700); color: white; }

/* Actions Grid */
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action-tile { background: var(--slate-900); border: 1px solid var(--slate-800); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: 0.2s; color: var(--slate-400); }
.action-tile:hover { background: var(--slate-800); color: white; border-color: var(--slate-700); }
.action-tile .material-symbols-rounded { font-size: 20px; }
.action-label { font-family: var(--font-body, sans-serif); font-size: 12px; font-weight: 500; }
.action-tile.danger:hover { background: rgba(239, 68, 68, 0.1); color: var(--red-500); border-color: rgba(239, 68, 68, 0.2); }

/* ICONS */
.icon-btn {
  background: transparent; border: none; color: var(--slate-400); padding: 8px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.icon-btn:hover { background-color: var(--slate-800); color: white; }
.icon-btn.active { background-color: var(--slate-800); color: var(--blue-500); }