/* ============================================================
   DOWNLOADS-MODUL
============================================================ */

.dl-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.dl-title {
    font-size: var(--fs-h1);
    font-weight: 700;
    margin: 0 0 4px;
}

.dl-sub {
    font-size: 13px;
    color: var(--text-muted);
}

/* ---- Stats ---- */
.dl-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.dl-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.dl-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.dl-stat-val {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.dl-gold { color: var(--accent); }

.dl-stat-date {
    font-size: 14px;
    padding-top: 4px;
}

/* ---- Toolbar ---- */
.dl-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    align-items: center;
    flex-wrap: wrap;
}

.dl-search {
    flex: 1;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.dl-search:focus { outline: none; border-color: var(--accent); }

.dl-sort {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    color: var(--text-secondary);
    font-size: 13px;
    height: 32px;
    cursor: pointer;
}

.dl-view-btns {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.dl-vbtn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 9px;
    height: 32px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    display: flex;
    align-items: center;
}

.dl-vbtn:hover { color: var(--text-primary); }

.dl-vbtn.active {
    background: rgba(224,177,63,0.12);
    border-color: rgba(224,177,63,0.5);
    color: var(--accent);
}

/* ---- Kategorie-Tabs ---- */
.dl-cats {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.dl-cat {
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.dl-cat:hover { color: var(--text-primary); border-color: var(--border-strong); }

.dl-cat.active {
    background: rgba(224,177,63,0.12);
    border-color: rgba(224,177,63,0.5);
    color: var(--accent);
}

/* ---- Sektionsheader ---- */
.dl-sec-head {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-card);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dl-count {
    background: var(--bg-raised);
    border-radius: var(--radius-sm);
    padding: 1px 7px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- Grid ---- */
.dl-grid {
    display: grid;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.dl-grid-1 { grid-template-columns: 1fr; }
.dl-grid-2 { grid-template-columns: repeat(2, 1fr); }
.dl-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dl-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 1400px) { .dl-grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .dl-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 650px)  { .dl-grid-4 { grid-template-columns: 1fr; } }

/* ---- Datei-Karte (Kacheln) ---- */
.dl-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.dl-card:hover { border-color: var(--border-strong); box-shadow: 0 4px 16px rgba(0,0,0,0.25); }

.dl-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.dl-file-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.dl-card-info { flex: 1; min-width: 0; overflow: hidden; }

.dl-file-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    margin-bottom: 4px;
}

/* In der Listen-Ansicht: einzeilig + ellipsis */
.dl-list-row .dl-file-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 17px;
}

.dl-file-desc {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Kategorie-Pills */
.dl-cat-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-top: 5px;
}

.dl-cat-tools    { background: rgba(74,144,226,0.15); color: #4a90e2; }
.dl-cat-maps     { background: rgba(93,202,165,0.15); color: #5DCAA5; }
.dl-cat-patches  { background: rgba(217,83,79,0.15);  color: #d9534f; }
.dl-cat-dokumente{ background: rgba(224,177,63,0.15); color: var(--accent); }
.dl-cat-sonstiges{ background: rgba(136,142,163,0.15);color: var(--text-muted); }

/* Karten-Footer */
.dl-card-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--border-card);
    padding-top: 10px;
    margin-top: auto;
}

.dl-card-meta {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.dl-dl-btn,
.dl-info-btn,
.dl-admin-btn {
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 15px;
    transition: background var(--transition), opacity var(--transition), transform 0.15s;
    text-decoration: none;
    flex-shrink: 0;
    transform-origin: center;
}

/* Download – Akzentfarbe */
.dl-dl-btn {
    background: var(--accent);
    color: var(--accent-text);
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    gap: 5px;
    white-space: nowrap;
}
.dl-dl-btn:hover { background: var(--accent-hover); color: var(--accent-text); transform: scale(1.07); }

/* Info – blau */
.dl-info-btn {
    background: rgba(74,144,226,0.15);
    color: #4a90e2;
    width: 32px;
    border: 1px solid rgba(74,144,226,0.3);
}
.dl-info-btn:hover { background: rgba(74,144,226,0.28); transform: scale(1.07); }

/* Admin – neutral */
.dl-admin-btn {
    background: var(--bg-raised);
    color: var(--text-muted);
    width: 32px;
    border: 1px solid var(--border);
}
.dl-admin-btn:hover { color: var(--text-primary); border-color: var(--border-strong); transform: scale(1.07); }

/* Reihenfolge: Admin | Info | Download */
.dl-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-direction: row-reverse;
    width: 100%;
}
/* Im Grid (Kacheln): Buttons teilen verfügbare Breite */
.dl-grid-4 .dl-card-actions > *,
.dl-grid-3 .dl-card-actions > * { flex: 1; justify-content: center; }
/* In der Liste: Buttons bleiben kompakt */
.dl-list-row .dl-card-actions > * { flex: 0 0 auto; }

/* ---- Leerzustand ---- */
.dl-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.dl-empty p { margin-top: 12px; font-size: 15px; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .dl-stats-row { grid-template-columns: repeat(2, 1fr); }
    .dl-grid-3    { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .dl-stats-row { grid-template-columns: 1fr 1fr; }
    .dl-grid-2,
    .dl-grid-3    { grid-template-columns: 1fr; }
}

/* ============================================================
   DOWNLOADS – ADMIN
============================================================ */

.dl-admin-grid {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.dl-admin-upload-card {
    flex: 0 0 300px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.dl-admin-card-head {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dl-drop-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    color: var(--text-muted);
    font-size: 13px;
}

.dl-drop-zone:hover, .dl-drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(224,177,63,0.05);
}

.dl-drop-zone p { margin-top: 8px; }

.dl-progress-bar {
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    overflow: hidden;
}

.dl-progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.1s;
}

/* Dateiliste */
.dl-admin-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dl-admin-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition);
}

.dl-admin-row:hover { border-color: var(--border-strong); }

.dl-admin-row-info { flex: 1; min-width: 0; }

.dl-admin-row-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.dl-admin-row-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dl-admin-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Modal */
.dl-modal-inner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    width: 480px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

.dl-modal-head {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

@media (max-width: 800px) {
    .dl-admin-grid { flex-direction: column; }
    .dl-admin-upload-card { flex: none; width: 100%; }
}

/* 2-Spalten Layout */
.dl-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) { .dl-layout { grid-template-columns: 1fr; } }

/* Sidebar */
.dl-sidebar { position: sticky; top: 80px; }

/* Kategorie-Buttons */
.dl-cat-list { display: flex; flex-direction: column; gap: 4px; }
.dl-cat-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--bg-raised);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    cursor: pointer;
}
.dl-cat-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.dl-cat-btn.active {
    background: rgba(224,177,63,0.10);
    border-color: rgba(224,177,63,0.35);
    color: var(--accent);
}
.dl-cat-count {
    font-size: 11px;
    background: var(--bg-page);
    border-radius: 10px;
    padding: 1px 8px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.dl-cat-btn.active .dl-cat-count { background: rgba(224,177,63,0.15); color: var(--accent); }

/* btn-sm override für Downloads-Seite */
.dl-page .btn.btn-sm,
.container_content .headline_right .btn.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
    height: 32px;
    border-radius: var(--radius-sm);
}

/* Unterordner-Anzeige im dl-main */
.dl-subfolders {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.dl-subfolder-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 130px;
    height: 130px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    padding: 12px;
    box-sizing: border-box;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.dl-subfolder-btn:hover {
    background: var(--bg-card);
    border-color: var(--border-strong);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.dl-subfolder-btn span:first-of-type {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    text-align: center;
}
.dl-subfolder-btn .dl-cat-count {
    font-size: 11px;
}

/* Listen-Ansicht – 2-spaltige Cards mit Gap */
.dl-list-view {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.dl-list-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    transition: border-color 0.12s, box-shadow 0.12s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.dl-list-row:hover { border-color: var(--border-strong); box-shadow: 0 4px 16px rgba(0,0,0,0.25); }

@media (max-width: 1400px) {
    .dl-list-view { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .dl-list-view { grid-template-columns: 1fr; }
}

/* Listen-Ansicht: kein Grid-Layout auf Container */
.dl-no-grid { display: block; }

/* Breadcrumb */
.dl-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    font-size: 13px;
}
.dl-breadcrumb:empty { display: none; margin-bottom: 0; }
.dl-bc-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.dl-bc-item:hover {
    background: var(--bg-card);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.dl-bc-sep {
    color: var(--text-muted);
    font-size: 11px;
    display: flex;
    align-items: center;
}
.dl-bc-current {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    background: rgba(224,177,63,0.10);
    border: 1px solid rgba(224,177,63,0.35);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
}

/* dl-main Mindesthöhe */
.dl-main { min-height: 235px; }

/* Klickbare Kategorie-Links */
.dl-cat-link {
    text-decoration: none;
    transition: opacity 0.15s;
}
.dl-cat-link:hover { opacity: 0.75; }
