:root {
  --bg: #fff;
  --fg: #222;
  --muted: #666;
  --accent: #0b57d0;
  --table-border: #e6e6e6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

/* -------------------------------------------------- */
/*  LOGIN MODAL                                        */
/* -------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 10px;
  width: 90%;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: fadeIn 0.25s ease;
}

.modal-content h2 {
  margin-top: 0;
  text-align: center;
  color: var(--accent);
}

.modal-content label {
  display: block;
  margin-top: 12px;
  font-weight: 500;
}

.modal-content input {
  width: 100%;
  padding: 8px 10px;
  margin-top: 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font: inherit;
}

.name-display {
  display: inline-block;
  font-weight: 700;
  color: #0b57d0;
  background: #e8efff;
  border: 1px solid #bed3ff;
  border-radius: 8px;
  padding: 3px 8px;
  margin: 6px 0 12px 0;
}

.name-display.demanded {
  font-size: 1.2rem;
  padding: 6px 14px;
  font-weight: 800;
}

.modal-content .btn-login {
  width: 100%;
  margin-top: 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.modal-content .btn-login:hover {
  opacity: 0.85;
}

.modal-content .close {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 1.3rem;
  color: #555;
  cursor: pointer;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -------------------------------------------------- */
/*  HEADER & NAVIGATION (Desktop + Mobile)             */
/* -------------------------------------------------- */

header {
  background: #0b57d0;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

/* Header Logo (links) */
.header-logo {
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  order: 0;
  display: none;
}

.header-logo:hover {
  opacity: 0.9;
}

/* Desktop: 3-spaltig Layout */
.desktop-nav {
  display: flex;
  gap: 20px;
  order: 1;
  flex: 1;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  order: 2;
  flex: 1;
}

.desktop-auth {
  display: flex;
  gap: 15px;
  align-items: center;
  order: 3;
  flex: 1;
  justify-content: flex-end;
}

header .logo {
  font-size: 1.4rem;
  font-weight: 600;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
}

nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

nav a:hover {
  opacity: 0.8;
}

nav a.active {
  border-bottom: 2px solid #fff;
  padding-bottom: 2px;
}

.hamburger {
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  display: none;
  padding: 0;
  margin: 0;
  margin-left: auto;
}

.loggedIn {
  display: none;
}

.loggedOut {
  display: inline;
}

/* -------------------------------------------------- */
/*  MOBILE HEADER & HAMBURGER MENU                    */
/* -------------------------------------------------- */

/* Mobile Layout */
@media (max-width: 700px) {
  header {
    flex-direction: row;
    justify-content: space-between;
    padding: 12px 16px;
  }

  .header-logo {
    order: 0;
    display: block;
    font-size: 1.3rem;
  }

  .header-center {
    flex: 1;
    order: 1;
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
  }

  header .logo {
    margin: 0;
    font-size: 1.3rem;
    color: #d32f2f;
    font-weight: 700;
  }

  .desktop-nav,
  .desktop-auth {
    display: none !important;
  }

  .hamburger {
    display: block;
    order: 2;
  }
}

/* Mobile Navigation Content */
.mobile-nav-content {
  width: 90%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mobile-nav-content .close {
  position: static;
  font-size: 1.3rem;
  color: #555;
  cursor: pointer;
  text-align: left;
  align-self: flex-start;
  margin-bottom: 8px;
  background: none;
  border: none;
  padding: 0;
}

/* Mobile Notification Bell */
.mobile-bell {
  color: white;
  font-size: 1.2rem;
  text-align: center;
  display: block;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

/* Mobile Auth Section */
.mobile-auth-section {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 12px;
}

.mobile-auth-section a {
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  text-align: center;
}

.mobile-auth-section a:last-child {
  border-bottom: none;
}

.mobile-auth-section a:hover {
  background: #f5f5f5;
}

/* Mobile Nav Links */
.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mobile-nav-links a {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  text-align: center;
}

.mobile-nav-links a:last-child {
  border-bottom: none;
}

.mobile-nav-links a:hover {
  background: #f5f5f5;
}

/* -------------------------------------------------- */
/*  HAUPTLAYOUT (Content + Sidebar)                     */
/* -------------------------------------------------- */

main {
  display: grid;
  grid-template-columns: 1fr 280px;
  /* Inhalt | Sidebar */
  gap: 20px;
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 16px;
}

section,
.sidebar {
  background: #fff;
  border: 1px solid var(--table-border);
  border-radius: 10px;
  padding: 20px;
}

section {
  background: #fafafa;
}

.sidebar {
  background: #f9fafc;
}

/* -------------------------------------------------- */
/*  Allgemeine Gestaltung und Tabellen                 */
/* -------------------------------------------------- */

.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
}

.header a.logo {
  text-decoration: none;
  color: var(--fg);
  font-weight: 600;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  margin-right: 12px;
}

.nav a.active {
  color: var(--accent);
  font-weight: 600;
}

.container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 16px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--table-border);
  text-align: left;
}

.table th {
  background: #fafafa;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
  background: #f3f6fc;
  color: #2d5bd1;
}

.note {
  color: var(--muted);
  font-size: 0.95rem;
}

.footer,
footer {
  padding: 16px;
  color: var(--muted);
  border-top: 1px solid #eee;
  text-align: center;
}

select,
input[type="date"] {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font: inherit;
  color: inherit;
}

/* -------------------------------------------------- */
/*  PYRAMIDEN-DESIGN (aus deiner bestehenden Datei)    */
/* -------------------------------------------------- */

.pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 32px;
  margin-bottom: 40px;
  padding: 8px;
}

.row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.box {
  width: 120px;
  height: 60px;
  border: 3px solid var(--table-border);
  border-radius: 15px;
  background: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--fg);
  cursor: grab;
  user-select: none;
  transition:
    background 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.box:hover {
  background: #eaf1fb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.dragging {
  opacity: 0.6;
  background: #dce4f5;
  cursor: grabbing;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.box.selected {
  border-color: #0b57d0;
  background: #eaf1fb;
}

.box.challengeable {
  border-color: #2ecc71;
  background: #e6f9e8;
}

/* -------------------------------------------------- */
/*  MATCHCARDS (neues Layout für matches.html)        */
/* -------------------------------------------------- */

.matches-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
}

.match-card {
  background: #fff;
  border: 1px solid var(--table-border);
  border-radius: 20px;
  padding: 16px 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  position: relative;
}

.match-date {
  font-weight: 600;
  color: var(--accent);
  position: absolute;
  top: 10px;
  left: 20px;
  font-size: 0.95rem;
}

.match-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  /* Platz fürs Datum */
  flex-wrap: wrap;
  gap: 12px;
}

.team {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 120px;
}

.player {
  font-weight: 500;
  color: var(--fg);
}

.player.sub {
  color: var(--muted);
  font-style: italic;
}

.vs {
  font-weight: 600;
  color: var(--accent);
  font-size: 1.1rem;
}

.sets {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 60px;
}

.set {
  font-weight: 600;
  color: var(--fg);
  font-size: 1rem;
}

@media (max-width: 700px) {
  .match-card {
    padding: 12px 16px;
  }

  .match-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    gap: 8px;
  }

  .team {
    flex: 1;
    min-width: auto;
    align-items: flex-start;
  }

  .player {
    font-size: 0.95rem;
  }

  .vs {
    font-size: 0.9rem;
    flex-shrink: 0;
    margin: 0 4px;
  }

  .sets {
    min-width: 50px;
    gap: 2px;
  }

  .set {
    font-size: 0.95rem;
  }

  .match-date {
    position: static;
    margin-bottom: 6px;
    font-size: 0.85rem;
  }
}

/* -------------------------------------------------- */
/*  RESPONSIVES LAYOUT                                */
/* -------------------------------------------------- */

@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }
}

/* -------------------------------------------------- */
/*  NOTIFICATION BELL                                 */
/* -------------------------------------------------- */

.notification-bell {
  color: white;
  font-size: 1.2rem;
}

.notification-bell:hover {
  opacity: 0.8;
}

#notificationBadge {
  display: none;
}

/* -------------------------------------------------- */
/*  CHALLENGE LIST IN NOTIFICATION MODAL              */
/* -------------------------------------------------- */

#challengeList {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.challenge-item {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.challenge-item p {
  margin: 0;
  font-size: 0.95rem;
}

.challenger-name {
  font-weight: 800;
  color: #d9534f;
}

.challenge-item input[type="date"],
.challenge-item input[type="text"] {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}

.challenge-item .set-date-btn {
  margin-top: 4px;
  padding: 8px;
  background: #0b57d0;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.challenge-item .set-date-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.challenge-item .set-date-btn:hover:not(:disabled) {
  opacity: 0.85;
}

/* -------------------------------------------------- */
/*  DROPDOWN NAVIGATION                               */
/* -------------------------------------------------- */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown > .dropbtn {
  cursor: pointer;
  pointer-events: none;
}

.dropdown > .dropbtn-active {
  cursor: pointer;
  pointer-events: auto;
  border-bottom: 2px solid #fff;
  padding-bottom: 2px;
}

.dropdown-content {
  display: none;
  position: absolute;
  background: white;
  min-width: 150px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  z-index: 100;
  top: 100%;
  left: 0;
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-content a {
  color: var(--fg);
  padding: 10px 14px;
  text-decoration: none;
  display: block;
  font-size: 0.95rem;
  border-bottom: 1px solid #eee;
}

.dropdown-content a:last-child {
  border-bottom: none;
}

.dropdown-content a:hover {
  background: #f5f5f5;
}

.dropdown-content a.active {
  color: var(--accent);
  font-weight: 600;
}

/* -------------------------------------------------- */
/*  PREMATCH STATUS BADGES                            */
/* -------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-offen {
  background: #fff3cd;
  color: #856404;
}

.badge-bestaetigt {
  background: #d4edda;
  color: #155724;
}

.badge-gespielt {
  background: #cce5ff;
  color: #004085;
}

.badge-abgelaufen {
  background: #f8d7da;
  color: #721c24;
}

.badge-ergebnis {
  background: #e2e3e5;
  color: #383d41;
}

/* -------------------------------------------------- */
/*  MATCH CARD STATUS                                 */
/* -------------------------------------------------- */

.match-card.status-offen {
  border-left: 4px solid #ffc107;
}

.match-card.status-bestaetigt {
  border-left: 4px solid #28a745;
}

.match-card .match-status {
  position: absolute;
  top: 10px;
  right: 14px;
}

.match-card .match-date {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.match-card {
  position: relative;
}

/* -------------------------------------------------- */
/*  ACTION BUTTONS                                    */
/* -------------------------------------------------- */

.action-area {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.btn-action {
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.btn-action:hover {
  opacity: 0.85;
}

.btn-action:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.waiting-text {
  color: var(--muted);
  font-style: italic;
  font-size: 0.9rem;
}

/* -------------------------------------------------- */
/*  RESULT MODAL                                      */
/* -------------------------------------------------- */

.satz-input-group {
  margin-bottom: 12px;
}

.satz-input-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.satz-input-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

.loading-text {
  color: var(--muted);
  font-style: italic;
}

.debug-info {
  font-size: 0.8rem;
  color: #999;
  margin-top: 10px;
}

/* -------------------------------------------------- */
/*  MATCH CARD SETS AREA                              */
/* -------------------------------------------------- */

.sets {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 60px;
}

.set {
  font-weight: 600;
  color: var(--fg);
  font-size: 1rem;
}

@media (max-width: 700px) {
  .match-content {
    flex-direction: column;
    align-items: center;
  }

  .action-area {
    text-align: center;
    margin-top: 10px;
  }

  .dropdown-content {
    left: auto;
    right: 0;
  }
}

/* -------------------------------------------------- */
/*  RESPONSIVE HEADER (Hamburger Menu)                */
/* -------------------------------------------------- */

@media (max-width: 900px) {
  .hamburger-btn {
    display: block;
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px 10px;
  }

  .main-nav, .auth-buttons, .logo {
    display: none !important;
  }

  header {
    padding: 10px 16px;
  }

  .header-bar {
    justify-content: center !important;
  }
}

@media (min-width: 901px) {
  .hamburger-btn {
    display: none;
  }
}

/* -------------------------------------------------- */
/*  RESPONSIVE LAYOUT                                  */
/* -------------------------------------------------- */

@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr !important;
  }

  .sidebar {
    order: 2;
  }
}

/* -------------------------------------------------- */
/*  RESPONSIVE MATCH CARDS                             */
/* -------------------------------------------------- */

@media (max-width: 600px) {
  .match-card {
    padding: 10px 12px;
  }

  .match-date {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }

  /* Horizontal layout - lang gezogenes Rechteck */
  .match-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .team {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 0.9rem;
  }

  .vs {
    font-size: 1rem;
    flex-shrink: 0;
  }

  .action-area {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
  }

  .sets {
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
    align-items: center;
  }

  .set {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    min-width: 35px;
    text-align: center;
  }
}

/* -------------------------------------------------- */
/*  RESPONSIVE TABLE                                   */
/* -------------------------------------------------- */

@media (max-width: 600px) {
  .table {
    font-size: 0.85rem;
  }

  .table th, .table td {
    padding: 8px 6px;
  }
}

/* -------------------------------------------------- */
/*  RESPONSIVE PYRAMID                                 */
/* -------------------------------------------------- */

@media (max-width: 768px) {
  .pyramid {
    gap: 15px;
    padding: 4px;
  }

  .row {
    gap: 10px;
  }

  .box {
    width: 100px;
    height: 50px;
    font-size: 0.9rem;
    border-width: 2px;
  }
}

@media (max-width: 480px) {
  .pyramid {
    gap: 10px;
  }

  .row {
    gap: 8px;
  }

  .box {
    width: 85px;
    height: 45px;
    font-size: 0.8rem;
    border-radius: 10px;
  }
}