/* ===== ALAPOK ÉS RESET (Eredeti kódod) ===== */
* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root {
  /* HRL theme colors */
  --bg-start: #071018; /* deep navy/black */
  --bg-mid: #021218; /* dark blue-black */
  --bg-end: #000000;
  --primary-blue: #0ea5e9; /* bright blue */
  --primary-deep: #064e78; /* deep blue */
  --accent-gold: #d4af37; /* gold */
  --accent-green-dark: #06261a; /* black-green (FIFA vibe) */
  --muted: #9ca3af;
  --card-bg: linear-gradient(135deg, rgba(2,18,24,0.7), rgba(6,46,56,0.35));
}

body {
  margin: 0;
  background: radial-gradient(circle at top, var(--bg-start) 0, var(--bg-mid) 55%, var(--bg-end) 100%);
  color: #f9fafb;
}

/* HEADER (Eredeti kódod) */
.main-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--primary-deep), rgba(2,8,12,0.8));
  border-bottom: 1px solid rgba(212,175,55,0.12);
  position: relative;
}

.btn-back-main {
  padding: 8px 14px;
  background: rgba(14, 165, 233, 0.15);
  color: #0ea5e9;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid rgba(14, 165, 233, 0.3);
  transition: all 0.3s;
  font-size: 13px;
}

.btn-back-main:hover {
  background: rgba(14, 165, 233, 0.25);
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.3);
}

.logo-circle {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 3px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, var(--primary-deep), rgba(2,6,12,0.9));
}

.logo-inner {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 2px solid var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-ball {
  font-size: 24px;
  color: var(--accent-gold);
}

.header-text h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.08em;
}

.header-text p {
  margin: 2px 0 0;
  font-size: 13px;
  color: #e5e7eb;
}

/* ADMIN PANEL (Eredeti kódod) */
.admin-login-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 14px;
  padding: 12px 16px;
  border: 1px solid rgba(14, 165, 233, 0.3);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
  z-index: 50;
  max-width: 300px;
}

.admin-login-panel input {
  width: 140px;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid rgba(14, 165, 233, 0.3);
  background: rgba(2, 6, 17, 0.9);
  color: #f9fafb;
  transition: border-color 0.3s;
}
.admin-login-panel button {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary-blue), rgba(14, 165, 233, 0.7));
  color: #020617;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.admin-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #0ea5e9;
  margin-right: 8px;
  font-weight: 700;
 padding: 4px 8px;
  font-size: 12px;
  border-radius: 999px;
}

.admin-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #e5e7eb;
  margin-right: 4px;
}

/* NAV (Eredeti kódod) */
.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 24px;
  background: #020617;
  border-bottom: 1px solid rgba(75, 85, 99, 0.7);
}

.nav-btn {
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  background: rgba(15, 118, 110, 0.1);
  color: #e5e7eb;
  transition: background 0.15s ease, transform 0.05s ease;
}

.nav-btn:hover {
  background: rgba(14,165,233,0.12);
  transform: translateY(-1px);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--primary-blue), var(--accent-gold));
  color: #020617;
}

/* MAIN / CONTAINER (Eredeti kódod) */
.container {
  max-width: 1100px;
  margin: 16px auto 32px;
  padding: 0 16px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.card {
  background: rgba(6,12,18,0.85);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(212,175,55,0.06);
  box-shadow: 0 18px 40px rgba(0,0,0,0.6);
}

.card h2, .card h3 {
  margin-top: 0;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* FORMS (Eredeti kódod) */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  align-items: flex-end;
}

.form-field {
  flex: 1 1 180px;
}

.form-field.small {
  flex: 0 0 70px;
}

label {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
  color: #e5e7eb;
}

input, select {
  width: 100%;
  padding: 6px 9px;
  border-radius: 10px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #f9fafb;
  font-size: 14px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 1px rgba(14,165,233,0.14);
}

button {
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-deep));
  color: #f8fafc;
  transition: transform 0.05s ease, box-shadow 0.05s ease, opacity 0.15s;
  white-space: nowrap;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(14,165,233,0.14);
  opacity: 0.95;
}

button:active {
  transform: translateY(0);
  box-shadow: none;
}

.danger-btn {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
  color: #fff;
}

/* TEXT (Eredeti kódod) */
.muted {
  font-size: 11px;
  color: #9ca3af;
}

/* LIST / TABLES (Eredeti kódod) */
.simple-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  font-size: 14px;
}

.simple-list li {
  padding: 4px 0;
  border-bottom: 1px solid rgba(31, 41, 55, 0.7);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 6px 5px;
  text-align: center !important;
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
}

.data-table thead {
  background: rgba(15, 118, 110, 0.4);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.8);
}

.data-table td.left {
  text-align: left !important;
}

/* Csoporttabella kártyák (Eredeti kódod) */
.group-table-card {
  margin-bottom: 14px;
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(145deg, rgba(6,78,59,0.55), rgba(15,23,42,0.95));
  border: 1px solid rgba(34,197,94,0.35);
}

.group-table-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.group-table-header h3 {
  margin: 0;
}

.group-table-header span {
  font-size: 11px;
  color: #cbd5f5;
}

.data-table tr.highlight {
  background: rgba(212,175,55,0.14);
}

/* FOOTER (Eredeti kódod) */
.main-footer {
  text-align: center;
  padding: 10px 16px 18px;
  font-size: 11px;
  color: #6b7280;
}

/* MOBIL (Eredeti kódod) */
@media (max-width: 720px) {
  .form-row {
    flex-direction: column;
    align-items: stretch;
  }
  button {
    width: 100%;
    justify-content: center;
    display: inline-flex;
  }
  .admin-login-panel {
    max-width: 220px;
  }
}

/* ===== 🏆 PLAYOFF SECTION - REDESIGNED 🏆 ===== */

.playoff-main {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  margin-top: 16px;
}

.playoff-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.playoff-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Play-in Results Container */
.playin-results-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.playin-result-match {
  background: var(--card-bg);
  border: 1px solid rgba(212,175,55,0.08);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
}

.playin-result-match:hover {
  border-color: rgba(212,175,55,0.22);
  background: linear-gradient(135deg, rgba(6,12,18,0.9), rgba(6,46,56,0.5));
}

.playin-match-left {
  flex: 1;
  text-align: left;
}

.playin-match-center {
  flex: 0 0 auto;
  text-align: center;
  padding: 0 12px;
  min-width: 60px;
}

.playin-match-right {
  flex: 1;
  text-align: right;
}

.playin-team-name {
  font-weight: 500;
  font-size: 14px;
  color: #e5e7eb;
}

.playin-score {
  font-weight: bold;
  font-size: 18px;
  color: var(--primary-blue);
  letter-spacing: 0.05em;
}

.playin-team-name.winner {
  color: var(--accent-gold);
}

.playin-no-match {
  text-align: center;
  padding: 24px;
  color: #6b7280;
  font-style: italic;
}

/* Playoff Bracket Wrapper */
.playoff-bracket-wrapper {
  overflow-x: auto;
  padding: 16px 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.bracket-container {
  display: flex;
  justify-content: flex-start;
  --round-gap: 48px;
  gap: var(--round-gap);
  padding: 20px;
  align-items: stretch;
  position: relative;
  min-width: min-content;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around; /* Ettől lesz "elágazás" formája */
  flex-shrink: 0;
  min-width: 200px;
  position: relative;
}

.round-title {
  position: absolute;
  top: -30px;
  width: 100%;
  font-weight: bold;
  text-align: center;
  font-size: 13px;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.matches {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  justify-content: space-around;
}

/* ÖSSZEKÖTŐ VONALAK LOGIKÁJA */
.bracket-match {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Vonalak és összekötések javítva: rövidebb, középre igazított vízszintes vonal és
   stabilabb függőleges összekötő, hátterezve, hogy a match-box fölött jelenjenek meg */
/* Pseudo-element alapú rövid, stabil összekötők (simple, megbízható) */
.matches { padding-right: 28px; }

.bracket-round:not(:last-child) .bracket-match::after {
  content: "";
  position: absolute;
  right: -24px; /* rövid vízszintes vonal a következő oszlop felé */
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 2px;
  background: rgba(212,175,55,0.38);
  z-index: 1;
  border-radius: 2px;
}

/* Függőleges összekötő 'villa' az odd elemeknél */
.bracket-round:not(:last-child) .bracket-match:nth-child(odd)::before {
  content: "";
  position: absolute;
  right: -24px;
  top: 50%;
  transform: translateY(0%);
  height: calc(100% + 12px);
  width: 2px;
  background: rgba(212,175,55,0.38);
  z-index: 0;
  border-radius: 2px;
}

/* Biztosítsuk, hogy a match-box felül legyen a vonalak fölött */
.match-box { position: relative; z-index: 2; }

/* Kis finomítások a megjelenéshez */
.vs { text-align: center; padding: 6px 0; color: #9ca3af; font-size: 12px; }
.no-match { text-align: center; color: #9ca3af; padding: 14px 6px; }
.bracket-round .matches .bracket-match { padding: 6px 0; min-height: 56px; }

/* Mobilon kisebb szélességek és scroll */
@media (max-width: 1200px) {
  .playoff-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .bracket-container { padding: 20px 10px; --round-gap: 36px; }
  .bracket-round { min-width: 140px; }
  .bracket-round:not(:last-child) .bracket-match::after,
  .bracket-round:not(:last-child) .bracket-match:nth-child(odd)::before {
    right: -16px; width: 16px;
  }
  .playoff-main {
    gap: 16px;
  }
  .playin-result-match {
    padding: 10px;
  }
}

/* Eredeti match-box stílusaid megtartva */
.match-box {
  background: var(--card-bg);
  border: 1px solid rgba(212,175,55,0.08);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  z-index: 2;
}

.match-box:hover {
  border-color: rgba(212,175,55,0.22);
  box-shadow: 0 6px 20px rgba(10,132,255,0.06);
  transform: translateY(-2px);
}

.team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.team.winner {
  background: rgba(212,175,55,0.12);
  font-weight: bold;
  color: var(--accent-gold);
}

.team:last-of-type { border-bottom: none; }

.team-name {
  flex: 1;
  text-align: left;
  font-size: 13px;
  word-break: break-word;
}

.score {
  font-size: 16px;
  font-weight: bold;
  min-width: 30px;
  text-align: right;
  margin-left: 10px;
}

/* ===== BÜNTETŐPONTOK ÉS EGYÉB FIXEK (Eredeti kódod) ===== */

#playin-pair-setup {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
}

.playin-pair-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(2, 6, 23, 0.8);
  padding: 8px;
  border-radius: 10px;
}

.penalty-text { color: #ef4444; font-size: 0.8em; font-weight: bold; margin-left: 5px; }
.penalty-info-card { border-left: 4px solid #ef4444; background: rgba(239, 68, 68, 0.1); padding: 10px; margin-top: 20px; font-size: 13px; }
.penalty-input { width: 60px !important; padding: 4px 8px; text-align: center; border: 1px solid #ef4444; }
.save-penalty-btn { padding: 4px 10px; font-size: 11px; margin-left: 5px; background: linear-gradient(135deg, #10b981, #059669); color: #020617; border-radius: 999px; cursor: pointer; font-weight: bold; }
.penalty-badge { color: #f87171; font-size: 10px; font-weight: bold; display: block; margin-top: 2px; }
.pts-plus { color: var(--accent-gold); font-weight: bold; font-size: 0.8em; }
.pts-minus { color: #ef4444; font-weight: bold; font-size: 0.8em; }