/* UX1 — 3-column workspace */

:root {
  --header-h: 56px;
  --col-side: 420px;
}

* { box-sizing: border-box; }

/* Sticky header */
.app-header--v2 {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--cobalt-900);
  color: white;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}
.app-header__brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}
.app-header__brand h1 {
  font-size: 20px;
  margin: 0;
  white-space: nowrap;
}
.app-header__brand .accent { color: var(--canary-500); }
.app-header__brand .subtitle {
  margin: 0;
  font-size: 12px;
  opacity: 0.75;
  white-space: nowrap;
}
.app-header__actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.app-header__actions .btn {
  background: rgba(255, 255, 255, 0.10);
  color: white;
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: none;
  padding: 4px 12px;
  font-size: 12px;
}
.app-header__actions .btn:hover {
  background: rgba(255, 255, 255, 0.20);
  transform: none;
  box-shadow: none;
}

/* Workspace grid */
.workspace {
  display: grid;
  grid-template-columns: var(--col-side) minmax(0, 1fr) var(--col-side);
  gap: 16px;
  padding: 16px;
  max-width: 1700px;
  margin: 0 auto;
  align-items: start;
}

body > .app-main { display: none !important; }

/* Zones */
.zone {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.zone__head {
  position: sticky;
  top: var(--header-h);
  z-index: 5;
  background: var(--bg);
  padding: 8px 4px;
  margin: 0;
  border-bottom: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.zone__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.zone__detach {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 100ms, color 100ms, border-color 100ms;
}
.zone__detach:hover {
  background: var(--cobalt-100);
  color: var(--cobalt-700);
  border-color: var(--cobalt-500);
}

/* Single-view mode: opened with ?view=X, only that zone is visible full-width */
body.single-view .stepper,
body.single-view .zone__detach { display: none; }
body.single-view .workspace {
  grid-template-columns: 1fr;
  max-width: 1100px;
}
body.single-view .zone { grid-column: 1 !important; grid-row: 1 !important; }
body[data-view="setup"]    .zone--analyse,
body[data-view="setup"]    .zone--review,
body[data-view="analyse"]  .zone--setup,
body[data-view="analyse"]  .zone--review,
body[data-view="review"]   .zone--setup,
body[data-view="review"]   .zone--analyse,
body[data-view="picker"]   .zone--analyse,
body[data-view="picker"]   .zone--review { display: none !important; }
/* Picker-only view: inside the Setup zone, hide table + slots panels */
body[data-view="picker"] .zone--setup .panel:not(.panel--picker) { display: none !important; }
body[data-view="picker"] .panel--picker .card-picker { gap: 4px; }
body[data-view="picker"] .panel--picker .card-picker .card { height: 56px; }
body[data-view="picker"] .panel--picker .card-picker .card__rank { font-size: 16px; }
body[data-view="picker"] .panel--picker .card-picker .card__suit { font-size: 18px; }

body.single-view .zone__head { top: var(--header-h); }
body.single-view .app-header__brand .subtitle::after {
  content: ' · vue détachée';
  color: var(--canary-500);
  margin-left: 4px;
}

/* Panel head — for panels that have their own detach button (e.g. picker) */
.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.panel__head .panel__title { margin: 0; }
.zone--setup    .zone__icon { color: #2b5fbf; }
.zone--analyse  .zone__icon { color: #f7c046; }
.zone--review   .zone__icon { color: #1e7a3a; }
.zone__icon { font-size: 14px; line-height: 1; font-style: normal; }
.zone__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* Panel = section wrapper (NOT .card, which is reserved for playing cards) */
.panel {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 2px 2px 0 rgba(10, 37, 64, 0.08);
  border: 1px solid var(--border);
  padding: 14px 16px;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel > * { min-width: 0; max-width: 100%; }
.panel--prominent {
  border: 2px solid var(--cobalt-700);
  box-shadow: 4px 4px 0 rgba(10, 37, 64, 0.12);
}
.panel--picker { padding: 10px 12px; }
.panel__title {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0;
}
.panel__hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

/* Neutralize legacy .section-card inside .panel */
.panel .section-card {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  border: none;
  width: 100%;
}
.panel .section-card h2 {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

/* ============================
   SETUP zone — compaction
   ============================ */

/* Compact card picker (cells smaller, fit in 380-400px column inner) */
.zone--setup .card-picker {
  gap: 2px;
  display: grid;
  grid-template-columns: repeat(13, 1fr);
}
.zone--setup .card-picker .card {
  border-width: 1px;
  border-radius: 3px;
  padding: 2px 3px;
  box-shadow: none;
  width: 100%;
  height: 34px;
  aspect-ratio: unset;
  min-height: 0;
}
.zone--setup .card-picker .card:hover {
  transform: none;
  box-shadow: 0 0 0 2px var(--canary-500);
  z-index: 1;
}
.zone--setup .card-picker .card__rank { font-size: 11px; line-height: 1; }
.zone--setup .card-picker .card__suit { font-size: 11px; line-height: 1; }

/* Slots */
.zone--setup .slots { gap: 8px; }
.zone--setup .slot-group { gap: 8px; align-items: center; }
.zone--setup .slot-group__label { width: 50px; font-size: 11px; flex-shrink: 0; }
.zone--setup .slot-group__cards { gap: 6px; flex-wrap: wrap; }
.zone--setup .slot-group__cards .card,
.zone--setup .slot-group__cards .slot {
  width: 38px;
  height: 54px;
  flex-shrink: 0;
}
.zone--setup .slot-group__cards .card__rank { font-size: 14px; }
.zone--setup .slot-group__cards .card__suit { font-size: 16px; }

/* Table SVG */
.zone--setup .table-wrapper {
  padding: 0;
  border: none;
  background: transparent;
}
.zone--setup .poker-table { max-width: 100%; height: auto; display: block; }

/* Seat controls */
.zone--setup .seat-controls { gap: 8px; }
.zone--setup .seat-quick { flex-wrap: wrap; gap: 4px; }
.zone--setup .seat-quick .btn { padding: 4px 10px; font-size: 11px; }
.zone--setup .seat-slider { gap: 8px; font-size: 12px; }
.zone--setup .seat-slider__value { min-width: 64px; font-size: 12px; }
.zone--setup .hero-select { flex-wrap: wrap; gap: 6px; }
.zone--setup .hero-select__dropdown { font-size: 12px; max-width: 100%; }

/* ============================
   ANALYSE zone
   ============================ */

.panel--prominent .results__overall-pct { font-size: 38px; }

.zone--analyse .range-grid { max-width: 100%; }
.zone--analyse .villain-panel { gap: 10px; }
.zone--analyse .preset-bar { flex-wrap: wrap; gap: 4px; }
.zone--analyse .range-cell { font-size: 9px; }

.zone--analyse .actions-stats { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.zone--analyse .actions-form__row { grid-template-columns: 1fr 1.4fr 0.8fr; gap: 6px; }
.zone--analyse .actions-form__buttons .action-type-btn { min-width: 50px; font-size: 11px; padding: 4px 6px; }
.zone--analyse .timeline-item { grid-template-columns: 70px 1fr; font-size: 12px; }

/* ============================
   REVIEW zone
   ============================ */

.zone--review .hand-result__row {
  grid-template-columns: 1fr;
  gap: 8px;
}
.zone--review .outcomes { gap: 4px; }
.zone--review .outcome-radio { padding: 3px 8px; font-size: 12px; }
.zone--review .amount-field__input { width: 100%; }

.zone--review .session-panel__header { gap: 8px; flex-direction: column; align-items: flex-start; }
.zone--review .session-panel__actions { gap: 4px; flex-wrap: wrap; }
.zone--review .session-panel__actions .btn { padding: 4px 10px; font-size: 11px; }
.zone--review .session-label-input { min-width: 0; width: 100%; }
.zone--review .session-stats { grid-template-columns: 1fr 1fr; gap: 6px; }
.zone--review .hands-table { font-size: 11px; }
.zone--review .hands-table th, .zone--review .hands-table td { padding: 4px; }

.zone--review .history-panel { padding: 0; box-shadow: none; border: none; }
.zone--review .history-panel h2 { display: none; }
.zone--review .history-actions { gap: 4px; flex-wrap: wrap; }
.zone--review .history-actions .btn { padding: 3px 8px; font-size: 11px; }
.zone--review .history-stats { grid-template-columns: 1fr 1fr; gap: 6px; }
.zone--review .history-filters { gap: 8px; padding: 6px 8px; flex-wrap: wrap; }
.zone--review .history-item { grid-template-columns: 1fr; gap: 6px; }
.zone--review .history-item__actions { justify-self: start; }

/* Collapsible panel */
.collapsible { padding: 0; gap: 0; }
.collapsible__toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-align: left;
}
.collapsible__toggle:hover { background: var(--cobalt-100); }
.collapsible__chev {
  transition: transform 120ms ease;
  color: var(--cobalt-700);
}
.collapsible[data-collapsed="false"] .collapsible__chev { transform: rotate(180deg); }
.collapsible__content {
  padding: 0 16px 16px;
  display: block;
}
.collapsible[data-collapsed="true"] .collapsible__content { display: none; }

/* ============================
   Responsive
   ============================ */

@media (max-width: 1400px) {
  :root { --col-side: 380px; }
  .workspace {
    grid-template-columns: var(--col-side) minmax(0, 1fr);
    grid-template-rows: auto auto;
  }
  .zone--setup    { grid-column: 1; grid-row: 1; }
  .zone--analyse  { grid-column: 2; grid-row: 1; }
  .zone--review   { grid-column: 1 / -1; grid-row: 2; }
  .zone--review .zone__body {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
  }
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .zone--setup, .zone--analyse, .zone--review {
    grid-column: 1;
    grid-row: auto;
  }
  .zone--review .zone__body { grid-template-columns: 1fr; }
  .zone__head { position: static; }
}
