:root {
    --bg: #0f141a;
    --card: #141b23;
    --muted: #7d8b99;
    --txt: #e9eef3;
    --acc: #4aa3ff;
    --danger: #ff5a67;
    --thumb-color: #34c759;
    --noise-thumb-color: #5ac8ff;
    /* Standardfarbe für den Slider-Thumb */
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font: 16px/1.4 system-ui, Segoe UI, Roboto, Ubuntu;
    color: var(--txt);
    background: var(--bg);
}

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #0b1016;
    border-bottom: 1px solid #101923;
}

.topbar h1 {
    font-size: 18px;
    margin: 0;
}

.container {
    max-width: 90%;
    /* Von 1200px auf 90% der Bildschirmbreite geändert */
    padding: 18px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.card {
    background: var(--card);
    border: 1px solid #1f2a35;
    border-radius: 14px;
    padding: 20px;
    /* Mehr Innenabstand */
    width: 100%;
    /* Volle Breite nutzen */
    overflow: auto;
    /* Bei Bedarf scrollbar machen */
}

.card-title {
    color: var(--muted);
    margin-bottom: 10px;
    font-weight: 600;
}

/* Hinzufügen von Card-Header und Card-Body für bessere Strukturierung */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.card-body {
    width: 100%;
    overflow: auto;
    /* Scrollbar für übergroße Inhalte */
}

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

.kpi {
    font-size: 28px;
    font-weight: 700;
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    background: var(--acc);
    border: none;
    color: #001322;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    filter: brightness(1.05);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 6px;
}

.btn--small {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
}

.btn--danger {
    background: var(--danger);
}

.btn-group {
    display: flex;
    gap: 5px;
}

.status {
    color: var(--muted);
    font-size: 14px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid #1f2a35;
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid #1f2a35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ID */
th:nth-child(1),
td:nth-child(1) {
    width: 3%;
}

/* Original */
th:nth-child(2),
td:nth-child(2) {
    width: 10%;
}

/* Beschreibung */
th:nth-child(3),
td:nth-child(3) {
    width: 25%;
}

/* Benutzer */
th:nth-child(4),
td:nth-child(4) {
    width: 8%;
}

/* Größe */
th:nth-child(5),
td:nth-child(5) {
    width: 6%;
}

/* Upload */
th:nth-child(6),
td:nth-child(6) {
    width: 10%;
}

/* Device TS */
th:nth-child(7),
td:nth-child(7) {
    width: 10%;
}

/* Player */
th:nth-child(8),
td:nth-child(8) {
    width: 9%;
}

/* Aktionen */
th:nth-child(9),
td:nth-child(9) {
    width: 20%;
    white-space: nowrap;
}

/* Action links and buttons more compact layout */
td:nth-child(9) .link,
td:nth-child(9) .btn {
    white-space: nowrap;
    display: inline-block;
}

/* Make action buttons more compact */
td:nth-child(9) {
    padding-right: 16px;
}

th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
}

.search {
    margin-left: auto;
    background: #0f151c;
    border: 1px solid #1f2a35;
    color: var(--txt);
    padding: 8px 10px;
    border-radius: 10px;
    min-width: 220px;
}

a.link {
    color: var(--acc);
    text-decoration: none;
}

a.link:hover {
    text-decoration: underline;
}

.link--disabled {
    color: #5a6a7b;
    cursor: not-allowed;
    text-decoration: none;
}

.link--disabled:hover {
    text-decoration: none;
}

.badge {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #263748;
    color: var(--muted);
    font-size: 12px;
}

.badge--muted {
    color: #5a6a7b;
    border-color: #1a2431;
}

/* Description Input Field */
.description-input {
    width: 100%;
    background: #0f151c;
    border: 1px solid #1f2a35;
    color: var(--txt);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.2s;
}

.description-input:focus {
    outline: none;
    border-color: var(--acc);
}

.description-input::placeholder {
    color: #5a6a7b;
}

.toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    background: #0b1016;
    border: 1px solid #203041;
    color: var(--txt);
    padding: 12px 14px;
    border-radius: 12px;
}

/* Audio Processing Styles */
.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-description {
    color: var(--muted);
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.slider {
    flex: 1;
    height: 12px;
    background: linear-gradient(to right,
            #34c759 0%,
            #5ac8ff 30%,
            #ff9500 70%,
            #ff2d55 100%);
    border-radius: 6px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    margin: 10px 0;
}

.noise-slider {
    background: linear-gradient(to right,
            #4aa3ff 0%,
            #a359ff 50%,
            #ff4747 100%);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--thumb-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

.noise-slider::-webkit-slider-thumb {
    background: var(--noise-thumb-color);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--thumb-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

.noise-slider::-moz-range-thumb {
    background: var(--noise-thumb-color);
}

/* Intensitätsvisualisierung */
.intensity-bar {
    height: 6px;
    background: linear-gradient(to right,
            #34c759 0%,
            #34c759 30%,
            #ffcc00 30%,
            #ffcc00 70%,
            #ff5a67 70%,
            #ff5a67 100%);
    border-radius: 3px;
    margin: 12px 0 4px 0;
    position: relative;
}

.intensity-marker {
    position: absolute;
    bottom: 16px;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--muted);
}

.intensity-marker span {
    position: relative;
    top: -5px;
}

.intensity-level {
    font-size: 12px;
    color: var(--muted);
    position: relative;
    margin-top: 2px;
}

.filter-intensity {
    position: relative;
    margin: 25px 0 30px;
}

.intensity-bar {
    position: relative;
    height: 10px;
    background: #0f151c;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.intensity-zone {
    position: absolute;
    top: 0;
    height: 100%;
}

.zone-fine {
    left: 0;
    width: 30%;
    background: linear-gradient(to right, #34c759, #5ac8ff);
}

.zone-medium {
    left: 30%;
    width: 40%;
    background: linear-gradient(to right, #5ac8ff, #ff9500);
}

.zone-strong {
    left: 70%;
    width: 30%;
    background: linear-gradient(to right, #ff9500, #ff2d55);
}

.intensity-marker {
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: -3px;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
    z-index: 2;
    transition: left 0.1s ease-out;
}

.intensity-marker.fine {
    background: #34c759;
}

.intensity-marker.medium {
    background: #ff9500;
}

.intensity-marker.strong {
    background: #ff2d55;
}

.intensity-labels {
    display: flex;
    position: relative;
    margin-bottom: 20px;
}

.intensity-label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--muted);
}

.intensity-levels {
    display: flex;
    justify-content: space-between;
}

.intensity-level {
    width: 33.33%;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.intensity-level.level-fine {
    color: #34c759;
    text-align: left;
}

.intensity-level.level-medium {
    color: #ff9500;
}

.intensity-level.level-strong {
    color: #ff2d55;
    text-align: right;
}

.file-select {
    background: #0f151c;
    border: 1px solid #1f2a35;
    color: var(--txt);
    padding: 10px 14px;
    border-radius: 10px;
    min-width: 280px;
    flex: 1;
    font-size: 15px;
}

.btn--success {
    background: #34c759;
}

.btn--small {
    padding: 4px 8px;
    font-size: 12px;
}

.has-processed {
    color: #34c759;
    font-weight: 600;
}

/* Audio Player Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card);
    border: 1px solid #1f2a35;
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 90%;
    overflow: auto;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #1f2a35;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--muted);
    cursor: pointer;
}

.close-btn:hover {
    color: var(--txt);
}

.modal-body {
    padding: 24px;
}

.player-container {
    margin-bottom: 16px;
}

.player-container audio {
    width: 100%;
    background: #0b1016;
    border-radius: 12px;
}

.player-controls {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.player-source-toggle {
    display: flex;
    gap: 16px;
    justify-content: center;
    background: #0b1016;
    padding: 8px 12px;
    border-radius: 8px;
}

.player-source-toggle label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.hidden {
    display: none !important;
}

/* Unterstützung für das hidden-Attribut */
[hidden] {
    display: none !important;
}

.btn--play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #20384d;
    margin-left: 0;
    min-width: 110px;
    transition: background-color 0.2s;
}

.btn--play:hover {
    background: #2a4b66;
}

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

    .span-2 {
        grid-column: auto;
    }

    /* Für Mobilgeräte: kleinere Schriftgröße und Padding */
    th,
    td {
        padding: 8px;
        font-size: 14px;
    }

    /* Verstecke weniger wichtige Spalten auf Mobilgeräten */
    th:nth-child(5),
    td:nth-child(5),
    /* Device TS */
    th:nth-child(4),
    td:nth-child(4) {
        /* Upload */
        display: none;
    }

    /* Spaltenbreiten für Mobilgeräte anpassen */
    th:nth-child(1),
    td:nth-child(1) {
        width: 10%;
    }

    /* ID */
    th:nth-child(2),
    td:nth-child(2) {
        width: 25%;
    }

    /* Beschreibung */
    th:nth-child(3),
    td:nth-child(3) {
        width: 30%;
    }

    /* Größe */
    th:nth-child(6),
    td:nth-child(6) {
        width: 15%;
    }

    /* Filter */
    th:nth-child(7),
    td:nth-child(7) {
        width: 15%;
    }

    /* Player */
    th:nth-child(8),
    td:nth-child(8) {
        width: 20%;
    }

    /* Aktionen */
}
/* ===== Utility Classes (CSP-compliant) ===== */
.hidden, .d-none { display: none !important; }
.d-flex { display: flex !important; }
.flex-row { flex-direction: row; }
.align-items-center { align-items: center; }
.gap-10 { gap: 10px; }
.flex-1 { flex: 1; }
.max-w-500 { max-width: 500px; margin: 0 auto; }
.max-w-600 { max-width: 600px; margin: 0 auto; }
.color-warning { color: #ffa500; }

/* Modal hidden by default */
.modal { display: none; }
.modal.modal-visible { display: flex !important; }
/* Description input initially hidden */
.description-input { display: none; }
/* Data container elements */
#deleteAudioUrl, #csrfToken, #toggleUserUrl { display: none; }
