/* ============================================================
   QuoteStation — Station Screen
   ============================================================ */

/* ─── Layout ─── */
.station {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--color-bg);
}

.station-main {
  display: grid;
  grid-template-columns: 1fr 380px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ─── Top Bar ─── */
.station-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  z-index: var(--z-topbar);
}

.station-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  margin: 0 calc(-1 * var(--space-2));
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  transition: color var(--duration-feedback) var(--ease-out),
              background var(--duration-feedback) var(--ease-out);
}

.station-breadcrumb:hover        { color: var(--color-text); background: var(--color-accent-ghost); }
.station-breadcrumb:active       { background: var(--color-accent-subtle); }
.station-breadcrumb:focus-visible { outline: none; box-shadow: var(--shadow-ring); }
.station-breadcrumb-arrow        { font-size: var(--text-xs); }

/* ─── Progress ─── */
.station-progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.station-progress-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.station-progress-dots { display: flex; gap: 4px; align-items: center; }

.progress-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background var(--duration-feedback) var(--ease-out),
              transform var(--duration-feedback) var(--ease-out);
}

.progress-dot.current { background: var(--color-accent); transform: scale(1.4); }
.progress-dot.quoted  { background: var(--color-success); }
.progress-dot.skipped { background: var(--color-danger); }

.station-progress-compact { display: flex; align-items: center; gap: var(--space-2); }

.progress-bar-track {
  width: 120px;
  height: 5px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;
  transition: width var(--duration-reveal) var(--ease-out);
}

/* ─── View Mode Switcher (segmented control) ─── */
.station-view-switcher {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-mode-btn {
  padding: 5px 12px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background: var(--color-kbd-bg);
  color: var(--color-text-secondary);
  border: none;
  cursor: pointer;
  transition: background var(--duration-feedback) var(--ease-out),
              color var(--duration-feedback) var(--ease-out);
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.view-mode-btn + .view-mode-btn {
  border-left: 1px solid var(--color-border);
}

.view-mode-btn.active {
  background: var(--color-accent);
  color: #fff;
}

.view-mode-btn:hover:not(.active) {
  background: var(--color-accent-ghost);
  color: var(--color-accent);
}

/* ─── Viewer Column (viewer + keyboard bar stacked) ─── */
.station-viewer-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--color-border);
  min-height: 0;
}

/* ─── Viewer Panel ─── */
.station-viewer {
  position: relative;
  background: var(--color-surface);
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.station-viewer canvas { display: block; width: 100%; height: 100%; }

.station-drawing {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--color-surface);
}

.station-drawing img         { max-width: 90%; max-height: 90%; object-fit: contain; }
.station-drawing-empty       { font-size: var(--text-sm); color: var(--color-text-tertiary); }

.station-drawing-2d {
  width: 100%;
  height: 100%;
  background: #f8fafc;
  overflow: hidden;
}

/* Fade in when switching views */
.station-viewer canvas,
.station-drawing-2d {
  animation: viewFadeIn var(--duration-reveal) var(--ease-out);
}

@keyframes viewFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.station-viewer.flash-quote  { animation: flash-green var(--duration-reveal) var(--ease-out); }
.station-viewer.flash-skip   { animation: flash-red var(--duration-reveal) var(--ease-out); }

/* ─── Viewer Nav Arrows ─── */
.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  opacity: 0.8;
  transition: opacity var(--duration-feedback) var(--ease-out),
              box-shadow var(--duration-feedback) var(--ease-out);
}

.viewer-nav:hover        { opacity: 1; box-shadow: 0 2px 8px rgba(0,0,0,0.12); color: var(--color-accent); }
.viewer-nav:active       { background: var(--color-accent-subtle); }
.viewer-nav:focus-visible { outline: none; box-shadow: var(--shadow-ring); }
.viewer-nav.disabled     { opacity: 0.25; pointer-events: none; }
.viewer-nav-prev         { left: var(--space-3); }
.viewer-nav-next         { right: var(--space-3); }

/* ─── Brief Panel ─── */
.station-brief {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: var(--space-4) var(--space-4);
  gap: var(--space-3);
  background: var(--color-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.brief-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.brief-traffic-light           { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.brief-traffic-light.green     { background: var(--color-success); }
.brief-traffic-light.yellow    { background: var(--color-warning); }
.brief-traffic-light.red       { background: var(--color-danger); }

.brief-part-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  letter-spacing: -0.01em;
}

/* ─── Completeness Bar: prominent horizontal progress ─── */
.brief-completeness {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.completeness-bar {
  flex: unset;
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.completeness-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--duration-reveal) var(--ease-out);
}

.completeness-fill.complete    { background: var(--color-success); }
.completeness-fill.incomplete  { background: var(--color-warning); }

.completeness-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* ─── Field Rows: cards ─── */
.brief-section            { margin-bottom: var(--space-2); }

.brief-section-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
  padding-left: var(--space-1);
}

.brief-field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  min-height: 48px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  border-left: 3px solid transparent;
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-feedback) var(--ease-out),
              border-left-color var(--duration-feedback) var(--ease-out),
              background var(--duration-feedback) var(--ease-out);
}

.brief-field.flash-required { animation: flash-required 0.3s ease-out 2; }

/* Required + empty → red left border + subtle red bg */
.brief-field:has(.brief-field-dot.required.empty) {
  border-left-color: var(--color-danger);
  background: var(--color-danger-subtle);
}

/* Required + filled → green left border */
.brief-field:has(.brief-field-dot.required.filled) {
  border-left-color: var(--color-success);
}

.brief-field-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.brief-field-dot.required.empty  {
  background: var(--color-danger);
  box-shadow: 0 0 0 2px var(--color-danger-subtle);
  animation: pulse-dot 2s ease-in-out infinite;
}

.brief-field-dot.required.filled { background: var(--color-success); }
.brief-field-dot.optional.empty  { background: transparent; border: 1.5px solid var(--color-border); }
.brief-field-dot.optional.filled { background: var(--color-text-tertiary); }

.brief-field-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  min-width: 72px;
  flex-shrink: 0;
}

.brief-field-value               { font-size: var(--text-sm); color: var(--color-text); font-weight: var(--weight-medium); flex: 1; }
.brief-field-value.empty         { color: var(--color-text-tertiary); font-weight: var(--weight-normal); }
.brief-field-value.overridden    { color: var(--color-accent); }

.brief-source {
  font-size: 10px;
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  background: var(--color-bg);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}

.brief-source.manual { color: var(--color-accent); background: var(--color-accent-ghost); }

/* ─── Cost Table ─── */
.brief-cost-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.brief-cost-table th,
.brief-cost-table td { padding: var(--space-1) 0; font-size: var(--text-xs); text-align: left; }
.brief-cost-table th { color: var(--color-text-tertiary); font-weight: var(--weight-normal); }
.brief-cost-table td { color: var(--color-text); text-align: right; }
.brief-cost-table tr.total { border-top: 1px solid var(--color-border); }
.brief-cost-table tr.total td { font-weight: var(--weight-semibold); padding-top: var(--space-2); }

.brief-cost-placeholder {
  padding: var(--space-4) var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* ─── Risk / Action Lists ─── */
.brief-risk-list,
.brief-action-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.brief-risk-item,
.brief-action-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  padding: var(--space-1) 0;
}

.brief-risk-icon   { color: var(--color-warning); flex-shrink: 0; margin-top: 1px; }
.brief-action-icon { color: var(--color-accent);  flex-shrink: 0; margin-top: 1px; }


/* ═══════════════════════════════════════════════════════════
   FLOATING COMMAND BAR — Raycast desktop feel
   Centered in the viewer panel, glass + blur, floating pill
   ═══════════════════════════════════════════════════════════ */

.station-palette {
  position: fixed;
  /* Center in the viewer panel (100vw - 380px brief) */
  left: calc((100vw - 380px) / 2);
  transform: translateX(-50%);
  bottom: calc(40px + var(--space-5));   /* above keyboard bar */
  width: min(520px, calc(100vw - 380px - var(--space-8)));
  z-index: var(--z-palette);
}

.palette-container {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 22px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px  rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  overflow: hidden;
  transition: border-color var(--duration-feedback) var(--ease-out),
              box-shadow var(--duration-feedback) var(--ease-out),
              transform var(--duration-feedback) var(--ease-out);
}

.palette-container.focused {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow:
    0 12px 44px rgba(99, 102, 241, 0.18),
    0 4px 14px  rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
}

.palette-input-row {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  gap: var(--space-3);
}

.palette-slash {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  opacity: 0.6;
}

.palette-container.focused .palette-slash { opacity: 1; }

.palette-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  background: transparent;
  caret-color: var(--color-accent);
}

.palette-input::placeholder { color: var(--color-text-tertiary); font-weight: var(--weight-normal); }

.palette-kbd { transition: opacity var(--duration-feedback) var(--ease-out); }
.palette-container.focused .palette-kbd { opacity: 0; }

.palette-hints {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-1) var(--space-4) var(--space-3);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.palette-hint-tag {
  font-size: 11px;
  font-weight: var(--weight-medium);
  color: var(--color-text-tertiary);
  padding: 3px var(--space-2);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  transition: color var(--duration-feedback) var(--ease-out),
              background var(--duration-feedback) var(--ease-out);
}

.palette-hint-tag.matched   {
  color: #fff;
  background: var(--color-accent);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
}
.palette-hint-tag.has-value {
  color: var(--color-success);
  background: var(--color-success-subtle);
}

.palette-feedback {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-success);
  opacity: 0;
  transition: opacity var(--duration-reveal) var(--ease-out);
}

.palette-feedback.visible { opacity: 1; }

.palette-spinner {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.palette-confirm {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  background: var(--color-warning-subtle);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.palette-confirm strong { color: var(--color-text); }


/* ─── Action Buttons ─── */
.station-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-feedback) var(--ease-out);
}

.action-btn-quote {
  color: #fff;
  background: var(--color-success);
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.30);
}
.action-btn-quote:hover        { background: #16a34a; box-shadow: 0 3px 10px rgba(34,197,94,0.35); }
.action-btn-quote:active       { transform: scale(0.97); box-shadow: none; }
.action-btn-quote:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--color-success); }
.action-btn-quote.blocked      { opacity: 0.4; pointer-events: none; }

.action-btn-skip {
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
}
.action-btn-skip:hover         { color: var(--color-danger); border-color: var(--color-danger); background: var(--color-danger-subtle); }
.action-btn-skip:active        { transform: scale(0.97); }
.action-btn-skip:focus-visible  { outline: none; box-shadow: 0 0 0 2px var(--color-danger); }

/* ─── Keyboard Bar (inside viewer-col, aligns with viewer width) ─── */
.station-keyboard-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  height: 40px;
  min-height: 40px;
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.keyboard-hint-warning {
  color: var(--color-danger);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

/* ── Upload zone ─────────────────────────────────── */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2.5rem 1.5rem;
  border: 2px dashed var(--color-border, #555);
  border-radius: var(--radius-lg, 12px);
  background: var(--color-surface, #1a1a1a);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  text-align: center;
}
.upload-zone.drag-over {
  border-color: var(--color-accent, #6c8cff);
  background: color-mix(in srgb, var(--color-accent, #6c8cff) 8%, transparent);
}
.upload-icon {
  font-size: 2rem;
  line-height: 1;
}
.upload-text {
  font-size: var(--text-sm, 0.875rem);
  color: var(--color-muted, #999);
}
.upload-btn {
  padding: 0.5rem 1.25rem;
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--weight-medium, 500);
  border: 1px solid var(--color-border, #555);
  border-radius: var(--radius-md, 8px);
  background: var(--color-surface, #1a1a1a);
  color: var(--color-text, #eee);
  cursor: pointer;
  transition: background 0.15s;
}
.upload-btn:hover {
  background: var(--color-surface-hover, #252525);
}
.upload-filename {
  font-size: var(--text-sm, 0.875rem);
  min-height: 1.25em;
}
.upload-filename.upload-success {
  color: var(--color-success, #4caf50);
}
.upload-filename.upload-error {
  color: var(--color-danger, #ef4444);
}
.upload-size {
  color: var(--color-muted, #999);
}
