/* ÖWR Rettungssport - Optimierte Stilvorlage */

:root {
    /* Primäre Farben */
    --primary: #0055a4;
    --primary-light: #3a7cb7;
    --primary-dark: #00417b;
    --secondary: #e30613;
    --accent: #f6a800;
    
    /* Neutrale Farben */
    --white: #ffffff;
    --light: #f4f6f9;
    --grey-light: #e9ecef;
    --grey: #adb5bd;
    --dark: #343a40;
    --black: #212529;
    
    /* Schattierungen & Effekte */
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition: all 0.2s ease-in-out;
    
    /* Abstände */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Ränder */
    --border-radius-sm: 0.25rem;
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    --border-radius-xl: 1rem;
}

/* ============================================
   Grundlegende Stile
   ============================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light);
    color: var(--black);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 56px;
}

/* ============================================
   Navigationsleiste
   ============================================ */

.navbar {
    background-color: var(--primary);
    box-shadow: var(--shadow-sm);
    padding: 0.5rem 1rem;
}

.navbar-brand {
    font-weight: 600;
    color: var(--white);
}

.navbar-brand:hover {
    color: var(--white);
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link:focus,
.nav-link.active {
    color: var(--white);
}

.navbar-toggler {
    color: var(--white);
    border: none;
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow);
    border-radius: var(--border-radius);
}

.language-selector .btn {
    font-weight: 500;
}

/* ============================================
   Hauptinhalt
   ============================================ */

.main-content {
    flex: 1;
    padding: var(--spacing-lg) 0;
}

.page-title {
    margin-bottom: var(--spacing-lg);
    font-weight: 600;
    color: var(--primary-dark);
}

/* ============================================
   Karten
   ============================================ */

.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
    background-color: var(--white);
}

.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.card-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--grey-light);
    padding: var(--spacing);
    font-weight: 600;
}

.card-body {
    padding: var(--spacing);
}

.card-footer {
    background-color: var(--white);
    border-top: 1px solid var(--grey-light);
    padding: var(--spacing);
}

.card.border-primary:hover {
    box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.15);
}

.card.border-success:hover {
    box-shadow: 0 0.5rem 1rem rgba(25, 135, 84, 0.15);
}

/* Event-Karten */
.event-card .card-img-top {
    height: 200px;
    object-fit: cover;
}

.event-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
}

/* ============================================
   Hero-Sektion
   ============================================ */

.hero-section {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: var(--spacing-xl) 0;
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
}

.hero-section h1 {
    font-weight: 700;
}

.hero-section .btn-outline-light:hover {
    background-color: var(--white);
    color: var(--primary);
}

/* ============================================
   Tabellen
   ============================================ */

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--grey-light);
    color: var(--dark);
    font-weight: 600;
    border-top: none;
    padding: 0.75rem 1rem;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 86, 164, 0.05);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 86, 164, 0.1);
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

/* Sortierbare Tabellen */
th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 1.5rem !important;
}

th.sortable::after {
    content: "\f0dc";
    font-family: "Font Awesome 6 Free";  /* ← Version 6 */
    font-weight: 900;
    position: absolute;
    right: 0.5rem;
    color: var(--grey);
    opacity: 0.5;
}

th.sortable.sort-asc::after {
    content: "\f0de";
    color: var(--primary);
    opacity: 1;
}

th.sortable.sort-desc::after {
    content: "\f0dd";
    color: var(--primary);
    opacity: 1;
}

/* Tabellen-Pagination */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background-color: var(--white);
    border-top: 1px solid var(--grey-light);
    font-size: 0.875rem;
}

.table-pagination-info {
    color: var(--grey);
}

.table-pagination-buttons {
    display: flex;
    align-items: center;
}

.table-pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    margin: 0 0.125rem;
    color: var(--primary);
    background-color: var(--white);
    border: 1px solid var(--grey-light);
    border-radius: var(--border-radius);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.table-pagination-button:hover {
    background-color: var(--grey-light);
    text-decoration: none;
}

.table-pagination-button.active {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.table-pagination-button.disabled {
    color: var(--grey);
    background-color: var(--grey-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.table-pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    color: var(--grey);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    font-weight: 500;
    padding: 0.375rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.2rem;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #c70512;
    border-color: #c70512;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--primary);
    color: var(--white);
}

.btn-outline-success {
    color: #198754;
    border-color: #198754;
}

.btn-outline-success:hover {
    background-color: #198754;
    color: #fff;
}

.btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

.btn-outline-danger:hover {
    background-color: #dc3545;
    color: #fff;
}

.btn-outline-light {
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-outline-light:hover {
    color: var(--primary);
    background-color: var(--white);
    border-color: var(--white);
}

/* Mode Switcher */
.mode-switcher .btn {
    border-radius: 0;
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.mode-switcher .btn:first-child {
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
}

.mode-switcher .btn:last-child {
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

/* NT Toggle Button */
.nt-toggle-btn {
    width: 55px;
    min-width: 55px;
    max-width: 55px;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}

.nt-toggle-btn:hover {
    transform: scale(1.05);
}

.nt-toggle-btn.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

/* ============================================
   Formulare
   ============================================ */

.form-control,
.form-select {
    border-radius: var(--border-radius);
    border: 1px solid var(--grey-light);
    padding: 0.375rem 0.75rem;
    background-color: var(--white);
    color: var(--black);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(0, 86, 164, 0.25);
    background-color: var(--white);
}

.form-control:disabled,
.form-control:read-only,
.form-select:disabled {
    background-color: #f8f9fa;
    border-color: #ced4da;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 1;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.form-check-input:checked[type="checkbox"] {
    background-color: #28a745;
    border-color: #28a745;
}

.form-control-sm,
.form-select-sm {
    font-size: 0.875rem;
}

/* Auto-Fill Styling */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--white) inset !important;
    -webkit-text-fill-color: var(--black) !important;
    border: 1px solid var(--grey-light) !important;
}

/* Input-Gruppen */
.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group > .form-control,
.input-group > .form-select {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--dark);
    text-align: center;
    white-space: nowrap;
    background-color: var(--grey-light);
    border: 1px solid var(--grey-light);
    border-radius: var(--border-radius);
}

/* Zeit-Eingabe Felder */
.input-group.input-group-sm {
    width: 150px;
    max-width: 150px;
}

.input-group.input-group-sm .time-input,
.input-group.input-group-sm .relay-time-input {
    text-align: center;
    font-weight: 400;
    font-size: 0.875rem;
    width: 95px;
    padding: 0.25rem 0.5rem;
}

.time-input[data-has-existing="true"],
.relay-time-input[data-has-existing="true"] {
    border-color: #28a745;
}

.time-display {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    padding: 0.375rem 0.5rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid #ced4da;
    display: inline-block;
    min-width: 80px;
    text-align: center;
}

.license-display {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    background-color: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid #e9ecef;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

/* ============================================
   Listen
   ============================================ */

.list-group {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.list-group-item {
    border: 1px solid var(--grey-light);
    padding: var(--spacing);
    transition: var(--transition);
}

.list-group-item-action:hover {
    background-color: rgba(0, 86, 164, 0.05);
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.alert-info {
    background-color: #cff4fc;
    color: #055160;
}

.flash-message {
    margin-top: var(--spacing);
}

/* ============================================
   Badges
   ============================================ */

.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

.badge-primary {
    background-color: var(--primary);
}

.badge-secondary {
    background-color: var(--secondary);
}

.badge-accent {
    background-color: var(--accent);
}

/* ============================================
   Modals
   ============================================ */

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body hr {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-body h6 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #495057;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
}

.modal-lg {
    max-width: 800px;
}

.modal-xl {
    max-width: 1140px;
}

/* ============================================
   Tabs
   ============================================ */

.nav-tabs {
    border-bottom-color: var(--grey-light);
}

.nav-tabs .nav-link {
    color: var(--grey);
    border: none;
    padding: 0.75rem 1rem;
    font-weight: 500;
    margin-bottom: -1px;
}

.nav-tabs .nav-link:hover,
.nav-tabs .nav-link:focus {
    border-color: transparent;
    color: var(--primary);
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    background-color: transparent;
}

/* ============================================
   Pagination
   ============================================ */

.pagination .page-link {
    border: none;
    color: var(--primary);
    padding: 0.5rem 0.75rem;
    font-weight: 500;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    color: white;
}

.pagination .page-link:hover {
    background-color: var(--grey-light);
    color: var(--primary-dark);
}

/* ============================================
   Footer
   ============================================ */

.app-footer {
    background-color: var(--primary);
    color: var(--white);
    padding: var(--spacing-md) 0;
    margin-top: auto;
}

.app-footer a {
    color: rgba(255, 255, 255, 0.8);
    margin-left: var(--spacing);
    text-decoration: none;
    transition: var(--transition);
}

.app-footer a:hover {
    color: var(--white);
    text-decoration: underline;
}

.copyright {
    font-weight: 500;
}

/* ============================================
   Ergebnis-Eingabe
   ============================================ */

.results-table {
    font-size: 0.9rem;
}

.results-table .result-input {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.results-table .result-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
    border-color: #28a745 !important;
    transform: scale(1.02);
    z-index: 10;
    position: relative;
}

.results-table .result-input:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

.results-table .result-input.border-warning {
    border-color: #ffc107 !important;
    background-color: #fff3cd !important;
}

.results-table .result-input.border-success {
    border-color: #28a745 !important;
    background-color: #d4edda !important;
}

.results-table .result-input.border-danger {
    border-color: #dc3545 !important;
    background-color: #f8d7da !important;
}

.results-table .result-input.border-info {
    border-color: #17a2b8 !important;
    background-color: #d1ecf1 !important;
}

.result-entry-row {
    transition: all 0.2s ease;
}

.result-entry-row:hover {
    background-color: rgba(0, 123, 255, 0.1) !important;
    transform: translateX(2px);
}

.lane-number {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    font-weight: bold;
    border-right: 3px solid #dee2e6;
}

.lane-number .badge {
    font-size: 1rem;
    padding: 0.5rem;
}

.status-cell i {
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.status-cell small {
    font-weight: 500;
    font-size: 0.75rem;
}

/* ============================================
   Animationen
   ============================================ */

@keyframes pulse-save {
    0% { 
        box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.4);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 0 0.6rem rgba(13, 110, 253, 0.1);
        transform: scale(1.02);
    }
    100% { 
        box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.4);
        transform: scale(1);
    }
}

@keyframes pulse-success {
    0% { transform: scale(1); }
    25% { transform: scale(1.05); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.result-input.border-info {
    animation: pulse-save 1.5s infinite;
}

.result-input.border-success {
    animation: pulse-success 0.8s ease-out;
}

.result-input.border-danger {
    animation: shake 0.5s ease-out;
}

/* ============================================
   Spezielle Komponenten
   ============================================ */

.team-name {
    font-weight: bold;
    color: #333;
}

.team-name:hover {
    color: #0d6efd;
    text-decoration: underline;
}

.open-water-event {
    background-color: #e7f3ff;
}

.circle-seeding-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #f8f9fa 100%);
    border-left: 4px solid #2196f3;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border-radius: var(--border-radius-sm);
}

.circle-seeding-info .seeding-lanes {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.circle-seeding-info .lane-box {
    width: 30px;
    height: 30px;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    background: #fff;
}

.circle-seeding-info .lane-box.center {
    background: #2196f3;
    color: white;
    border-color: #1976d2;
}

.circle-seeding-info .lane-box.secondary {
    background: #81c784;
    color: white;
    border-color: #66bb6a;
}

.lazy-placeholder {
    background: linear-gradient(45deg, #f8f9fa 25%, transparent 25%), 
                linear-gradient(-45deg, #f8f9fa 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f8f9fa 75%), 
                linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lazy-placeholder:hover {
    background-color: rgba(13, 110, 253, 0.1);
    border-color: #0d6efd;
}

/* ============================================
   Responsive Anpassungen
   ============================================ */

@media (max-width: 991px) {
    .row.g-3 {
        margin-bottom: 1.5rem !important;
    }
    
    .card.h-100 {
        margin-bottom: 1rem;
    }
}

/* Überschreibe Bootstrap's Media Query - Input-Gruppe bleibt horizontal */
@media (max-width: 767.98px) {
  .input-group.input-group-sm {
    flex-direction: row !important;
  }
}

/* Verhindere flex-wrap aus Bootstrap */
.input-group.input-group-sm {
  display: inline-flex !important;
  flex-wrap: nowrap !important;
  flex-direction: row !important;
  width: 150px;
  min-width: 150px;
}

.input-group.input-group-sm .relay-time-input,
.input-group.input-group-sm .time-input {
  font-family: 'Inter', sans-serif;
  text-align: center;
  font-weight: 400;
  font-size: 0.875rem;
  width: 95px !important;
  min-width: 95px !important;
  flex: 0 0 95px !important;
  padding: 0.25rem 0.5rem;
}

.nt-toggle-btn,
.nt-toggle-btn-relay {
  width: 55px !important;
  min-width: 55px !important;
  max-width: 55px !important;
  flex: 0 0 55px !important;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  transition: all 0.2s ease;
}

.nt-toggle-btn:hover,
.nt-toggle-btn-relay:hover {
  transform: scale(1.05);
}

.nt-toggle-btn.btn-success,
.nt-toggle-btn-relay.btn-success {
  background-color: #28a745;
  border-color: #28a745;
  color: white;
}

/* Bestehende Zeiten hervorheben */
.time-input[data-has-existing="true"],
.relay-time-input[data-has-existing="true"] {
  border-color: #28a745;
}

/* OpenWater Events */
.open-water-event {
  background-color: #e7f3ff;
}

@media (max-width: 480px) {
    .navbar-brand span {
        font-size: 0.9rem;
    }
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
    body.dark-mode {
        background-color: var(--dark);
        color: var(--light);
    }
    
    body.dark-mode .card {
        background-color: var(--black);
        border-color: var(--dark);
    }
    
    body.dark-mode .table {
        color: var(--light);
    }
    
    body.dark-mode .table thead th {
        background-color: var(--dark);
        color: var(--light);
    }
    
    body.dark-mode .table-striped tbody tr:nth-of-type(odd) {
        background-color: rgba(255, 255, 255, 0.05);
    }
    
    .event-card .card-header {
        background: linear-gradient(135deg, #343a40 0%, #495057 100%);
        color: #f8f9fa;
    }
    
    .time-display {
        background: linear-gradient(135deg, #495057 0%, #6c757d 100%);
        color: #f8f9fa;
        border-color: #6c757d;
    }
    
    .license-display {
        background-color: #495057;
        color: #f8f9fa;
        border-color: #6c757d;
    }
    
    .circle-seeding-info {
        background: linear-gradient(135deg, #1e3a5f 0%, #2c3e50 100%);
        border-left-color: #3498db;
        color: #ecf0f1;
    }
}
/* Feste Breite für die letzte Spalte in der Zeiten-Tabelle (Einzeldisziplinen) */
#timesModal table td:last-child,
#timesModal table th:last-child {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
}

/* Feste Breite für Zeitspalte bei Staffeln (3. Spalte in der Staffeltabelle) */
.table-responsive table tbody tr td:nth-child(3) {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
}

/* Verhindere Umbruch in der Input-Gruppe */
.input-group.input-group-sm {
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    width: 150px;
}

.input-group.input-group-sm .time-input,
.input-group.input-group-sm .relay-time-input {
    font-family: 'Inter', sans-serif;
    text-align: center;
    font-weight: 400;
    font-size: 0.875rem;
    width: 95px !important;
    min-width: 95px !important;
    flex: 0 0 95px !important;
    padding: 0.25rem 0.5rem;
}

.nt-toggle-btn {
    width: 55px !important;
    min-width: 55px !important;
    max-width: 55px !important;
    flex: 0 0 55px !important;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}

.nt-toggle-btn:hover {
    transform: scale(1.05);
}

.nt-toggle-btn.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

/* Bestehende Zeiten hervorheben */
.time-input[data-has-existing="true"],
.relay-time-input[data-has-existing="true"] {
    border-color: #28a745;
}

/* OpenWater Events */
.open-water-event {
    background-color: #e7f3ff;
}
/* Beide Varianten des NT-Buttons stylen */
.nt-toggle-btn,
.nt-toggle-btn-relay {
    width: 55px !important;
    min-width: 55px !important;
    max-width: 55px !important;
    flex: 0 0 55px !important;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}
/* Staffel-Tabelle scrollbar machen */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
    width: 100%;
}

.table-responsive table {
    width: auto;
    min-width: 100%;
    table-layout: auto;
}

/* Spaltenbreiten optimieren */
.table-responsive table tbody tr td:nth-child(1) {
    min-width: 220px; /* Bewerb mit ID */
}

.table-responsive table tbody tr td:nth-child(2) {
    min-width: 170px; /* Meldezeit + NT Button */
    max-width: 170px;
}

/* Positionen-Spalten */
.table-responsive table tbody tr td:nth-child(3),
.table-responsive table tbody tr td:nth-child(4),
.table-responsive table tbody tr td:nth-child(5),
.table-responsive table tbody tr td:nth-child(6) {
    min-width: 200px;
    max-width: 220px;
}

/* Athleten-Dropdowns optimieren */
select[name^="relay_positions"] {
    width: 100%;
    font-size: 0.875rem;
}

/* Nachnamen in GROSSBUCHSTABEN - nur die Nachnamen! */
select[name^="relay_positions"] option {
    /* Entferne text-transform hier, machen wir stattdessen in PHP */
}
/* Kompakte Tabellen-Ansicht */
#compactEventTable {
    font-size: 0.9rem;
}

#compactEventTable th {
    background-color: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#compactEventTable tbody tr:hover {
    background-color: #f1f3f5;
}

/* Sticky Header und erste Spalte */
#compactEventTable thead th {
    position: sticky;
    top: 0;
    z-index: 20;
}

/* Responsive Scrolling */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Toggle Switch Styling */
.form-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
}

.form-switch .form-check-input:checked {
    background-color: #0d6efd;
}
/* Kompakte Zeit-Editor */
.compact-time-editor {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.compact-time-input {
    font-size: 0.875rem;
}

.compact-time-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.compact-time-cell {
    padding: 0.5rem 0.25rem !important;
}
/* ============================================================================
   LIVETIMING.PHP - CSS STYLES
   Fügen Sie diesen Code in Ihre Haupt-CSS-Datei ein
   ============================================================================ */

/* Custom Styles für internes Livetiming */
.session-card {
    border-left: 4px solid var(--primary);
}

.session-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.event-card {
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.result-highlight {
    border-left: 3px solid #ffc107;
}

/* User-Entry hat Vorrang vor result-highlight */
.user-entry.result-highlight {
    border-left: 5px solid #198754 !important;
}

.inline-view {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.inline-view table {
    margin-bottom: 0;
}

.inline-view .table th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.back-button {
    position: sticky;
    top: 70px;
    z-index: 100;
    background: white;
    padding: 15px 0;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
}

/* Styles für Detail-Ansichten */
.discipline-details {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    margin-top: 8px;
}

.discipline-badge {
    display: inline-block;
    background: white;
    border: 1px solid #dee2e6;
    padding: 4px 8px;
    margin: 2px;
    border-radius: 4px;
    font-size: 0.85em;
}

.member-details {
    background: #e7f3ff;
    padding: 6px 10px;
    border-radius: 4px;
    margin: 3px 0;
    border-left: 3px solid var(--primary);
}

.relay-details {
    background: #fff3cd;
    padding: 6px 10px;
    border-radius: 4px;
    margin: 3px 0;
    border-left: 3px solid #ffc107;
}

/* User's own entries highlighting - MODERN DESIGN */
.user-entry {
    border-left: 5px solid #198754 !important;
    box-shadow: 0 2px 4px rgba(25, 135, 84, 0.1) !important;
    transition: all 0.2s ease;
}

.user-entry:hover {
    box-shadow: 0 3px 6px rgba(25, 135, 84, 0.15) !important;
}

.user-entry-name {
    font-weight: 600 !important;
    color: #0a4d2e !important;
    letter-spacing: 0.3px;
}

.user-entry-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #198754 0%, #157347 100%) !important;
    color: white !important;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-left: 8px;
    box-shadow: 0 2px 4px rgba(25, 135, 84, 0.3);
    text-transform: uppercase;
    vertical-align: middle;
}

.user-entry-badge::before {
    content: "★";
    margin-right: 4px;
    font-size: 1.1em;
}

/* Purple button styles für Gesamt-Startliste - NEU! */
.btn-purple {
    background-color: #6f42c1;
    border-color: #6f42c1;
    color: white;
}

.btn-purple:hover {
    background-color: #5a32a3;
    border-color: #5a32a3;
    color: white;
}

.text-purple {
    color: #6f42c1 !important;
}

.livetiming-hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 2rem 0;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.livetiming-hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
}

.livetiming-hero-content {
    position: relative;
    z-index: 1;
}

/* ============================================
   MOBILE OPTIMIERUNGEN FÜR STARTLISTEN UND ERGEBNISSE
   ============================================ */
@media (max-width: 767.98px) {
    /* Container weniger Padding auf Mobile */
    .inline-view {
        padding: 8px !important;
    }
    
    /* Startlisten - Bahn breiter, Name deutlich schmaler */
    .inline-view table th:nth-child(1),
    .inline-view table td:nth-child(1) {
        width: 45px !important;
        min-width: 45px !important;
        max-width: 45px !important;
        padding: 0.5rem 0.3rem !important;
    }
    
    .inline-view table th:nth-child(2),
    .inline-view table td:nth-child(2) {
        width: 50% !important;
        max-width: 160px !important;
        padding: 0.5rem 0.3rem !important;
        overflow: hidden;
    }
    
    .inline-view table th:nth-child(3),
    .inline-view table td:nth-child(3) {
        width: 80px !important;
        min-width: 80px !important;
        max-width: 80px !important;
        padding: 0.5rem 0.3rem !important;
        text-align: right !important;
    }
    
    /* Ergebnisse - Platz breiter, Name deutlich schmaler, Zeit breiter */
    .inline-view .table-responsive table th:nth-child(1),
    .inline-view .table-responsive table td:nth-child(1) {
        width: 45px !important;
        min-width: 45px !important;
        max-width: 45px !important;
        padding: 0.5rem 0.25rem !important;
    }
    
    .inline-view .table-responsive table th:nth-child(2),
    .inline-view .table-responsive table td:nth-child(2) {
        width: 40% !important;
        max-width: 140px !important;
        padding: 0.5rem 0.3rem !important;
        overflow: hidden;
    }
    
    .inline-view .table-responsive table th:nth-child(3),
    .inline-view .table-responsive table td:nth-child(3) {
        width: 75px !important;
        min-width: 75px !important;
        max-width: 75px !important;
        padding: 0.5rem 0.3rem !important;
        text-align: right !important;
    }
    
    /* Zeit-Zelle explizit rechtsbündig */
    .inline-view .table-responsive table td.text-end {
        text-align: right !important;
    }
    
    .inline-view .table-responsive table th:nth-child(4),
    .inline-view .table-responsive table td:nth-child(4) {
        width: 45px !important;
        min-width: 45px !important;
        max-width: 45px !important;
        padding: 0.5rem 0.2rem !important;
        text-align: center !important;
    }
    
    /* Open Water Events (ohne Zeit-Spalte) - mehr Platz für Namen */
    .inline-view .table-responsive table.open-water-table th:nth-child(2),
    .inline-view .table-responsive table.open-water-table td:nth-child(2) {
        width: 60% !important;
        max-width: 200px !important;
    }
    
    .inline-view .table-responsive table.open-water-table th:nth-child(3),
    .inline-view .table-responsive table.open-water-table td:nth-child(3) {
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
    }
    
    /* Namen und Vereinsnamen kompakter darstellen */
    .inline-view table .fw-bold.small {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .inline-view table small.text-muted {
        display: block !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }
    
    /* User-Entry Badge auf Mobile minimalistisch */
    .user-entry-badge {
        font-size: 0.5em !important;
        padding: 1px 3px !important;
        margin-left: 2px !important;
        border-radius: 4px !important;
    }
    
    .user-entry-badge::before {
        content: "★" !important;
        font-size: 0.8em !important;
        margin-right: 1px !important;
    }
}

/* Für sehr kleine Smartphones (unter 375px) */
@media (max-width: 374.98px) {
    .user-entry-badge {
        display: none !important;
    }
    
    .inline-view table th:nth-child(1),
    .inline-view table td:nth-child(1) {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
    }
    
    .inline-view table th:nth-child(2),
    .inline-view table td:nth-child(2) {
        max-width: 140px !important;
    }
    
    .inline-view table th:nth-child(3),
    .inline-view table td:nth-child(3) {
        width: 75px !important;
        min-width: 75px !important;
        max-width: 75px !important;
    }
    
    .inline-view .table-responsive table th:nth-child(1),
    .inline-view .table-responsive table td:nth-child(1) {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
    }
    
    .inline-view .table-responsive table th:nth-child(2),
    .inline-view .table-responsive table td:nth-child(2) {
        max-width: 120px !important;
    }
}

/* Externes Livetiming Styles */
.tab-content > .tab-pane {
    display: none;
}

.tab-content > .active {
    display: block;
}

.pagination {
    margin-bottom: 0;
}

/* ============================================
   STARTLISTEN/ERGEBNISSE TABELLEN - DESKTOP OPTIMIERUNG
   ============================================ */

/* Allgemeine Tabellen-Optimierung für Startlisten-Verwaltung */
.card-body .heats-container table,
.heats-container .table {
    font-size: 0.95rem !important; /* Größere Schrift am Desktop */
    table-layout: fixed !important;
    width: 100% !important;
}

.card-body .heats-container table th,
.card-body .heats-container table td,
.heats-container .table th,
.heats-container .table td {
    padding: 0.5rem 0.4rem !important; /* Mehr Padding für bessere Lesbarkeit */
    vertical-align: middle !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* DESKTOP: Spaltenbreiten für Startlisten-Tabelle - Normale Schriftgröße */
@media (min-width: 992px) {
    /* Bahn-Spalte (Spalte 1) */
    .card-body .heats-container table th:nth-child(1),
    .card-body .heats-container table td:nth-child(1),
    .heats-container .table th:nth-child(1),
    .heats-container .table td:nth-child(1) {
        width: 55px !important;
        min-width: 55px !important;
        max-width: 55px !important;
        text-align: center !important;
        padding: 0.5rem 0.3rem !important;
    }
    
    /* Name-Spalte (Spalte 2) */
    .card-body .heats-container table th:nth-child(2),
    .card-body .heats-container table td:nth-child(2),
    .heats-container .table th:nth-child(2),
    .heats-container .table td:nth-child(2) {
        width: 17% !important;
        min-width: 120px !important;
        max-width: 170px !important;
        padding: 0.5rem 0.4rem !important;
    }
    
    /* Lizenz-Spalte (Spalte 3) */
    .card-body .heats-container table th:nth-child(3),
    .card-body .heats-container table td:nth-child(3),
    .heats-container .table th:nth-child(3),
    .heats-container .table td:nth-child(3) {
        width: 75px !important;
        min-width: 75px !important;
        max-width: 75px !important;
        text-align: center !important;
        font-family: 'Courier New', monospace !important;
        font-weight: 600 !important;
        padding: 0.5rem 0.3rem !important;
    }
    
    /* Club-Spalte (Spalte 4) */
    .card-body .heats-container table th:nth-child(4),
    .card-body .heats-container table td:nth-child(4),
    .heats-container .table th:nth-child(4),
    .heats-container .table td:nth-child(4) {
        width: 23% !important;
        min-width: 140px !important;
        max-width: 190px !important;
        padding: 0.5rem 0.4rem !important;
    }
    
    /* Verband-Spalte (Spalte 5) */
    .card-body .heats-container table th:nth-child(5),
    .card-body .heats-container table td:nth-child(5),
    .heats-container .table th:nth-child(5),
    .heats-container .table td:nth-child(5) {
        width: 19% !important;
        min-width: 120px !important;
        max-width: 170px !important;
        padding: 0.5rem 0.4rem !important;
    }
    
    /* Meldezeit-Spalte (Spalte 6) */
    .card-body .heats-container table th:nth-child(6),
    .card-body .heats-container table td:nth-child(6),
    .heats-container .table th:nth-child(6),
    .heats-container .table td:nth-child(6) {
        width: 75px !important;
        min-width: 75px !important;
        max-width: 75px !important;
        text-align: center !important;
        font-family: 'Courier New', monospace !important;
        font-weight: 600 !important;
        padding: 0.5rem 0.3rem !important;
    }
    
    /* Zusätzliche Buttons/Actions Spalte falls vorhanden (Spalte 7) */
    .card-body .heats-container table th:nth-child(7),
    .card-body .heats-container table td:nth-child(7),
    .heats-container .table th:nth-child(7),
    .heats-container .table td:nth-child(7) {
        width: 65px !important;
        min-width: 65px !important;
        max-width: 65px !important;
        text-align: center !important;
        padding: 0.5rem 0.3rem !important;
    }
}

/* TABLET: Kompaktere Darstellung */
@media (min-width: 768px) and (max-width: 991px) {
    .card-body .heats-container table,
    .heats-container .table {
        font-size: 0.85rem !important;
    }
    
    .card-body .heats-container table th,
    .card-body .heats-container table td,
    .heats-container .table th,
    .heats-container .table td {
        padding: 0.4rem 0.3rem !important;
    }
}

/* SMARTPHONE: Scrollen erlauben, keine Größeneinschränkungen */
@media (max-width: 767px) {
    /* Entferne alle width-Beschränkungen auf Mobile */
    .card-body .heats-container table,
    .heats-container .table {
        table-layout: auto !important; /* Auto layout für natürliche Breiten */
        font-size: 0.9rem !important;
    }
    
    .card-body .heats-container table th,
    .card-body .heats-container table td,
    .heats-container .table th,
    .heats-container .table td {
        padding: 0.4rem !important;
        white-space: normal !important; /* Erlaube Zeilenumbruch auf Mobile wenn nötig */
    }
    
    /* Stelle sicher dass horizontal gescrollt werden kann */
    .heats-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Optional: Mindestbreiten für Mobile um Lesbarkeit zu garantieren */
    .card-body .heats-container table th,
    .card-body .heats-container table td {
        min-width: 60px !important;
    }
    
    .card-body .heats-container table th:nth-child(2),
    .card-body .heats-container table td:nth-child(2),
    .card-body .heats-container table th:nth-child(4),
    .card-body .heats-container table td:nth-child(4),
    .card-body .heats-container table th:nth-child(5),
    .card-body .heats-container table td:nth-child(5) {
        min-width: 120px !important;
    }
}

/* Pulse-Animation für aktuelles Event */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 0 0 15px rgba(13, 110, 253, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

.pulse-highlight {
    animation: pulse 1s ease-in-out 3;
    border: 3px solid #0d6efd !important;
}

/* Optionale zusätzliche Hervorhebung */
#current-event {
    scroll-margin-top: 100px; /* Abstand vom oberen Rand beim Scrollen */
}

/* ============================================
   FIX: Veranstaltungsübersicht 2-Spalten Layout  
   Korrigiert Layout-Problem auf breiten Bildschirmen
   ============================================ */
@media (min-width: 992px) {
    /* Container breiter machen für 2-Spalten-Ansicht */
    .main-content .container {
        max-width: 1320px;
    }
}

@media (min-width: 1400px) {
    /* Noch breiter auf sehr großen Bildschirmen */
    .main-content .container {
        max-width: 1400px;
    }
}

@media (min-width: 1600px) {
    .main-content .container {
        max-width: 1500px;
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }
}