/* === GLOBAL RESET === */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Layer system */
:root {
  --z-base: 1;
  --z-table: 50;
  --z-header: 1000;
  --z-dropdown: 2000;
  --z-popup: 3000;
  --z-modal: 4000;
}

html, body {
  font-family: "Inter", Arial, 
                -apple-system,
               BlinkMacSystemFont,
               "Segoe UI",
               "Apple Color Emoji",
               "Segoe UI Emoji",
               "Noto Color Emoji",
               sans-serif;
  background-color: #f8f9fb;
  color: #222;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /*overflow-x: hidden;*/
}

main {
  flex: 1 0 auto;
}

hr {
  display: block;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  margin-left: auto;
  margin-right: auto;
  border-style: inset;
  border-width: 2px;
  border-color: #1e5f3c;
}

/* === HEADER === */
header {
  background-color: #1e5f3c;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  border-radius: 0 0 12px 12px;
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.logo a {
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  color: white;
}

.logo a:hover { color: #ffd700; }

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.main-nav a {
  text-decoration: none;
  color: white;
  font-weight: 500;
  transition: color 0.3s;
}

.main-nav a:hover { color: #ffd700; }

.menu-toggle {
  display: none;
  font-size: 26px;
  cursor: pointer;
}

/* === DROPDOWN === */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  cursor: pointer;
  font-weight: 500;
  color: #ffffff;
}

.dropdown-menu {
  position: absolute;
  top: 120%;
  left: 0;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-radius: 8px;
  display: none;
  flex-direction: column;
  min-width: 80px;
  transition: opacity 0.5s ease-in-out;
}

.dropdown.open .dropdown-menu {
  display: flex;
}

.dropdown-menu a {
  padding: 10px 14px;
  text-decoration: none;
  color: #1e5f3c;
  white-space: nowrap;
}

.dropdown-menu a:hover {
  background: #b9fabf;
  color: #20b062;  
  /*background-color: #f2f6fb;*/
}

/* responsive menu */
@media (max-width: 900px) {
  .main-nav { display: none; flex-direction: column; background: #1e5f3c; border-radius: 0 0 12px 12px; width: 100%; }
  .main-nav.active { display: flex; }
  .menu-toggle { display: block; color: white; font-size: 1.8rem; }
}

.lang-dropdown {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.lang-selected {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-selected img,
.lang-options img {
  width: 20px;
  height: 14px;
}

.lang-options {
  display: none;
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  padding: 5px;
  z-index: var(--z-dropdown);
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.lang-options div {
  padding: 5px;
  display: flex;
  color: #1e5f3c;
  align-items: center;
  gap: 6px;
}

.lang-options div:hover {
  background: #b9fabf;
  color: #20b062;
}

/* === CONTAINER & CARDS === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
}

.containerindex {
  max-width: 1300px;
  margin: 0;
  padding: 20px 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  padding: 16px;
}

/* === TABLE === */
.table-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  padding: 20px;
}

table.index-table {
  position: relative; /* ensures clean stacking */  
  table-layout: fixed;   /* ✅ THIS IS KEY */
  width: max-content;    /* ✅ allow table to expand */
  min-width: 1200px;
  border-collapse: collapse;
  font-size: 15px;
  text-align: center;
  border-left: 3px solid #1e5f3c;
  border-right: 3px solid #1e5f3c;
  border-top: 3px solid #1e5f3c;
  border-bottom: 3px solid #1e5f3c;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.index-table thead th {
  position: sticky;
  top: 53px;
  background: #1e5f3c;   /* same as your header */
  color: white;
  z-index: var(--z-table);

  overflow: visible;   /* allow tooltip OUTSIDE */
  box-sizing: border-box;
}

table.index-table th, table.index-table td {
  border: 1px solid #ddd;
  padding: 5px 2px;
  background: white;
  text-align: center;
  vertical-align: middle;
}

/* Visually separate match days */
tr.day-separator td {
  border-bottom: 2px solid #1e5f3c; 
}

tr.double-separator td {
  border-bottom: 8px double #1e5f3c;
}

table.index-table th {
  background: #1e5f3c;
  border-bottom: 2px double #1e5f3c;
  color: #ffd700;
  font-weight: 700;
}
/*
.index-table th.user-header {
  position: relative;
  z-index: 10;
}
*/
.index-table thead tr {
  height: 90px;  /* lock entire header row */
}

.index-table th.user-header:hover {
  z-index: 5000;  /* bring hovered one above others */
}

/* Fixed column widths */
table.index-table td:nth-child(1) { 
    width: 30px;
    font-size: 13px;
    color: #ccc; 
}

table.index-table th:nth-child(2) { width: 90px; font-size: 15px; }
table.index-table td:nth-child(2) { width: 90px; font-size: 13px; }

table.index-table th:nth-child(3) { transition: width 0.25s ease, padding 0.25s ease; white-space: nowrap; font-size: 15px; }
table.index-table td:nth-child(3) { transition: width 0.25s ease, padding 0.25s ease; white-space: nowrap; font-size: 13px; /*text-align: left; padding-left: 8px; */}

/* Default (full name) */
.index-table.mode-full th:nth-child(3),
.index-table.mode-full td:nth-child(3) {
  width: 180px;
}

/* Short name */
.index-table.mode-short th:nth-child(3),
.index-table.mode-short td:nth-child(3) {
  width: 90px;
}

/* Flag mode */
.index-table.mode-flag th:nth-child(3),
.index-table.mode-flag td:nth-child(3) {
  width: 70px;
  text-align: center;
}

/* Slight visual polish */
.team-cell {
  transition: all 0.2s ease;
}

table.index-table td:nth-child(4) { 
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    background-color: #fff7cc;
    font-weight: 600;
    color: #222;
    border-left: 2px solid #ccc;
    border-right: 2px solid #ccc;
}

/* User columns uniform */
table.index-table th:nth-child(n+5),
table.index-table td:nth-child(n+5) { 
  width: 40px;
  min-width: 40px;
  max-width: 40px;
 }

/* Rotate user column headers */
.index-table th:nth-child(n+5) {
  padding: 5px 0;
  text-align: center;
  vertical-align: bottom;
}

/* wrapper behavior */
.vertical-text {
  display: inline-flex;        /* ✅ flex INSIDE, not on <th> */
  align-items: flex-end;       /* ✅ bottom */
  justify-content: center;     /* ✅ center horizontally */

  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;

  transform-origin: center center;  
  line-height: 1;
}

/* Results */
.result-cell {
  background-color: #fff7cc;
  font-weight: bold;
  border-left: 2px solid #ccc;
  border-right: 2px solid #ccc;
}

/* === LEADERBOARD TABLE === */
table.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  text-align: center;
  border-left: 2px solid #1e5f3c;
  border-right: 2px solid #1e5f3c;
  border-top: 2px solid #1e5f3c;
  border-bottom: 2px solid #1e5f3c;
}

table.leaderboard-table th, table.leaderboard-table td {
  border: 1px solid #ddd;
  padding: 10px 6px;
  background: white;
  text-align: center;
  vertical-align: middle;
}

table.leaderboard-table th {
  background: #1e5f3c;
  color: white;
  font-weight: 700;
}

/* Fixed column widths */
table.leaderboard-table td:nth-child(1) { 
    width: 40px; 
    color: #1e5f3c;
    font-weight: 700;
}

table.leaderboard-table th:nth-child(2),
table.leaderboard-table td:nth-child(2) { 
    width: 120px;
    text-align: left; 
    padding-left: 8px;
}

table.leaderboard-table td:nth-child(3) { 
    min-width: 80px; 
    background-color: #fff7cc;
    font-weight: 600;
    color: #222;
    border-left: 2px solid #ccc;
    border-right: 2px solid #ccc;
    /* */
}

table.leaderboard-table td:nth-child(4) { 
    width: 80px; 
}

table.leaderboard-table td:nth-child(5) { 
    width: 60px; 
    border-right: 2px solid #1e5f3c;
}

table.leaderboard-table td:nth-child(n+6) { 
    width: 60px; 
    color: #ccc;
}

.htable-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  padding: 20px;
}

/* === FOOTER === */
footer {
  flex-shrink: 0;  
  background-color: #1e5f3c;
  text-align: center;
  padding: 12px 0;
  font-size: 14px;
  color: white;
  border-top: 1px solid #e1e4e8;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
  border-radius: 12px 12px 0 0;
  margin-top: 20px;
}
footer a { color: white; text-decoration: none; }

/* === SCORE
.score {
  font-family: "Courier New", monospace;
  font-weight: 700;
  font-size: 15px;
  display: inline-block;
} === */

/* === UTILITIES === */
.me-info {
  text-align: right;
  margin-bottom: 8px;
  color: #1e5f3c;
  font-size: 15px;
}

.team-flag-img {
  width: 22px;
  height: auto;
  vertical-align: middle;
}

.team-slovakia {
  font-weight: 700;
  color: #1e5f3c;
}

.modal {
  display: none;
  position: fixed;
  z-index: var(--z-modal);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #fff;
    color: #222; /* ensure text is dark and readable */
    margin: 10% auto;
    padding: 20px 30px;
    border-radius: 10px;
    max-width: 400px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    position: relative;
    animation: slideDown 0.3s ease;
}

.modal-content h2 {
    margin-top: 0;
    color: #003366;
}

.modal-content label {
    color: #003366; /* deep blue labels */
    display: block;
    margin-top: 10px;
    font-weight: 500;
}

.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="password"] {
    width: 95%;
    padding: 8px;
    margin-top: 6px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #f9fbff;
    color: #003366;
}

.modal-content input[type="submit"] {
    margin-top: 15px;
    width: 100%;
    background: #003366;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
}

.modal-content input[type="submit"]:hover {
    background: #0055aa;
}

/* Close “X” */
.close {
    position: absolute;
    right: 12px;
    top: 10px;
    font-size: 22px;
    cursor: pointer;
    color: #666;
}

.close:hover {
    color: #000;
}

/* Animations */
@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

@keyframes slideDown {
    from {opacity: 0; transform: translateY(-20px);}
    to {opacity: 1; transform: translateY(0);}
}

/* === ALERT MESSAGES === */
.alert {
  max-width: 500px;
  margin: 30px auto;
  padding: 15px 20px;
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
  animation: fadeIn 0.5s ease-in-out;
}

.alert-success {
  background-color: #e6f7ff;
  border: 1px solid #91d5ff;
  color: #005073;
}

.alert-error {
  background-color: #fff1f0;
  border: 1px solid #ffa39e;
  color: #a8071a;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === PWA INSTALL BUTTON === */
.install-app-btn {
  position: fixed;
  top: 60px;
  left: 20px;
  background-color: #1e5f3c;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: none; /* shown only when installable */
  transition: all 0.3s ease;
  z-index: 4500; /* above everything except modals if you want */
}

/* Appear only on small screens */
@media (max-width: 768px) {
  .install-app-btn.show {
    display: block;
  }
}

.install-app-btn:hover {
  background-color: #ffd700;
  color: #1e5f3c;
  transform: scale(1.05);
}

/* === ADMIN page === */
.admin-form, .admin-table {
    margin: 20px auto;
    width: 90%;
    max-width: 900px;
}

.admin-form input, .admin-form select {
    display: block;
    margin: 8px 0 16px 0;
    width: 25%;
    padding: 8px;
}

.admin-table {
    border-collapse: collapse;
    width: 1200px;
    background: white;
}

.admin-table th, .admin-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.admin-table th {
    background: #003366;
    color: white;
}

.admin-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.admin-table button {
    background: #0055aa;
    color: white;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
}

.admin-table button:hover {
    background: #0077cc;
}

.admin-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin: 20px auto 30px auto;
    width: 90%;
    text-align: center;
}

.summary-card {
    background: #f8f9fc;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.summary-card h2 {
    font-size: 2em;
    color: #003366;
    margin: 0;
}

.summary-card p {
    color: #555;
    margin-top: 6px;
    font-size: 0.9em;
}

.recalc-btn {
    background: #0077cc;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
}

.recalc-btn:hover {
    background: #005fa3;
}

/* === Standings Preview Popup === */
.standings-popup {
  display: none;
  position: absolute;
  background: #ffffff;
  color: #222;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 10px;
  min-width: 180px;
  z-index: var(--z-popup);
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.standings-popup.fade-in {
  opacity: 1;
}

.standings-popup table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.standings-popup th,
.standings-popup td {
  padding: 4px 8px;
  
}

.standings-popup th {
  background-color: #1e5f3c;
  color: white;
  font-weight: 600;
}

.standings-popup tr:nth-child(even) {
  background-color: #f5f7fb;
}

/* Base highlight (shared) */
.index-table th.my-col,
.index-table td.my-col {
  font-weight: 700;
  border-left: 2px solid purple;
  border-right: 2px solid purple;
  /*position: relative;
  z-index: 2;*/
}

/* ✅ Soft continuous glow (fixed) */
.index-table td.my-col {
  box-shadow: 
    inset 0 0 0 9999px rgba(128, 0, 128, 0.05),  /* full overlay */
    inset 6px 0 8px -6px rgba(128, 0, 128, 0.35),
    inset -6px 0 8px -6px rgba(128, 0, 128, 0.35);
  background-clip: padding-box; /* prevents bleed */
  background-color: rgba(128, 0, 128, 0.04);
}

.index-table td.my-col-hover {
  box-shadow:
    inset 0 0 0 9999px rgba(128, 0, 128, 0.08),
    inset 6px 0 8px -6px rgba(128, 0, 128, 0.4),
    inset -6px 0 8px -6px rgba(128, 0, 128, 0.4);
  background-color: rgba(128,0,128,0.08);
}

/* ✅ Header styling (fix background conflict) */
.index-table th.my-col {
  background: #2a1a5e !important;   /* force override */
  color: #fff; /*#ffd700 !important;*/

  box-shadow: inset 6px 0 10px -6px rgba(180, 120, 255, 0.6),
              inset -6px 0 10px -6px rgba(180, 120, 255, 0.6);
}

.index-table td.my-col.special-col {
  box-shadow: 
    inset 0 0 0 9999px rgba(207, 24, 116, 0.06),
    inset 6px 0 8px -6px rgba(207, 24, 116, 0.45),
    inset -6px 0 8px -6px rgba(207, 24, 116, 0.45);
}

.index-table th.my-col.special-col {
  background: #cf1874 !important;
  color: #fff;
}

.index-table td.my-col.special-col.my-col-hover {
  box-shadow:
    inset 0 0 0 9999px rgba(207, 24, 116, 0.12),
    inset 6px 0 8px -6px rgba(207, 24, 116, 0.5),
    inset -6px 0 8px -6px rgba(207, 24, 116, 0.5);
}

/* container */
.user-header {
  /*position: relative;*/
  cursor: pointer;
}

/* tooltip box */
.user-tooltip {
  position: absolute;
  bottom: 100%;      /* above header 100% */
  left: 50%;        /* orig 50%*/ 
  transform: translateX(-50%) translateY(10px); /* orig: translateX(-50%) translateY(10px) */

  background: #b2fadb;   /* #2a1a5e */
  color: #1e5f3c;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;

  box-shadow: 0 6px 14px rgba(0,0,0,0.25);

  opacity: 0;
  visibility: hidden;   /* ✅ important */
  pointer-events: none;

  transition: opacity 0.2s ease, transform 0.2s ease;  /*transition: all 0.25s ease;*/
  z-index: 3000;
}

/* arrow */
.user-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #b2fadb transparent transparent transparent;
}

.user-header:hover .user-tooltip,
.user-header.active .user-tooltip {
  opacity: 1;
  visibility: visible;   /* ✅ important */
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.user-header:hover {
  filter: brightness(1.1);
}

.user-header .vertical-text {
  position: relative; /* ✅ safe */
  z-index: 1;
}

.tooltip-name {
  font-weight: 700;
  text-decoration: underline;
  font-size: 14px;
  margin-bottom: 4px;
}

.user-tooltip {
  font-weight: 400; /* default normal */
}

.user-tooltip .val {
  font-weight: 700; /* only values bold */
}

.header-inner {
  position: relative;  /* ✅ NEW place for positioning */
}

.leaderboards-wrapper {
  display: flex;
  gap: 50px;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap; /* ✅ allows stacking on small screens */
}

.leaderboard-box {
  flex: 1;
  min-width: 300px;
  max-width: 550px;
}

.leaderboard-box.teams table {
  width: 100%;
  table-layout: fixed;
}

.leaderboard-box.teams td:nth-child(1),
.leaderboard-box.teams th:nth-child(1) {
  width: 35px;   /* ✅ adjust this freely (220, 250 etc.) */
  min-width: 35px;
  max-width: 35px;
}

.leaderboard-box.teams td:nth-child(2),
.leaderboard-box.teams th:nth-child(2) {
  width: 180px;   /* ✅ adjust this freely (220, 250 etc.) */
  min-width: 180px;
  max-width: 180px;
  white-space: nowrap;  /* ✅ forces one line */
}

.leaderboard-box.teams td:nth-child(3),
.leaderboard-box.teams th:nth-child(3) {
  width: 80px;   /* ✅ adjust this freely (220, 250 etc.) */
  min-width: 80px;
  max-width: 80px;
}

.leaderboard-box.teams td:nth-child(4),
.leaderboard-box.teams th:nth-child(4) {
  width: 100px;   /* ✅ adjust this freely (220, 250 etc.) */
  min-width: 100px;
  max-width: 100px;
}

.leaderboard-box.teams td:nth-child(5),
.leaderboard-box.teams th:nth-child(5) {
  width: 80px;   /* ✅ adjust this freely (220, 250 etc.) */
  min-width: 80px;
  max-width: 80px;
}

.user-name {
  white-space: nowrap;
}

.leaderboard-table td:not(:nth-child(2)) {
  width: 60px;
}

.index-table tr.section-title-row td {
  color: #1e5f3c;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  padding: 5px 0;
  background: linear-gradient(to right, #eef8f1, #ffffff, #eef8f1);
  border-top: 3px solid #1e5f3c;
  border-bottom: 3px solid #1e5f3c;
  letter-spacing: 1px;
}

.flourish-wrapper {
  width: 98vw;                 /* full viewport width */
  margin-left: calc(-50vw + 50%); /* pull outside container */
  margin-top: 30px;
  margin-bottom: 30px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 25px;
}

.stats-box {
  background: #fff;
  border-radius: 12px;
  padding: 15px 18px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.stats-box h3 {
  margin-bottom: 10px;
  font-size: 16px;
  color: #1e5f3c;
}

.stat-line {
  font-size: 14px;
  margin: 4px 0;
}

.full-width {
  grid-column: span 2;
}