
/* ======================================================================
   dirlist.css – Konsolidierter Stylesheet für index.php Directory-Listing
   ====================================================================== */

/* ---------- Variablen ---------- */
:root{
  --bg:#f6f7fb; --card:#ffffff; --muted:#64748b; --text:#0f172a; --accent:#2563eb; --line:#e5e7eb;
  --icon-w: 1.25em;       /* Breite des 📂-Icons */
  --icon-gap: 12px;       /* Abstand Icon → Titel */
  --hover-bg: rgba(0,0,0,.05);
}

/* ---------- Basis ---------- */
*{box-sizing:border-box}
html, body{ -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

.container{max-width:1100px;margin:0 auto;padding:24px}
.header{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between;margin-bottom:16px}
.header-left{display:flex;align-items:center;gap:12px}
.logo{height:56px;width:auto;display:block}
.brand{display:inline-flex;align-items:center;text-decoration:none}
.title{font-size:22px;font-weight:700}
.breadcrumbs{display:flex;gap:8px;flex-wrap:wrap;color:var(--muted);font-size:14px;align-items:center}
.breadcrumbs a{color:var(--accent);text-decoration:none}

/* Button "← Accueil" */
.btn-home{display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--accent);text-decoration:none;font-weight:600}
.btn-home:hover{background:#f8fafc}

.card{background:var(--card);border:1px solid var(--line);border-radius:14px;box-shadow:0 4px 10px rgba(0,0,0,.06)}
.toolbar{display:flex;gap:12px;align-items:center;padding:12px;border-bottom:1px solid var(--line)}
label.opt{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--muted);user-select:none}
input[type="search"]{flex:1;min-width:200px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#ffffff;color:#0f172a}
.badge{display:inline-block;padding:2px 8px;border:1px solid var(--line);border-radius:999px;font-size:12px;color:var(--muted)}
.badge-link{font-size:11px;color:#2e7d32;border-color:#2e7d32}

/* ---------- Tabelle ---------- */
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:12px 14px;border-bottom:1px solid var(--line);text-align:left}
.table th{font-weight:600;color:var(--muted);white-space:nowrap}
.table a{color:var(--text);text-decoration:none}

/* Spalten "Taille" & "Modifié" ausblenden (Header + Body), via .hide-sm */
.hide-sm{display:none !important}

/* Player nicht im Kopf anzeigen */
thead .file-audio, thead audio{display:none !important}

/* Zeilenhover */
.row{transition:background .15s}
.row:hover{background:rgba(0,0,0,.03)}

/* ---------- Erste Spalte: Name/Icon links, Player rechts ---------- */
tbody td:first-child{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  overflow:hidden;          /* verhindert Überragen nach rechts */
}

tbody td:first-child .icon{ flex:0 0 auto; width: var(--icon-w); display:inline-block; text-align:center; }

/* Dateiname flexibel mit Ellipsis */
tbody td:first-child a{
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Player rechts: elastische Breite + darf schrumpfen */
tbody td:first-child .file-audio{
  margin-left:auto;
  flex:0 1 clamp(300px, 48vw, 560px);
  max-width:100%;
  display:inline-block;
}
tbody td:first-child .file-audio audio{
  display:block;
  width:100% !important;
  max-width:none !important;
}

/* ---------- Top-Level (is-top) – bündige Description unter Titel ---------- */
table.table tbody tr.is-top > td:first-child .topflex{
  display:grid;
  grid-template-columns: var(--icon-w) 1fr;   /* Spalte 1: Icon | Spalte 2: Text */
  column-gap: var(--icon-gap);
  row-gap: 2px;
  align-items: baseline;
}
/* Icon in Spalte 1 */
table.table tbody tr.is-top > td:first-child .topflex .icon{
  grid-column:1; text-align:center; width:var(--icon-w); display:inline-block;
}
/* Titel in Spalte 2 */
table.table tbody tr.is-top > td:first-child .topflex > a{ grid-column:2; }
/* Description exakt unter dem Titel, kursiv */
table.table tbody tr.is-top > td:first-child .topflex .root-desc{
  grid-column:2;
  margin-top:2px;
  opacity:.85;
  font-size:.9em;
  font-style:italic;
}

/* ---------- „Kachel“-Interaktion: ganze erste Zelle klickbar + Overlay ---------- */
tbody tr.row > td.firstcol{ position:relative; cursor:pointer; }
tbody tr.row > td.firstcol::before{
  content:""; position:absolute; inset:0; background:var(--hover-bg);
  opacity:0; transition:opacity .12s ease; pointer-events:none; border-radius:6px;
}
tbody tr.row:hover > td.firstcol::before{ opacity:1; }

/* Einheitlicher Hand-Cursor in der Kachel */
tbody tr.row > td.firstcol,
tbody tr.row > td.firstcol a,
tbody tr.row > td.firstcol .icon,
tbody tr.row > td.firstcol .root-desc{ cursor:pointer; }

/* Interaktive Controls: Standard-Cursor */
tbody tr.row > td.firstcol audio,
tbody tr.row > td.firstcol button,
tbody tr.row > td.firstcol input,
tbody tr.row > td.firstcol select,
tbody tr.row > td.firstcol label,
tbody tr.row > td.firstcol textarea{ cursor:auto; }

/* Keine Textauswahl über dem Titel */
tbody tr.row > td.firstcol a,
tbody tr.row > td.firstcol a *{
  -webkit-user-select:none; -moz-user-select:none; user-select:none;
}

/* ---------- Footer ---------- */
.footer{padding:12px;color:var(--muted);font-size:12px;text-align:right}

/* ---------- Responsive ---------- */
@media (orientation: landscape) and (max-width: 920px){
  tbody td:first-child .file-audio{ flex-basis: clamp(260px, 42vw, 480px); }
}
@media (max-width: 600px){
  tbody td:first-child{ flex-wrap:wrap; }
  tbody td:first-child .file-audio{ flex:1 0 100%; }
  tbody td:first-child .file-audio audio{ width:100% !important; }
}
@media (max-width: 720px){
  .hide-sm{ display:none !important; }
}

/* ---------- Auto-Dark-Mode (optional dezent) ---------- */
@media (prefers-color-scheme: dark){
  body{ color:#e8e8e8; background:#111; }
  thead th, tbody td{ border-color:#2a2a2a; }
  table{ border-color:#2a2a2a; }
  tbody tr:hover{ background:rgba(255,255,255,0.06); }
  a{ color:#aad0ff; }
}
