/* Global HCI layout & responsive design */
:root {
    --hci-primary: #003366;
    --hci-primary-light: #285a8f;
    --hci-accent: #ff8800;
    --hci-bg: #f5f5f5;
    --hci-surface: #ffffff;
    --hci-border: #d0d5dd;
    --hci-text: #222222;
    --hci-text-muted: #666666;
}

body.hci-layout {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background-color: var(--hci-bg);
    color: var(--hci-text);
    line-height: 1.5;
}

/* Small utility */
.hci-layout .muted {
    color: var(--hci-text-muted);
}

.hci-layout header {
    background: linear-gradient(90deg, var(--hci-primary), var(--hci-primary-light));
    color: #ffffff;
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.hci-layout header h1,
.hci-layout header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.hci-layout header .user-info {
    font-size: 0.9rem;
    opacity: 0.95;
}

/* Legacy Seiten mit oberster Navigations-Zeile als <p> (z. B. index.php, admin_*.php) */
body.hci-layout > p:first-of-type {
    margin: 0;
    padding: 10px 20px;
    background: linear-gradient(90deg, var(--hci-primary), var(--hci-primary-light));
    color: #ffffff;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

body.hci-layout > p:first-of-type a {
    color: #e5e7eb;
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 999px;
}

body.hci-layout > p:first-of-type a:hover {
    background-color: rgba(15, 23, 42, 0.25);
}


.hci-layout main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

.hci-layout .card,
.hci-layout .box,
.hci-layout .panel {
    background-color: var(--hci-surface);
    border-radius: 10px;
    border: 1px solid var(--hci-border);
    padding: 16px 18px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.hci-layout h1 {
    font-size: 1.6rem;
    margin: 0 0 12px;
}

.hci-layout h2 {
    font-size: 1.25rem;
    margin: 16px 0 10px;
}

.hci-layout h3 {
    font-size: 1.05rem;
    margin: 14px 0 8px;
}

.hci-layout footer {
    max-width: 1100px;
    margin: 10px auto 20px;
    padding: 10px 20px;
    font-size: 0.8rem;
    color: var(--hci-text-muted);
    text-align: right;
}

/* Forms & buttons */
.hci-layout form {
    margin: 0;
}

.hci-layout label {
    font-size: 0.95rem;
    color: var(--hci-text);
}

.hci-layout input[type="text"],
.hci-layout input[type="email"],
.hci-layout input[type="password"],
.hci-layout input[type="number"],
.hci-layout input[type="date"],
.hci-layout input[type="time"],
.hci-layout select,
.hci-layout textarea {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--hci-border);
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    max-width: 100%;
}

.hci-layout textarea {
    min-height: 80px;
    resize: vertical;
}

.hci-layout button,
.hci-layout input[type="submit"],
.hci-layout input[type="button"] {
    padding: 8px 14px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    background-color: var(--hci-primary);
    color: #ffffff;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.hci-layout button:hover,
.hci-layout input[type="submit"]:hover,
.hci-layout input[type="button"]:hover {
    background-color: var(--hci-primary-light);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
    transform: translateY(-1px);
}

.hci-layout .btn-secondary {
    background-color: #e5e7eb;
    color: #111827;
}

.hci-layout .btn-secondary:hover {
    background-color: #d1d5db;
}

.hci-layout .btn-accent {
    background-color: var(--hci-accent);
    color: #111827;
}

/* Tables */
.hci-layout table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background-color: var(--hci-surface);
    border-radius: 8px;
    overflow: hidden;
}

.hci-layout th,
.hci-layout td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--hci-border);
    text-align: left;
    vertical-align: middle;
}

.hci-layout th {
    background-color: #eef2ff;
    font-weight: 600;
    white-space: nowrap;
}

.hci-layout tr:nth-child(even) td {
    background-color: #f9fafb;
}

.hci-layout tr:hover td {
    background-color: #f3f4ff;
}

.hci-layout .table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

/* Utility badges (z. B. Status) */
.hci-layout .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.hci-layout .badge-green {
    background-color: #dcfce7;
    color: #166534;
}

.hci-layout .badge-red {
    background-color: #fee2e2;
    color: #991b1b;
}

.hci-layout .badge-yellow {
    background-color: #fef9c3;
    color: #854d0e;
}

.hci-layout .badge-gray {
    background-color: #e5e7eb;
    color: #374151;
}

/* Messages */
.hci-layout .alert {
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 0.9rem;
}

.hci-layout .alert-success {
    background-color: #ecfdf5;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.hci-layout .alert-error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Tiles grid (start pages) */
.hci-layout .tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.hci-layout .tile {
    display: block;
    text-decoration: none;
    color: var(--hci-text);
    background-color: var(--hci-surface);
    border-radius: 12px;
    padding: 18px 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.1s ease;
}

.hci-layout .tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    background-color: #f8fbff;
}

.hci-layout .tile h2 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}

.hci-layout .tile p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--hci-text-muted);
}

/* Responsive behaviour */
@media (max-width: 900px) {
    .hci-layout main {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .hci-layout header {
        justify-content: center;
        text-align: center;
    }

    .hci-layout footer {
        text-align: center;
        padding: 10px 16px;
    }

    .hci-layout main {
        padding: 12px;
    }

    .hci-layout table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .hci-layout input[type="text"],
    .hci-layout input[type="email"],
    .hci-layout input[type="password"],
    .hci-layout input[type="number"],
    .hci-layout input[type="date"],
    .hci-layout input[type="time"],
    .hci-layout select,
    .hci-layout textarea {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .hci-layout main {
        padding: 10px 8px;
    }

    .hci-layout h1 {
        font-size: 1.3rem;
    }

    .hci-layout h2 {
        font-size: 1.1rem;
    }

    .hci-layout header {
        padding: 10px 12px;
    }
}



/* --- Global Header --- */
.hci-header {
    width: 100%;
    background: linear-gradient(90deg, var(--hci-primary), var(--hci-primary-light));
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.20);
    margin-bottom: 10px;
}
.hci-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.hci-logo {
    height: 40px;
    width: auto;
}
.hci-title {
    font-size: 1.4rem;
    font-weight: 600;
}



/* Clickable title */
.hci-title-link {
    text-decoration: none;
    color: white;
}
.hci-title-link:hover {
    text-decoration: underline;
}


/* Spielinfo-Stil */
.hci-layout .spielinfo-row td.spielinfo-box {
    background-color: #eef2ff;
    border-top: none;
    border-bottom: 1px solid var(--hci-border);
    padding: 10px 14px;
    font-size: 0.95rem;
}

.hci-layout .spielinfo-box strong {
    font-weight: 700;
    margin-right: 6px;
}


/* Info-Boxen für Einteilungsstatus */
.hci-layout .info-box {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Info-Box als eigenständiger Hinweis (z.B. wenn keine Einteilungen vorhanden) */
.hci-layout p.info-box {
    border-radius: 8px;
    padding: 8px 12px;
    margin: 8px 0 12px;
}

.hci-layout p.info-box.info-box--warn {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.hci-layout p.info-box.info-box--ok {
    background-color: #ecfdf5;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Info-Box innerhalb einer Tabelle (z.B. Einteilungsstatus in der Einteilungs-Übersicht) */
.hci-layout td.info-box {
    padding: 6px 10px;
    margin: 0;
    border-radius: 0;
    border: none;
}

.hci-layout td.info-box.info-box--warn {
    background-color: #fef2f2;
    color: #b91c1c;
}

.hci-layout td.info-box.info-box--ok {
    background-color: #ecfdf5;
    color: #166534;
}



/* Spielblock-Rahmen in Einteilungs-Übersicht */
.hci-layout fieldset {
    border: 1px solid var(--hci-border);
    border-radius: 8px;
    padding: 8px 12px 12px;
    margin: 10px 0 16px;
}

.hci-layout fieldset legend {
    font-weight: 600;
    padding: 0 4px;
}








/* Spielkopf (legend) dunkelgrau + weiße Schrift */
.hci-layout fieldset legend {
    display: block;
    background-color: #333333;      /* Dunkelgrau */
    color: #ffffff;                 /* Weiße Schrift */
    border: 1px solid #444444;      /* Etwas hellerer Rand */
    border-radius: 6px;
    padding: 6px 10px;
    margin: 0 0 8px 0;
    font-weight: 600;
}


/* Admin 2-Spalten-Layout für Spiele verwalten */
.admin-flex {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 30px;
    flex-wrap: nowrap;
}


.admin-col-left {
    flex: 0 0 300px;
}


.admin-col-right {
    flex: 1;
    min-width: 400px;
    max-width: 900px;
}

/* früher stacken, damit es auto-responsive wirkt */
@media (max-width: 1200px) {
    .admin-flex {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 30px;
    flex-wrap: nowrap;
}

    .admin-col-left,
    .admin-col-right {
    flex: 1;
    min-width: 400px;
    max-width: 900px;
}
}

    .admin-col-left,
    .admin-col-right {
    flex: 1;
    min-width: 400px;
    max-width: 900px;
}
}


/* Tabellen besser auf Seite anpassen */
.hci-layout table {
    width: 100% !important;
    table-layout: auto;
    overflow-wrap: break-word;
}
.hci-layout th, .hci-layout td {
    word-wrap: break-word;
}

@media (max-width: 800px) {
    .hci-layout table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/* Zusätzliche Handy-Optimierung für Benutzer-Seiten */
@media (max-width: 768px) {
    body.hci-layout {
        padding: 8px;
        font-size: 0.95rem;
    }

    /* Navigation oben: kleinere Schrift, bessere Umbüche */
    body.hci-layout > p:first-of-type {
        font-size: 0.85rem;
        line-height: 1.4;
        padding: 8px 10px;
    }

    /* Tabellen auf Benutzerseiten kompakter */
    .hci-layout table {
        font-size: 0.8rem;
    }

    .hci-layout th,
    .hci-layout td {
        padding: 6px 6px;
    }

    /* Buttons und Formular-Elemente besser klickbar auf Touch */
    .hci-layout button,
    .hci-layout input[type="submit"] {
        width: 100%;
        max-width: 220px;
        margin-top: 6px;
    }

    /* Radio-Gruppen untereinander statt gequetscht nebeneinander */
    .hci-layout td form label {
        display: block;
        margin-bottom: 2px;
    }
}


/* Login-Seite mittig mit Logo */
.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90vh;
    padding: 20px;
}

.login-logo {
    width: 120px;
    margin-bottom: 20px;
}

.login-box {
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    padding: 25px 30px;
    max-width: 350px;
    width: 100%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 20px;
}

.login-box input[type="email"],
.login-box input[type="password"] {
    width: 100%;
    margin-top: 6px;
}

.login-box button {
    width: 100%;
    margin-top: 15px;
}


/* Spezieller Balken im Login-Panel */
.login-title-bar {
    background: var(--hci-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
}

.login-title-logo {
    height: 30px;
    width: auto;
}

.login-title-text {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Filter quer anordnen */
.filter-flex {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: nowrap;
    margin-bottom: 20px;
}

.filter-flex .filter-item {
    display: flex;
    flex-direction: column;
}

.filter-flex button {
    height: 38px;
}

@media (max-width: 900px) {
    .filter-flex {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-flex .filter-item,
    .filter-flex button {
        width: 100%;
    }
}

/* Benutzer-Formular quer ausrichten */
.user-form-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 30px;
    margin-bottom: 25px;
    align-items: center;
}

.user-form-item {
    display: flex;
    flex-direction: column;
    min-width: 220px;
    flex: 1;
}

.user-form-checkboxes {
    display: flex;
    flex-direction: row;
    gap: 16px;
    margin-top: 10px;
}

.user-form-submit {
    align-self: flex-start;
    margin-top: 18px;
}

/* Responsive */
@media (max-width: 900px) {
    .user-form-item {
        min-width: 100%;
    }
    .user-form-checkboxes {
        flex-direction: column;
    }
    .user-form-submit {
        width: 100%;
    }
}

/* Liga-Formular quer ausrichten */
.league-form-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 30px;
    margin-bottom: 25px;
    align-items: flex-end;
}

.league-form-item {
    display: flex;
    flex-direction: column;
    min-width: 220px;
    flex: 1;
}

.league-form-checkbox label {
    margin-top: 10px;
}

.league-form-submit {
    align-self: flex-start;
    margin-top: 18px;
}

/* Responsive */
@media (max-width: 900px) {
    .league-form-item {
        min-width: 100%;
    }
    .league-form-submit {
        width: 100%;
    }
}

/* Spiel-Info kompakt in zwei Spalten */
.game-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    gap: 6px 40px;
    max-width: 700px;
    margin-bottom: 15px;
}

.game-info-item {
    display: flex;
    gap: 6px;
    font-size: 0.95rem;
}

.game-info-item .label {
    font-weight: 600;
    min-width: 110px;
}

@media (max-width: 700px) {
    .game-info-grid {
        grid-template-columns: 1fr;
    }
}



/* Rolle-Spalte schmal halten */
.einteilung-table {
    table-layout: fixed;
    width: 100%;
}

.einteilung-table th:nth-child(1),
.einteilung-table td:nth-child(1) {
    width: 120px;   /* so schmal wie möglich */
}

.einteilung-table th:nth-child(2),
.einteilung-table td:nth-child(2) {
    width: calc(100% - 120px);
}

/* Responsive Einteilungs-Tabelle mit schmaler Rollen-Spalte */
.einteilung-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.einteilung-table {
    width: auto;
    min-width: 380px;
    border-collapse: collapse;
    table-layout: auto;
}

.einteilung-table th:nth-child(1),
.einteilung-table td:nth-child(1) {
    white-space: nowrap;
    width: 1%;
}

.einteilung-table th:nth-child(2),
.einteilung-table td:nth-child(2) {
    width: auto;
}

@media (max-width: 700px) {
    .einteilung-table {
        min-width: 300px;
    }
}

/* Positionen Quer-Layout */
.positions-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 40px;
    padding-left: 0;
}

.positions-flex li {
    list-style: disc;
    margin-left: 20px;
    width: 200px;
}

@media(max-width:700px){
    .positions-flex li { width: 45%; }
}

/* Positionen quer im Grid/Flex anzeigen */
.positions-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 30px;
    padding-left: 18px;
    margin-bottom: 10px;
}

.positions-flex li {
    width: 200px;
}

@media (max-width: 700px) {
    .positions-flex li {
        width: 45%;
    }
}

/* Admin Spiele Tabelle schmaler & responsive */
.admin-spiele-wrapper {
    width: 100%;
    overflow-x: auto;
}

.admin-spiele-table {
    width: auto;
    min-width: 750px;
    table-layout: auto;
    border-collapse: collapse;
}

@media(max-width: 900px){
    .admin-spiele-table {
        min-width: 650px;
    }
}

/* Spiele-Formular quer ausrichten */
.spiel-form-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-bottom: 25px;
    align-items: flex-end;
    max-width: 1100px;
}

.spiel-form-item {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    flex: 1 1 200px;
}

.spiel-form-item label {
    font-weight: 600;
}

.spiel-form-item input,
.spiel-form-item select {
    margin-top: 4px;
}

.spiel-form-submit-wrap {
    flex: 0 0 200px;
}

.spiel-form-submit {
    width: 100%;
    height: 38px;
    margin-top: 4px;
}

/* Mobile */
@media (max-width: 900px) {
    .spiel-form-item {
        min-width: 100%;
        flex: 1 1 100%;
    }
    .spiel-form-submit-wrap {
        flex: 1 1 100%;
    }
}

/* Kleine Danger-Buttons für Aktionen */
.btn.btn-small {
    padding: 4px 10px;
    font-size: 0.85rem;
}

.btn-danger {
    background-color: #b42318;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-danger:hover {
    background-color: #931a12;
}



/* Spiele-Tabelle: nicht über die ganze Seite strecken (Desktop) */
.spiele-table,
.table-spiele,
table.spiele {
  width: auto;
  table-layout: auto;
  display: inline-table;
}
.table-wrapper,
.table-container {
  overflow-x: auto;
}

/* Responsive Benutzer-Menü (Desktop bleibt unverändert) */
.hci-menu {
  margin: 0;
  padding: 10px 0 0 0;
}
.hci-menu-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hci-menu-user {
  font-size: 0.95rem;
}
.hci-menu-toggle {
  display: none;
  border: 1px solid #0b3a66;
  background: #0b3a66;
  color: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}
.hci-menu-links {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.hci-menu-links a {
  text-decoration: none;
  color: #0b3a66;
  font-weight: 600;
}
.hci-menu-links a:hover {
  text-decoration: underline;
}

/* Desktop-Menü im User-Bereich wie im Admin-Bereich (horizontale Leiste).
   Mobile bleibt als Hamburger-Menü (bis inkl. 768px). */
@media (min-width: 769px) {
  .hci-menu {
    margin: 0 0 18px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #2c6a9e, #1f4f7a);
    border: 1px solid rgba(255,255,255,0.18);
  }

  .hci-menu-toggle {
    display: none;
  }

  .hci-menu-links {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
  }

  .hci-menu-links a {
    color: #fff;
    text-decoration: none;
    padding: 0 10px;
    line-height: 1.2;
    position: relative;
    white-space: nowrap;
  }

  .hci-menu-links a:hover {
    text-decoration: underline;
  }

  .hci-menu-links a:not(:last-child)::after {
    content: '|';
    position: absolute;
    right: -2px;
    color: rgba(255,255,255,0.85);
  }

  .hci-menu-user {
    color: #fff;
    font-size: 0.95rem;
    margin-right: 10px;
    white-space: nowrap;
  }
}

@media (max-width: 768px) {
  .hci-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .hci-menu-links {
    display: none;
    width: 100%;
    background: #f7fbff;
    border: 1px solid #d8e7f7;
    border-radius: 12px;
    padding: 10px;
  }
  .hci-menu-links.is-open {
    display: flex;
  }
  .hci-menu-links a {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
  }
  .hci-menu-links a:hover {
    background: #eaf3ff;
    text-decoration: none;
  }
}
