/* Ergänzungen für User Management */

/* Formular-Styling */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--txt);
}

.form-control {
    width: 100%;
    padding: 10px;
    background: var(--bg);
    border: 1px solid #1f2a35;
    border-radius: 8px;
    color: var(--txt);
    font-size: 16px;
}

.form-control:focus {
    border-color: var(--acc);
    outline: none;
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.form-check-input {
    margin-right: 8px;
}

.form-check-label {
    color: var(--txt);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    background: #1f2a35;
    color: var(--txt);
}

.badge.success {
    background: #34c759;
    color: #001f0e;
}

.badge.danger {
    background: var(--danger);
    color: #1a0005;
}

.badge.primary {
    background: var(--acc);
    color: #001322;
}

/* Button Varianten */
.btn.btn-success {
    background: #34c759;
    color: #001f0e;
}

.btn.btn-danger {
    background: var(--danger);
    color: #1a0005;
}

.btn.btn-primary {
    background: var(--acc);
    color: #001322;
}

/* Margin Utilities */
.mb-3 {
    margin-bottom: 1.5rem;
}

/* Meldungen */
.message {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: #1f2a35;
    color: var(--txt);
}

.message.error {
    background: rgba(255, 90, 103, 0.2);
    border-left: 4px solid var(--danger);
    color: #ff8e99;
}

.message.warning {
    background: rgba(255, 163, 26, 0.15);
    border-left: 4px solid #ffa31a;
    color: #ffb84d;
}

.message.rate-limit {
    background: rgba(255, 163, 26, 0.12);
    border-left: 3px solid #ffa31a;
    color: #ffb84d;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
}

.message.rate-limit .icon {
    font-size: 20px;
    color: #ffa31a;
    flex-shrink: 0;
}

.message.rate-limit .content {
    flex: 1;
}

.message.rate-limit .title {
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #ffcc80;
}

.message.rate-limit .description {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Tabellen */
.table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    /* Automatische Breitenanpassung */
}

.table-responsive {
    overflow-x: auto;
    /* Horizontales Scrollen für zu breite Tabellen */
    width: 100%;
    -webkit-overflow-scrolling: touch;
    /* Besseres Scrollen auf Touch-Geräten */
}

.table th,
.table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #1f2a35;
    word-break: normal;
    /* Verhindert harte Zeilenumbrüche */
    overflow: hidden;
    text-overflow: ellipsis;
    /* Bei Überlauf mit Ellipsen darstellen */
}

.table th {
    color: var(--muted);
    font-weight: 600;
}

/* Spaltenbreiten für Benutzerverwaltung (nicht Dashboard) */
body:not(.dashboard) .table td:nth-child(1),
/* ID */
body:not(.dashboard) .table th:nth-child(1) {
    width: 5%;
    min-width: 40px;
}

body:not(.dashboard) .table td:nth-child(9),
/* Dateien */
body:not(.dashboard) .table th:nth-child(9) {
    width: 8%;
    min-width: 60px;
}

body:not(.dashboard) .table td:last-child,
/* Aktionen */
body:not(.dashboard) .table th:last-child {
    width: 18%;
    min-width: 200px;
}

/* Dashboard-spezifische Spaltenbreiten */
/* Nur für Dashboard-Tabelle */
.dashboard table {
    table-layout: fixed !important;
    /* Fixed layout für volle Kontrolle */
}

.dashboard .table th:nth-child(1),
/* Original-Dateiname */
.dashboard .table td:nth-child(1) {
    width: 16% !important;
    /* !important überschreibt style.css */
    min-width: 180px !important;
}

.dashboard .table th:nth-child(2),
/* Beschreibung */
.dashboard .table td:nth-child(2) {
    width: 21% !important;
    min-width: 180px !important;
}

.dashboard .table th:nth-child(3),
/* Größe */
.dashboard .table td:nth-child(3) {
    width: 5% !important;
    min-width: 80px !important;
}

.dashboard .table th:nth-child(4),
/* Hochgeladen */
.dashboard .table td:nth-child(4) {
    width: 10% !important;
    min-width: 120px !important;
}

.dashboard .table th:nth-child(5),
/* Aktionen */
.dashboard .table td:nth-child(5) {
    width: 20% !important;
    min-width: 200px !important;
}

/* Button-Gruppe in Tabellen */
.btn-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    /* Mehr Abstand zwischen Buttons */
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

.btn-group .btn {
    white-space: nowrap;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    /* Mindestbreite für Buttons */
}

.btn-sm {
    padding: 8px 12px;
    /* Etwas größere Buttons */
    font-size: 14px;
    border-radius: 6px;
}

.table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Buttons */
.btn-primary {
    background: var(--acc);
    color: #001322;
}

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

.btn-danger {
    background: var(--danger);
    color: #1a0005;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle::after {
    content: "▾";
    margin-left: 6px;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    min-width: 160px;
    background: var(--card);
    border: 1px solid #1f2a35;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.dropdown-content a {
    display: block;
    padding: 10px 14px;
    color: var(--txt);
    text-decoration: none;
}

.dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Hilfstexte */
.hint {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    margin: 10% auto;
    width: 90%;
    max-width: 500px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

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

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

.modal-body {
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 14px 16px;
    border-top: 1px solid #1f2a35;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

/* Range inputs */
input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--thumb-color);
    border-radius: 50%;
    cursor: pointer;
}

.range-values {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--acc);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-indicator {
    text-align: center;
    padding: 20px;
}

/* Helpers */
.hidden {
    display: none;
}

.mt-3 {
    margin-top: 15px;
}

.text-center {
    text-align: center;
}

.spacer {
    flex-grow: 1;
}

/* Media queries */
@media (max-width: 1200px) {
    .container {
        max-width: 95%;
        /* Fast volle Breite auf kleineren Bildschirmen */
    }

    .grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 900px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        padding: 8px 6px;
    }

    .btn-group {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-group .btn {
        margin-bottom: 5px;
    }
}

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

    .container {
        padding: 10px;
    }

    .table-responsive {
        margin: 0 -10px;
        padding: 0 10px;
    }

    .topbar {
        flex-wrap: wrap;
    }
}

/* Description Cell Styles */
.description-cell {
    position: relative;
}

.description-text {
    display: inline-block;
    color: var(--txt);
}

.description-cell .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-cell .description-input:focus {
    outline: none;
    border-color: var(--acc);
}

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

.btn-edit-description {
    background: var(--acc);
    color: #001322;
}

.btn-edit-description:hover {
    opacity: 0.9;
}

/* User Filter Dropdown - Monospace für spaltenähnliche Ausrichtung */
#userFilter {
    font-family: 'SF Mono', 'Consolas', 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    letter-spacing: 0.3px;
}

#userFilter option {
    font-family: 'SF Mono', 'Consolas', 'Monaco', 'Menlo', monospace;
}