/* ===== BASE STYLES ===== */
body {
  background-color: rgb(255 248 222);
  font-family: Synonym, ui-sans-serif, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
  margin: 20px auto;
}

h1 { color: #333; }

img { padding: 0px 4px; }

a {
  position: relative;
  text-decoration: none;
  color: #333;
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1.5px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: bottom right;
  transition: transform 0.2s ease-out;
}

a:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

/* ===== HEADER ===== */
#header-top {
  width: 800px;
  margin: 20px auto;
}

#room_name {
  font-size: 2rem;
  text-align: left;
  margin: 20px auto;
  font-family: monospace;
  text-transform: uppercase;
}

#room_name > hr {
  color: #222;
  border-top: 1px solid;
}

#clickmeh {
  top: 10px;
  position: absolute;
  color: #333;
  text-decoration: none;
  font-size: 1.4em;
  font-variant: small-caps;
  white-space: nowrap;
}

#winner_link {
  /* display: float; */
  /* float: left; */
  /* position: absolute; */
  font-variant: small-caps;
  font-size: 60%;
}

#header > a {
  font-size: 1.1em;
  margin: 0 5px;
  font-weight: bold;
  opacity: 0.4;
}

#header > a.active { opacity: 0.9; }

#picklerun {
  width: 64px;
  height: 64px;
  vertical-align: bottom;
}

/* ===== CONTAINER ===== */
#container {
  width: fit-content;
  margin: 20px auto;
  padding: 20px;
}

#container-oldrooms {
  width: 800px;
  margin: 20px auto;
  padding: 20px;
  line-height: 2em;
}

/* ===== FLAG WRAPPER (Safari fix) ===== */
.flag-wrapper {
  display: inline-block;
  width: 30px;
  height: 20px;
  overflow: hidden;
  vertical-align: middle;
}

.flag-wrapper img[src*="flags/"] {
  width: 60px !important;
  height: 40px !important;
  transform: scale(0.5);
  transform-origin: top left;
  image-rendering: crisp-edges;
  margin: 0;
  padding: 0;
  display: block;
}

/* ===== BASIC TABLE ===== */
.basic-table {
  width: 100%;
  border-collapse: collapse;
  font-family: sans-serif;
  font-size: 14px;
}

.basic-table th,
.basic-table td {
  border: 1px solid #ccc;
  padding: 8px 12px;
  text-align: left;
}

.basic-table thead { background-color: #f4f4f4; }
.basic-table tbody tr:nth-child(even) { background-color: #f9f9f9; }

/* ===== PAGE: MATCHES ===== */
.page-matches #datelist {
  font-family: monospace;
  display: inline-block;
  font-size: 1.0em;
}

.page-matches #datelist > div {
  margin: 19px 0;
  text-align: left;
  vertical-align: middle;
}

.page-matches #datelist > div > a {
  margin: 0 20px 0 0;
  vertical-align: bottom;
}

.page-matches #datelist a { color: #2a6d09; }

.page-matches td > span {
  display: inline-block;
  margin: 0 8px;
  width: 57px;
  padding: 0px;
  text-align: center;
  vertical-align: middle;
}

.page-matches td { width: 150px; }
.page-matches tr { height: 25px; }

/* ===== PAGE: LEADERBOARD ===== */
.page-leader .barchart { background-color: #000; }

.page-leader #container > div:has(table) {
  width: fit-content;
  margin: 0 auto;
}

.page-leader table {
  margin: 16px 0;
  font-size: 1.0em;
  border-collapse: collapse;
  min-width: 1200px;
  width: max-content;
}

.page-leader thead { font-size: 0.8em; }
.page-leader tbody { font-family: monospace; }

.page-leader td:nth-child(1),
.page-leader td:nth-child(2) { text-align: center; }

.page-leader tbody > tr > td:nth-child(5) {
  text-align: center;
  font-weight: bold;
}

.page-leader th, .page-leader td {
  padding: 6px 15px;
  text-align: left;
  border: 1px solid #aaa;
  border-style: solid none;
}

.page-leader thead > tr > td {
  color: grey;
  border-style: none none solid none;
}

.page-leader td .flag-wrapper {
  margin: 2px 1px;
  display: inline-block;
  vertical-align: middle;
}

.page-leader td:nth-child(4) { white-space: nowrap; }

/* ===== PAGE: HOME ===== */
.page-home .welcome-section {
  text-align: center;
  margin-bottom: 40px;
}

.page-home .welcome-section h1 {
  color: #333;
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.page-home .current-status {
  font-size: 1.2rem;
  color: #666;
  padding: 15px;
  background-color: rgb(255 248 222);
  border-radius: 8px;
  margin-bottom: 20px;
}

.page-home .rooms-section h2 {
  color: #333;
  font-size: 2rem;
  margin-bottom: 10px;
}

.page-home .section-description {
  color: #666;
  font-size: 1.1rem;
  margin-bottom: 30px;
}

.page-home .rooms-table {
  border-collapse: collapse;
  font-family: sans-serif;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
  table-layout: fixed;
}

.page-home .rooms-table th,
.page-home .rooms-table td {
  padding: 10px;
  text-align: left;
  /* border-bottom: 1px solid #eee; */
}

.page-home .rooms-table th {
  background-color: rgb(225 205 131);
  font-weight: bold;
  color: #333;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

.page-home .rooms-table tbody tr { background-color: rgb(255 248 222); }
.page-home .rooms-table tbody tr:hover { background-color: #bbdefb !important; }

.page-home .rooms-table tr.selected-room {
  background-color: #e8f5e8;
  box-shadow: inset 4px 0 0 #28a745;
}

.page-home .rooms-table tr.selected-room:hover { background-color: #d4edda; }

.page-home .current-indicator {
  color: #28a745;
  font-weight: bold;
  font-size: 0.9rem;
  margin-left: 8px;
  white-space: nowrap;
}

.page-home .team-flags {
  /* display: flex; */
  /* flex-wrap: wrap; */
  /* gap: 4px; */
  align-items: center;
}

.page-home .no-teams {
  color: #999;
  font-style: italic;
  font-size: 0.9rem;
}

.page-home .room-radio {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #28a745;
}

.page-home .room-radio:hover { transform: scale(1.1); }

.page-home .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.page-home .empty-state h3 {
  color: #333;
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.page-home .rooms-table td:nth-child(2) {
  font-weight: bold;
  font-variant: all-petite-caps;
  font-size: 1.2rem;
}

.page-home .rooms-table td:nth-child(4) {
  font-weight: bold;
  font-size: 0.9rem;
}

/* ===== PAGE: PURCHASE ===== */
.page-purchase .name-input { margin-bottom: 20px; }
.page-purchase .name-input label { font-weight: bold; }

.page-purchase .name-input input {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.page-purchase .budget-display { margin-bottom: 20px; }
.page-purchase .budget-display h2 { color: #333; }

.page-purchase .group {
  border: 2px solid #ccc;
  border-radius: 10px;
  padding: 10px;
}

.page-purchase .group h3 {
  text-align: center;
  margin-bottom: 10px;
}

.page-purchase #selected-flags .flag-wrapper {
  margin: 0 6px 0 0;
  display: inline-block;
  vertical-align: middle;
}

.page-purchase .flag-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.page-purchase .flag {
  cursor: pointer;
  border: 2px solid #ccc;
  border-radius: 5px;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
  text-align: center;
}

.page-purchase .flag img {
  width: 80%;
  height: auto;
  display: block;
  margin: 5px auto;
}

.page-purchase .flag:hover {
  transform: scale(1.05);
  border-color: #007bff;
}

.page-purchase .flag p {
  margin: 5px 0;
  font-size: 14px;
  color: #333;
}

.page-purchase .shopping-cart { margin-top: 20px; }
.page-purchase .shopping-cart h2 { color: #333; }

.page-purchase #selected-flags {
  flex-wrap: wrap;
  gap: 10px;
}

.page-purchase #selected-flags > img {
  margin-right: 15px;
  vertical-align: middle;
}

.page-purchase #purchase-btn {
  padding: 10px 20px;
  font-size: 16px;
  background-color: #00aa7b;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-right: 20px;
}

.page-purchase #purchase-btn:hover { background-color: #00bb7b; }
.page-purchase #purchase-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.page-purchase #group-container {
  display: flex;
  flex-wrap: wrap;
  gap: 50px 30px;
  padding-top: 50px;
  max-width: calc(2*(268px));
}

.page-purchase #group-container > div {
  flex: 1 1;
  position: relative;
  max-width: 280px;
}

.page-purchase #group-container > div > p {
  position: absolute;
  top: -3em;
}

.page-purchase #group-container > div > table {
  width: 100%;
  height: 100%;
  border: 1px solid hsl(0deg 0% 0% / 40%);
  border-radius: 14px;
}

.page-purchase td { padding: 0 2px; }

.page-purchase #the-rules { line-height: 1.8em; width: 800px }

/* Custom checkboxes */
.page-purchase input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #ccc;
  border-radius: 50%;
  background: #eee;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s;
  position: relative;
}

.page-purchase input[type="checkbox"]:checked {
  background: #33a;
  border-color: #228;
}

.page-purchase input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: #77a;
  border-radius: 50%;
}

.page-purchase label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2em;
}
