* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; margin: 0; background: #f5f5f5; color: #1a1a1a; }
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-box { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1); width: 320px; }
.auth-box h1 { font-size: 1.25rem; margin: 0 0 1rem; }
.auth-box label { display: block; margin-top: .75rem; font-size: .875rem; }
.auth-box input { width: 100%; padding: .5rem; margin-top: .25rem; border: 1px solid #ccc; border-radius: 4px; }
.auth-box button { width: 100%; margin-top: 1.25rem; padding: .6rem; background: #1a1a1a; color: #fff; border: 0; border-radius: 4px; cursor: pointer; }
.alert-error { background: #fdecea; color: #b3261e; padding: .5rem .75rem; border-radius: 4px; font-size: .875rem; }
.topbar { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.5rem; background: #fff; border-bottom: 1px solid #e0e0e0; }
.topbar span { margin-left: auto; color: #555; font-size: .875rem; }
.topbar .version-tag { font-size: .6875rem; color: #999; background: #f0f0f0; padding: .05rem .4rem; border-radius: 3px; font-weight: 500; margin-left: 0; text-decoration: none; }
.topbar .version-tag:hover { background: #e0e0e0; color: #555; }

/* Changelog-Seite: gerendertes Markdown aus SimpleMarkdown */
.markdown-content { max-width: 760px; }
.markdown-content h1 { font-size: 1.4rem; margin: 0 0 1rem; }
.markdown-content h2 { font-size: 1.15rem; margin: 1.75rem 0 .5rem; border-bottom: 1px solid #eee; padding-bottom: .35rem; }
.markdown-content h2:first-child { margin-top: 0; }
.markdown-content h3 { font-size: .95rem; margin: 1rem 0 .35rem; color: #444; }
.markdown-content p { line-height: 1.5; margin: .5rem 0; }
.markdown-content ul { margin: .35rem 0 .75rem; padding-left: 1.4rem; }
.markdown-content li { line-height: 1.5; margin: .2rem 0; }
.markdown-content code { background: #f5f5f5; padding: .1rem .35rem; border-radius: 3px; font-size: .875em; }
.markdown-content a { color: #1a56c4; }
.markdown-content hr { border: none; border-top: 1px solid #eee; margin: 1.5rem 0; }
main { padding: 1.5rem; }
.alert-success { background: #e6f4ea; color: #1e7e34; padding: .5rem .75rem; border-radius: 4px; font-size: .875rem; margin-bottom: 1rem; }
.alert-error { margin-bottom: 1rem; }
.browser { max-width: 900px; margin: 0 auto; }
.breadcrumbs { margin-bottom: 1rem; font-size: .875rem; color: #555; }
.breadcrumbs a { color: #1a1a1a; text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.panel { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.panel h2 { font-size: 1rem; margin: 0 0 .75rem; }
.muted { color: #777; font-size: .875rem; }
.count-badge { display: inline-block; background: #eee; color: #555; font-size: .75rem; font-weight: 500; padding: .05rem .5rem; border-radius: 10px; margin-left: .4rem; vertical-align: middle; }
.entry-badges .count-badge { margin-left: 0; }
.entry-badges .count-badge.file-count { background: #e8f0fe; color: #1a56c4; }

/* Ordner-/Datei-Zeilen: ein Grid pro Zeile statt frei fliessender Spans,
   damit lange Namen nicht mehr das Layout zerreissen (siehe Screenshot-Bug:
   Umbenennen-Feld brach bei langen Namen in eine eigene Zeile um). */
.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid #f0f0f0;
}
/* Ordner-Zeilen haben eine Spalte mehr als Datei-Zeilen (Freigabestatus). */
.entry-list.folders .entry-row { grid-template-columns: auto 1fr auto auto auto; }
.entry-row:last-child { border-bottom: none; }
.entry-select { display: flex; align-items: center; gap: .15rem; }
.entry-badges { display: flex; gap: .3rem; align-items: center; white-space: nowrap; }

/* Freigabestatus: Kopieren-Button mit Tags (🔒/⏳) wenn ein Link existiert,
   sonst ein kompakter "Freigeben"-Button (siehe folder-share-status.php). */
.share-status { display: flex; align-items: center; gap: .3rem; white-space: nowrap; }
.copy-btn-mini { padding: .1rem .45rem; border: 1px solid #1a1a1a; background: #fff; color: #1a1a1a; border-radius: 3px; cursor: pointer; font-size: .7rem; }
.copy-btn-mini:disabled { opacity: .7; cursor: default; }
.quick-share-btn { padding: .1rem .5rem; border: 1px solid #2e7d32; background: #fff; color: #2e7d32; border-radius: 3px; cursor: pointer; font-size: .7rem; }
.quick-share-btn:hover { background: #eaf6ea; }
.quick-share-btn:disabled { opacity: .6; cursor: wait; }
.tag-mini { font-size: .65rem; background: #f0f0f0; color: #666; padding: .02rem .35rem; border-radius: 3px; }
.entry-link {
    color: #1a1a1a;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
a.entry-link:hover { text-decoration: underline; }
.entry-size { font-size: .8125rem; white-space: nowrap; }
.entry-controls { display: flex; gap: .25rem; align-items: center; white-space: nowrap; }
.id-tag { font-size: .6875rem; color: #999; background: #f5f5f5; padding: .05rem .35rem; border-radius: 3px; white-space: nowrap; }

/* Aufklapp-Dreieck fuer Ordner mit Unterordnern (siehe admin.js,
   data-expand-folder). expand-spacer haelt bei Ordnern ohne Kinder die
   gleiche Breite, damit alle Namen buendig untereinander stehen. */
.expand-toggle {
    width: 1.4rem; height: 1.4rem;
    border: none; background: none; cursor: pointer;
    color: #666; font-size: .7rem;
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s ease;
    padding: 0;
}
.expand-toggle:hover { color: #1a1a1a; }
.expand-toggle.expanded { transform: rotate(90deg); }
.expand-toggle.loading { opacity: .4; cursor: wait; }
.expand-spacer { display: inline-block; width: 1.4rem; }

/* Verschachtelte Unterordner-Liste (Ajax-nachgeladen), leicht eingerueckt
   und optisch abgesetzt, damit die Baumtiefe erkennbar bleibt. */
.entry-children { grid-column: 1 / -1; }
.entry-list.nested {
    margin-left: 1.9rem;
    padding-left: .75rem;
    border-left: 2px solid #eee;
    margin-top: .25rem;
}
.entry-list.nested .entry-row {
    grid-template-columns: auto 1fr auto auto;
    padding: .35rem 0;
}
.nested-empty { margin-left: 1.9rem; font-size: .8125rem; }

.icon-btn {
    padding: .25rem .45rem;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: .9rem;
    line-height: 1;
}
.icon-btn:hover { background: #f5f5f5; }
.icon-btn.danger { border-color: #f3c6c2; }
.icon-btn.danger:hover { background: #fdecea; }

/* Umbenennen-/Ablauf-Formulare: standardmaessig versteckt, klappen per JS
   (admin.js, data-toggle-target) in einer eigenen vollen Zeile auf. */
.rename-form { grid-column: 1 / -1; margin-top: .35rem; padding: .5rem; background: #fafafa; border-radius: 4px; }
.rename-form.hidden { display: none; }
.rename-form input[type="text"], .rename-form input[type="date"] { min-width: 220px; }
.cancel-btn { padding: .35rem .75rem; border: 1px solid #ccc; background: #fff; border-radius: 4px; cursor: pointer; font-size: .8125rem; }

/* Freigabelink-Zeilen: eigenes Layout, da URL + Meta-Tags mehr Platz brauchen
   als eine einzeilige Grid-Zeile hergibt. */
.link-row { padding: .6rem 0; border-bottom: 1px solid #f0f0f0; }
.link-row:last-child { border-bottom: none; }
.link-row-main { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.link-url { flex: 1; min-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.link-row-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.tag-warn { background: #fdecea; color: #b3261e; }
.inline-form { display: inline-flex; gap: .5rem; align-items: center; }
.inline-form input[type="text"], .inline-form input[type="password"], .inline-form input[type="date"], .inline-form input[type="file"] { padding: .35rem .5rem; border: 1px solid #ccc; border-radius: 4px; font-size: .875rem; }
.inline-form button { padding: .35rem .75rem; border: 1px solid #1a1a1a; background: #1a1a1a; color: #fff; border-radius: 4px; cursor: pointer; font-size: .8125rem; }
.inline-form button.danger { background: #fff; color: #b3261e; border-color: #b3261e; }
.tag { display: inline-block; background: #f0f0f0; color: #555; padding: .1rem .5rem; border-radius: 3px; font-size: .75rem; margin-left: .4rem; }
code { background: #f5f5f5; padding: .1rem .4rem; border-radius: 3px; }
.topbar a { color: #1a1a1a; text-decoration: none; font-size: .875rem; }
.topbar a:hover { text-decoration: underline; }
.page-title { font-size: 1.25rem; margin: 0 0 1rem; }
.filter-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.filter-form label { display: flex; flex-direction: column; gap: .25rem; font-size: .8125rem; color: #555; }
.filter-form select, .filter-form input { padding: .35rem .5rem; border: 1px solid #ccc; border-radius: 4px; font-size: .875rem; }
.filter-form button { padding: .4rem .9rem; border: 1px solid #1a1a1a; background: #1a1a1a; color: #fff; border-radius: 4px; cursor: pointer; }
.reset-link { align-self: center; font-size: .8125rem; color: #777; }
.log-table { width: 100%; border-collapse: collapse; font-size: .8125rem; margin-top: .75rem; }
.log-table th, .log-table td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.log-table th { color: #555; font-weight: 600; }
.pagination { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; font-size: .875rem; }
.pagination a { color: #1a1a1a; }
.stacked-form { display: flex; flex-direction: column; gap: .35rem; }
.stacked-form label { font-size: .8125rem; color: #555; margin-top: .5rem; }
.stacked-form input { padding: .5rem; border: 1px solid #ccc; border-radius: 4px; }
.stacked-form button { margin-top: 1rem; padding: .6rem; background: #1a1a1a; color: #fff; border: 0; border-radius: 4px; cursor: pointer; }
.storage-stats { display: flex; gap: 2rem; }
.storage-stats .stat-value { font-size: 1.5rem; font-weight: 600; display: block; }
.storage-stats .stat-label { font-size: .8125rem; color: #777; }
.bulk-bar { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.bulk-bar button { padding: .35rem .75rem; border: 1px solid #b3261e; background: #fff; color: #b3261e; border-radius: 4px; cursor: pointer; font-size: .8125rem; }
.select-checkbox { margin-right: .5rem; }
.copy-btn { padding: .15rem .5rem; border: 1px solid #1a1a1a; background: #fff; color: #1a1a1a; border-radius: 3px; cursor: pointer; font-size: .75rem; margin-left: .3rem; }
.copy-btn:disabled { opacity: .7; cursor: default; }
code { word-break: break-all; }
