/* ═══════════════════════════════════════════════════════════════
   Shared stylesheet for Primorsko "personal scorecard" pages
   (pairs events — MP or IMP/Butler scoring, single or multi-section).
   Used by every Primorsko/<year>/DD-MM-YYYY[-suffix]-Personal-scorecards.html
   Do not fork this file per event — put event differences in the
   page's own small CONFIG block instead (see pairs-scorecard.js).
   ═══════════════════════════════════════════════════════════════ */

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #26354a;
  color: #333;
}

/* ── Header ── */
header {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
}
header img { width: 120px; height: 120px; }
header h1 {
  color: red;
  font-family: "Times New Roman", serif;
  margin: 0;
}

/* ── Navigation bar ── */
nav {
  background: #ffcc00;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  padding: 0 10px;
  position: relative;
  z-index: 100;
}
nav > a,
nav > .nav-dropdown > .nav-top {
  text-decoration: none;
  color: #000;
  font-weight: bold;
  padding: 12px 15px;
  border-right: 1px solid #000;
  white-space: nowrap;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
nav > a:last-child { border-right: none; }
nav > a:hover,
nav > .nav-dropdown > .nav-top:hover { background: #ffe566; }
nav > a.active,
nav > .nav-dropdown.active > .nav-top { color: red; background: #fff3b0; }
.nav-dropdown { position: relative; border-right: 1px solid #000; }
.nav-dropdown:last-child { border-right: none; }
.nav-top .arrow { margin-left: 5px; font-size: 10px; transition: transform 0.2s; display: inline-block; }
.nav-dropdown.open > .nav-top .arrow { transform: rotate(180deg); }
.dropdown-panel {
  display: none; position: absolute; top: 100%; left: 0;
  background: #ffdd44; min-width: 180px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25); z-index: 200;
  border-top: 2px solid #cc9900;
}
.nav-dropdown.open > .dropdown-panel { display: block; }
.dropdown-panel a, .dropdown-panel .sub-dropdown > .sub-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; text-decoration: none; color: #000; font-weight: bold;
  font-size: 14px; border-bottom: 1px solid #cc9900; white-space: nowrap;
  cursor: pointer; transition: background 0.15s;
}
.dropdown-panel a:last-child, .dropdown-panel .sub-dropdown:last-child > .sub-top { border-bottom: none; }
.dropdown-panel a:hover, .dropdown-panel .sub-dropdown > .sub-top:hover { background: #fff3b0; color: red; }
.sub-dropdown { position: relative; }
.sub-top .arrow { font-size: 10px; margin-left: 8px; }
.sub-dropdown.open > .sub-top { background: #fff3b0; color: red; }
.sub-panel {
  display: none; position: absolute; top: 0; left: 100%;
  background: #fff8d6; min-width: 240px;
  box-shadow: 4px 4px 12px rgba(0,0,0,0.2); border-left: 2px solid #cc9900; z-index: 300;
}
.sub-dropdown.open > .sub-panel { display: block; }
.sub-panel a {
  display: block; padding: 10px 16px; text-decoration: none; color: #000;
  font-weight: bold; font-size: 13px; border-bottom: 1px solid #e0c840; white-space: nowrap;
}
.sub-panel a:last-child { border-bottom: none; }
.sub-panel a:hover { background: #ffcc00; color: red; }
.sub-panel a.active { color: red; background: #fff3b0; }

/* ── Main layout ── */
main { padding: 20px; }
.content {
  max-width: 900px;
  margin: 0 auto;
  background: #d3dce6;
  padding: 20px;
  border-radius: 6px;
}

.page-header {
  background: #26354a;
  color: #ffcc00;
  padding: 14px 20px;
  margin-bottom: 16px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header h2 {
  margin: 0;
  font-family: "Times New Roman", serif;
  font-size: 20px;
  letter-spacing: 0.3px;
}
.page-header .back-link {
  text-decoration: none; color: #ffcc00; font-size: 13px; font-weight: bold;
  border: 1px solid #ffcc00; padding: 4px 10px; border-radius: 3px; transition: background 0.15s;
}
.page-header .back-link:hover { background: rgba(255,204,0,0.2); }

.event-info {
  background: #fff;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 13px;
  color: #445;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Pair picker ── */
.picker {
  background: #fff;
  border-radius: 4px;
  padding: 14px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.picker label { font-weight: bold; color: #003366; font-size: 14px; }
.picker select {
  flex: 1;
  min-width: 220px;
  padding: 10px 8px;
  font-size: 14px;
  border: 1px solid #8aaad4;
  border-radius: 4px;
  background: #fff;
  color: #003366;
}

/* ── Selected pair summary ── */
.pair-summary {
  display: none;
  background: #3366cc;
  color: #fff;
  border-radius: 4px;
  padding: 12px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 6px 20px;
  align-items: baseline;
}
.pair-summary.show { display: flex; }
.pair-summary .names { font-size: 16px; font-weight: bold; }
.pair-summary .stat { font-size: 13px; }
.pair-summary .stat b { font-size: 15px; }

.empty-state {
  background: #fff;
  border-radius: 4px;
  padding: 30px 16px;
  text-align: center;
  color: #556;
  font-style: italic;
}

/* ── Results table (round-header / mini-session / summary-session pattern) ── */
.results-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,51,102,.15);
  font-size: 13px;
  display: none;
}
.results-table.show { display: table; }
.results-table thead th {
  background: #496414; color: #fff; padding: 8px 8px;
  text-align: center; font-size: 12px; font-weight: bold; white-space: nowrap;
}
.results-table thead th:first-child { text-align: left; }
.results-table tbody tr { border-bottom: 1px solid #b0c8e8; }
.results-table td { padding: 7px 8px; text-align: center; color: #003366; vertical-align: middle; }
.results-table td:first-child { text-align: left; font-weight: bold; }

.results-table tr.round-header td {
  background: #1a4da0; color: #fff; font-weight: bold; font-size: 12.5px;
  padding: 7px 12px; letter-spacing: .2px;
}
.results-table tr.mini-session td:first-child { padding-left: 16px; border-left: 3px solid #3366cc; }
.results-table tr.mini-session:hover { background: #e8f2ff; }

.results-table tr.summary-session td {
  background: #d4e8a0; font-style: italic;
  border-top: 4px solid #88aa44; border-bottom: 4px solid #88aa44;
}
.results-table tr.summary-session td:first-child {
  padding-left: 16px; border-left: 3px solid #88aa44; font-weight: bold; font-style: normal;
}
.results-table tr.summary-session td:last-child { border-right: 3px solid #88aa44; }

.suit-red { color: #cc0000; font-weight: bold; }
.suit-black { color: #111; font-weight: bold; }
.dbl { font-size: 10px; vertical-align: super; }

.legend {
  font-size: 11px; color: #667; margin-top: 10px; font-style: italic;
}

footer {
  background: #ccff99; padding: 10px 20px; text-align: center; font-size: 12px; color: #444;
}

/* ── Clickable board number ── */
.board-link {
  background: none; border: none; padding: 0; margin: 0;
  color: #3366cc; font-weight: bold; text-decoration: underline;
  cursor: pointer; font-size: inherit; font-family: inherit;
}
.board-link:hover { color: #1a4da0; }

/* ── Board traveler modal ── */
.board-modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 500; align-items: center; justify-content: center; padding: 16px;
}
.board-modal.show { display: flex; }
.board-modal-panel {
  background: #fff; border-radius: 8px; max-width: 720px; width: 100%;
  max-height: 85vh; overflow-y: auto; padding: 18px;
}
.board-modal-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.board-modal-header h3 { margin: 0; font-size: 17px; color: #003366; }
.board-modal-close {
  background: #26354a; color: #ffcc00; border: none; border-radius: 4px;
  width: 28px; height: 28px; font-size: 16px; cursor: pointer; line-height: 1; flex-shrink: 0;
}
.board-modal-close:hover { background: #cc0000; color: #fff; }
.board-table-scroll { overflow-x: auto; }
.board-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 560px; }
.board-table th {
  background: #496414; color: #fff; padding: 6px 8px; text-align: center; white-space: nowrap;
}
.board-table td {
  padding: 6px 8px; text-align: center; color: #003366; border-bottom: 1px solid #d8e4f0; white-space: nowrap;
}
.board-table td:nth-child(2), .board-table td:nth-child(3) { text-align: left; }
.board-table tr.current-pair td { background: #fff3b0; font-weight: bold; }

/* ── Hand diagram (compass layout) — only used when the event has PBN deal data ── */
.hand-diagram-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.hand-diagram {
  display: grid;
  grid-template-columns: 90px 90px 90px;
  grid-template-rows: auto auto auto;
  gap: 2px 4px;
  font-size: 12px;
  flex-shrink: 0;
}
.hd-N { grid-column: 2; grid-row: 1; }
.hd-W { grid-column: 1; grid-row: 2; }
.hd-center { grid-column: 2; grid-row: 2; display: flex; align-items: center; justify-content: center; text-align: center; }
.hd-E { grid-column: 3; grid-row: 2; }
.hd-S { grid-column: 2; grid-row: 3; }
.hand-diagram .seat-label {
  font-weight: bold; color: #003366; text-align: center; margin-bottom: 2px;
  border-radius: 3px; padding: 1px 0;
}
.hand-diagram .seat-label.dealer { background: #ffcc00; }
.hand-diagram .seat-label.vuln { color: #cc0000; }
.hand-diagram .suit-line { white-space: nowrap; text-align: left; padding-left: 6px; }
.hd-center-box {
  font-size: 11.5px; color: #445; background: #fff; border: 1px solid #d8e4f0;
  border-radius: 4px; padding: 6px 8px; line-height: 1.5;
}
.board-meta { font-size: 12px; color: #445; margin: -6px 0 12px; }

/* ── Double dummy tricks table — only used when the PBN has OptimumResultTable ── */
.dd-table-wrap { font-size: 11.5px; }
.dd-table-title { font-size: 11.5px; font-weight: bold; color: #003366; margin: 0 0 4px; }
.dd-table { border-collapse: collapse; }
.dd-table th, .dd-table td {
  border: 1px solid #d8e4f0; padding: 3px 9px; text-align: center; min-width: 20px;
}
.dd-table th { background: #496414; color: #fff; }
.dd-table td:first-child { font-weight: bold; background: #eef5ff; color: #003366; }
.dd-table td.par-cell { background: #fff3b0; font-weight: bold; }

/* ── Responsive ── */
@media (max-width: 700px) {
  main { padding: 10px; }
  .content { padding: 12px; }
  nav { flex-direction: column; align-items: stretch; gap: 0; padding: 0; }
  nav > a, nav > .nav-dropdown > .nav-top { padding: 12px; border-right: none; border-bottom: 1px solid #cc9900; }
  .nav-dropdown { border-right: none; border-bottom: 1px solid #cc9900; }
  .dropdown-panel { position: static; box-shadow: none; border-top: none; border-left: 4px solid #cc9900; }
  .sub-panel { position: static; border-left: 8px solid #cc9900; box-shadow: none; }

  .results-table, .results-table thead, .results-table tbody,
  .results-table th, .results-table td, .results-table tr { display: block; }
  .results-table thead { display: none; }
  .results-table tr.round-header { padding: 7px 10px; }
  .results-table tbody tr.mini-session {
    margin: 0 0 6px; border: 1px solid #8aaad4; border-radius: 4px; padding: 6px; background: #fff;
  }
  .results-table tbody tr.summary-session { margin: 0 0 10px; padding: 8px 10px; border-radius: 4px; }
  .results-table td {
    text-align: left !important; padding: 3px 6px; position: relative; padding-left: 40%;
  }
  .results-table td::before {
    content: attr(data-label); position: absolute; left: 6px; top: 3px; width: 36%;
    font-weight: bold; font-size: 10.5px; color: #3366cc; white-space: nowrap;
  }
  .results-table tr.mini-session td:first-child { padding-left: 40%; border-left: none; }
  .results-table tr.summary-session td:first-child { padding-left: 40%; border-left: none; }

  .board-modal { padding: 8px; }
  .board-modal-panel { padding: 12px; }
}
