/**
 * Hardware Planner - Industrial Control Panel Design
 * Fixed-height panels, no layout shift, symmetrical grid
 */

/* ============================================
   Font Import - JetBrains Mono for technical feel
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ============================================
   CSS Variables
   ============================================ */
.planner-tool {
  --pl-font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  --pl-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Colors - Subtle dark, blends with background */
  --pl-bg: transparent;
  --pl-surface: rgba(255, 255, 255, 0.02);
  --pl-surface-raised: rgba(255, 255, 255, 0.03);
  --pl-border: rgba(255, 255, 255, 0.08);
  --pl-border-light: rgba(255, 255, 255, 0.05);

  --pl-text: #e0e0e0;
  --pl-text-muted: #9e9e9e;
  --pl-text-faint: #616161;

  /* Accent colors */
  --pl-accent: #00d4ff;
  --pl-accent-dim: rgba(0, 212, 255, 0.06);
  --pl-green: #00e676;
  --pl-green-dim: rgba(0, 230, 118, 0.06);
  --pl-yellow: #ffab00;
  --pl-yellow-dim: rgba(255, 171, 0, 0.06);
  --pl-purple: #b388ff;

  /* Resolution colors */
  --pl-res-1080: #00e676;
  --pl-res-1440: #ffab00;
  --pl-res-4k: #b388ff;

  /* Spacing */
  --pl-gap: 12px;
  --pl-radius: 6px;

  /* Fixed heights */
  --pl-panel-header: 36px;
}

/* Light mode overrides */
[data-md-color-scheme="default"] .planner-tool {
  --pl-bg: #f6f8fa;
  --pl-surface: #ffffff;
  --pl-surface-raised: #f6f8fa;
  --pl-border: #d0d7de;
  --pl-border-light: #d8dee4;
  --pl-text: #1f2328;
  --pl-text-muted: #656d76;
  --pl-text-faint: #8c959f;
  --pl-accent: #0969da;
  --pl-accent-dim: rgba(9, 105, 218, 0.1);
  --pl-green: #1a7f37;
  --pl-green-dim: rgba(26, 127, 55, 0.1);
  --pl-yellow: #9a6700;
  --pl-yellow-dim: rgba(154, 103, 0, 0.1);
  --pl-purple: #8250df;
  --pl-res-1080: #1a7f37;
  --pl-res-1440: #9a6700;
  --pl-res-4k: #8250df;
}

/* ============================================
   Main Container
   ============================================ */
.planner-tool {
  font-family: var(--pl-font-sans);
  background: var(--pl-bg);
  border: 1px solid var(--pl-border);
  border-radius: 8px;
  overflow: hidden;
  margin: 1rem 0;
}

/* ============================================
   Toolbar
   ============================================ */
.planner-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--pl-surface);
  border-bottom: 1px solid var(--pl-border);
}

.toolbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--pl-font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--pl-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toolbar-icon {
  font-size: 14px;
  opacity: 0.7;
}

.tool-btn {
  font-family: var(--pl-font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  background: var(--pl-surface-raised);
  border: 1px solid var(--pl-border);
  border-radius: 4px;
  color: var(--pl-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: var(--pl-accent-dim);
  border-color: var(--pl-accent);
  color: var(--pl-accent);
}

/* ============================================
   Grid Layout
   ============================================ */
.planner-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: var(--pl-gap);
  padding: var(--pl-gap);
  background: var(--pl-bg);
}

.planner-column {
  display: flex;
  flex-direction: column;
  gap: var(--pl-gap);
}

.panel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--pl-gap);
}

/* ============================================
   Panels - Base
   ============================================ */
.panel {
  background: var(--pl-surface);
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--pl-panel-header);
  padding: 0 12px;
  background: var(--pl-surface-raised);
  border-bottom: 1px solid var(--pl-border-light);
}

.panel-number {
  font-family: var(--pl-font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--pl-accent);
  background: var(--pl-accent-dim);
  padding: 2px 6px;
  border-radius: 3px;
}

.panel-title {
  font-family: var(--pl-font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--pl-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.panel-status {
  margin-left: auto;
  font-size: 8px;
  color: var(--pl-text-faint);
  transition: color 0.3s ease;
}

.panel-status.active {
  color: var(--pl-green);
}

/* Multi-select counter */
.panel-counter {
  margin-left: auto;
  font-family: var(--pl-font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--pl-surface);
  border: 1px dashed var(--pl-border);
  border-radius: 10px;
  color: var(--pl-text-faint);
  transition: all 0.2s ease;
}

.panel-counter.has-selection {
  background: var(--pl-green-dim);
  border: 1px solid var(--pl-green);
  color: var(--pl-green);
}

/* Multi-select panel indicator */
.panel.multi-select .panel-number {
  position: relative;
}

.panel.multi-select .panel-number::after {
  content: "+";
  font-size: 8px;
  margin-left: 1px;
  opacity: 0.7;
}

/* Select All button */
.select-all-btn {
  font-family: var(--pl-font-mono);
  font-size: 9px;
  font-weight: 500;
  padding: 2px 8px;
  background: transparent;
  border: 1px dashed var(--pl-border);
  border-radius: 3px;
  color: var(--pl-text-faint);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: auto;
}

.select-all-btn:hover {
  background: var(--pl-accent-dim);
  border-color: var(--pl-accent);
  border-style: solid;
  color: var(--pl-accent);
}

.select-all-btn.all-selected {
  background: var(--pl-green-dim);
  border-color: var(--pl-green);
  border-style: solid;
  color: var(--pl-green);
}

.panel-counter {
  margin-left: 8px;
}

.panel-body {
  padding: 12px;
}

/* ============================================
   Chip Inputs
   ============================================ */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--pl-surface-raised);
  border: 1px solid var(--pl-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.chip input {
  display: none;
}

.chip span {
  font-family: var(--pl-font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--pl-text-muted);
  transition: color 0.15s ease;
}

.chip:hover {
  border-color: var(--pl-text-faint);
}

.chip:has(input:checked) {
  background: var(--pl-green-dim);
  border-color: var(--pl-green);
}

.chip:has(input:checked) span {
  color: var(--pl-green);
}

.chip.has-tag em {
  font-style: normal;
  font-family: var(--pl-font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  background: var(--pl-yellow-dim);
  color: var(--pl-yellow);
  border-radius: 2px;
  margin-left: 2px;
}

/* ============================================
   Segment Inputs
   ============================================ */
.segment-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.seg {
  flex: 1;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  background: var(--pl-surface-raised);
  border: 1px solid var(--pl-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.seg input {
  display: none;
}

.seg span {
  font-family: var(--pl-font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--pl-text-muted);
  transition: color 0.15s ease;
}

.seg:hover {
  border-color: var(--pl-text-faint);
}

.seg:has(input:checked) {
  background: var(--pl-accent);
  border-color: var(--pl-accent);
}

.seg:has(input:checked) span {
  color: #fff;
}

/* ============================================
   Result Panels - Fixed Heights
   ============================================ */
.result-panel {
  border-color: var(--pl-border);
}

.result-panel .panel-header {
  background: var(--pl-surface);
}

.result-body {
  min-height: 80px;
}

/* Resolution Panel */
#panel-resolution .result-body {
  min-height: 100px;
}

.result-display {
  text-align: center;
}

.result-value {
  font-family: var(--pl-font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--pl-text-faint);
  margin-bottom: 12px;
  transition: color 0.3s ease;
}

.result-value.active {
  color: var(--pl-text);
}

.result-value.res-1080p { color: var(--pl-res-1080); }
.result-value.res-1440p { color: var(--pl-res-1440); }
.result-value.res-4k { color: var(--pl-res-4k); }

/* Resolution Bar */
.result-bar {
  max-width: 240px;
  margin: 0 auto;
}

.bar-track {
  height: 6px;
  background: var(--pl-border);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.4s ease, background 0.3s ease;
}

.bar-fill.res-1080p {
  width: 33%;
  background: var(--pl-res-1080);
}

.bar-fill.res-1440p {
  width: 66%;
  background: var(--pl-res-1440);
}

.bar-fill.res-4k {
  width: 100%;
  background: var(--pl-res-4k);
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.bar-labels span {
  font-family: var(--pl-font-mono);
  font-size: 9px;
  color: var(--pl-text-faint);
}

.result-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--pl-text-muted);
  text-align: center;
}

.result-note:empty {
  display: none;
}

/* ============================================
   Capture Panel - Show All Cards
   ============================================ */
.capture-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  font-family: var(--pl-font-mono);
  font-size: 11px;
  color: var(--pl-text-faint);
}

.capture-results:not(:empty) + .capture-placeholder,
.capture-results:empty {
  display: none;
}

.capture-results:not(:empty) ~ .capture-placeholder {
  display: none;
}

/* Capture card groups */
.capture-results .capture-group {
  margin-bottom: 10px;
  padding: 8px;
  background: var(--pl-surface-raised);
  border: 1px solid var(--pl-border-light);
  border-radius: 4px;
}

.capture-results .capture-group:last-child {
  margin-bottom: 0;
}

.capture-results .capture-group.disabled {
  opacity: 0.5;
}

.capture-results .capture-group-header {
  font-family: var(--pl-font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--pl-text-muted);
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--pl-border-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.capture-results .group-badge {
  font-size: 8px;
  padding: 2px 5px;
  background: var(--pl-green-dim);
  color: var(--pl-green);
  border-radius: 2px;
  margin-left: auto;
}

.capture-results .capture-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 11px;
  border-bottom: 1px dashed var(--pl-border-light);
  overflow: hidden;
}

.capture-results .capture-item:last-child {
  border-bottom: none;
}

.capture-results .capture-name {
  flex: 1;
  min-width: 0;
  font-family: var(--pl-font-mono);
  font-size: 10px;
  color: var(--pl-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.capture-results .capture-badge {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--pl-green);
}

.capture-results .capture-price {
  flex-shrink: 0;
  font-family: var(--pl-font-mono);
  font-size: 10px;
  color: var(--pl-yellow);
}

.capture-results .capture-res-badge {
  flex-shrink: 0;
  font-family: var(--pl-font-mono);
  font-size: 8px;
  padding: 2px 4px;
  border-radius: 2px;
  background: var(--pl-surface);
  color: var(--pl-text-muted);
}

.capture-results .capture-res-badge.res-4k {
  background: rgba(163, 113, 247, 0.15);
  color: var(--pl-res-4k);
}

.capture-results .capture-res-badge.res-1440p {
  background: var(--pl-yellow-dim);
  color: var(--pl-res-1440);
}

.capture-results .capture-res-badge.res-1080p {
  background: var(--pl-green-dim);
  color: var(--pl-res-1080);
}

/* Unsupported cards - strikethrough and dimmed */
.capture-results .capture-item.unsupported {
  opacity: 0.4;
}

.capture-results .capture-item.unsupported .capture-name {
  text-decoration: line-through;
}

.capture-results .capture-item.unsupported .capture-price,
.capture-results .capture-item.unsupported .capture-res-badge {
  opacity: 0.6;
}

/* ============================================
   Shopping Panel - Full Width Footer
   ============================================ */
.planner-footer {
  padding: 0 var(--pl-gap) var(--pl-gap);
}

.shopping-panel {
  width: 100%;
}

.copy-btn {
  margin-left: auto;
  font-family: var(--pl-font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--pl-border);
  border-radius: 3px;
  color: var(--pl-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background: var(--pl-accent-dim);
  border-color: var(--pl-accent);
  color: var(--pl-accent);
}

.shopping-row-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.shop-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 8px;
  background: var(--pl-surface-raised);
  border-radius: 4px;
  gap: 4px;
}

.shop-icon {
  font-size: 16px;
  opacity: 0.7;
}

.shop-label {
  font-family: var(--pl-font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--pl-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.shop-value {
  font-family: var(--pl-font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--pl-text);
  line-height: 1.3;
}

.shop-note {
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--pl-accent-dim);
  border-radius: 4px;
  font-family: var(--pl-font-mono);
  font-size: 10px;
  color: var(--pl-accent);
  text-align: center;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .planner-grid {
    grid-template-columns: 1fr;
  }

  .panel-row {
    grid-template-columns: 1fr;
  }

  .segment-row {
    flex-wrap: wrap;
  }

  .seg {
    min-width: 38px;
  }

  .shopping-row-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

