/* Logbook — dark predictor theme. Filtres, stats, table, cartes. */

/* Le logbook a besoin de plus de largeur que la grille standard */
.site-main:has(.logbook),
.container.site-main:has(.logbook) {
  --max-width: 1600px;
  max-width: 1600px;
  width: 100%;
}

.logbook h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 6px;
}

.logbook-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 14px;
  text-transform: uppercase;
}
.logbook-meta b { color: var(--accent); font-weight: 500; }
.logbook-meta .err { color: var(--red); }

/* ── Stats bar ─────────────────────────────────────────────── */
.logbook-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  margin-bottom: 16px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.logbook-stats .stat {
  background: var(--panel);
  padding: 14px 16px;
}
.logbook-stats .lbl {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.logbook-stats .val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.1;
}

/* ── Toolbar (filtres) ────────────────────────────────────── */
.logbook-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  margin: 16px 0;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
}
.logbook-toolbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}
.logbook-toolbar .field { display: flex; flex-direction: column; gap: 4px; }
.logbook-toolbar label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin: 0;
}
.logbook-toolbar input,
.logbook-toolbar select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.logbook-toolbar input:focus,
.logbook-toolbar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), inset 0 0 12px var(--input-glow);
  background: var(--bg-2);
}
.logbook-toolbar select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%234d9eff' stroke-width='1.5' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.logbook-toolbar .check-row {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  cursor: pointer;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  user-select: none;
  transition: border-color 0.15s, color 0.15s;
}
.logbook-toolbar .check-row:hover { border-color: var(--border-strong); color: var(--text); }
.logbook-toolbar .check-row input[type="checkbox"] {
  appearance: none;
  width: 14px; height: 14px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}
.logbook-toolbar .check-row input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.logbook-toolbar .check-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 1px; left: 4px;
  width: 4px; height: 8px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.logbook-toolbar .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.logbook-toolbar button {
  padding: 8px 14px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}
.logbook-toolbar button:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 0 16px var(--button-glow);
}
.logbook-toolbar button:disabled {
  background: var(--border-strong);
  color: var(--text-muted);
  cursor: not-allowed;
}
.logbook-toolbar button.ghost {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.14em;
  padding: 7px 12px;
}
.logbook-toolbar button.ghost:hover:not(:disabled) {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  box-shadow: none;
}

/* ── Table QSO ─────────────────────────────────────────────── */
.qso-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  max-height: 720px;
  overflow-y: auto;
}
.qso-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.qso-table th {
  padding: 11px 12px;
  text-align: left;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  position: sticky;
  top: 0;
  white-space: nowrap;
  z-index: 5;
}
.qso-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--td-border);
  color: var(--text);
  white-space: nowrap;
}
.qso-table tbody tr {
  transition: background 0.1s;
}
.qso-table tbody tr:hover { background: var(--row-hover); }
.qso-table tbody tr:nth-child(even) { background: var(--row-stripe); }
.qso-table tbody tr:nth-child(even):hover { background: var(--row-hover); }
.qso-table .qso-call { color: var(--accent); font-weight: 600; }
.qso-table .qso-mycall { color: var(--green); font-weight: 600; }
.qso-table .qso-mygrid { color: var(--green); }
.qso-table .qso-band { color: var(--cyan); }
.qso-table .qso-mode { color: var(--text-dim); }
.qso-table .qso-grid { color: var(--text-dim); }
.qso-table .qso-sat { color: var(--green); font-weight: 500; }
.qso-table .qso-lotw { color: var(--green); font-weight: 700; text-align: center; }
.qso-table .num { text-align: right; }

/* ── Empty state ───────────────────────────────────────────── */
.logbook-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.logbook-empty p { margin: 4px 0; }
.logbook-empty code {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
}

/* ── Cartes ────────────────────────────────────────────────── */
.logbook-maps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin: 22px 0;
}
.map-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.map-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}
.map-card .map-head {
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}
.map-card .map-head b { color: var(--accent); font-weight: 500; }
.map-card .map-head .meta {
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.1em;
}
.map-card svg {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
  background: var(--bg);
}
.map-card svg.dragging { cursor: grabbing; }
.map-card .legend {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--panel-2);
}
.map-card .legend .swatch {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 2px;
  vertical-align: -2px;
  margin-right: 4px;
  border: 1px solid var(--swatch-border);
}

.map-card .map-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.map-card .map-fs {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 9px;
  border-radius: 2px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  font-family: var(--font-mono);
  transition: all 0.15s;
}
.map-card .map-fs:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Fullscreen */
.map-card:fullscreen { background: var(--bg); padding: 0; }
.map-card:-webkit-full-screen { background: var(--bg); padding: 0; }
.map-card:fullscreen svg,
.map-card:-webkit-full-screen svg {
  width: 100vw;
  height: calc(100vh - 76px);
}
.map-card:fullscreen .map-fs::after,
.map-card:-webkit-full-screen .map-fs::after { content: ' Esc'; }
