/* =========================================================
   Galerie – Basis-Stylesheet (Phase 1)
   Anmutung der iPhone-Fotos-App: inhaltsorientiert, ruhig,
   automatischer Hell-/Dunkel-Modus, milchige Leisten.
   ========================================================= */

:root {
    color-scheme: light dark;

    /* Licht-Theme (Standard) */
    --bg:            #ffffff;
    --bg-elevated:   #f2f2f7;
    --text:          #1c1c1e;
    --text-soft:     #6b6b70;
    --separator:     rgba(60, 60, 67, 0.18);
    --accent:        #007aff;
    --accent-text:   #ffffff;
    --bar-bg:        rgba(255, 255, 255, 0.72);
    --shadow:        0 1px 3px rgba(0, 0, 0, 0.10);
    --radius:        14px;
    --radius-sm:     10px;
    --maxw:          1100px;

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
            "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:          #000000;
        --bg-elevated: #1c1c1e;
        --text:        #ffffff;
        --text-soft:   #9a9a9e;
        --separator:   rgba(120, 120, 128, 0.32);
        --accent:      #0a84ff;
        --bar-bg:      rgba(20, 20, 22, 0.72);
        --shadow:      0 1px 3px rgba(0, 0, 0, 0.5);
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }

/* ---------- Obere Leiste (milchig/frosted) ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bar-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--separator);
}
.topbar__inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 28px);
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.02em;
    color: var(--text);
}
.brand__dot {
    width: 14px; height: 14px; border-radius: 50%;
    background: conic-gradient(from 210deg, #ff375f, #ff9f0a, #30d158, #0a84ff, #bf5af2, #ff375f);
}

.nav { display: flex; align-items: center; gap: 12px; }
.nav__user { font-size: 14px; color: var(--text-soft); display: inline-flex; align-items: center; gap: 7px; }

.badge {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.03em; padding: 2px 7px; border-radius: 999px;
    background: var(--bg-elevated); color: var(--text-soft);
}
.badge--admin    { background: rgba(255, 55, 95, 0.16);  color: #ff375f; }
.badge--uploader { background: rgba(48, 209, 88, 0.18);  color: #2faa4e; }
.badge--viewer   { background: rgba(10, 132, 255, 0.16); color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    font: inherit; font-size: 15px; font-weight: 600;
    padding: 8px 16px; border-radius: 980px; border: none;
    cursor: pointer; transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: var(--accent-text); }
.btn--primary:hover { opacity: 0.92; }
.btn--ghost { background: transparent; color: var(--accent); padding: 8px 6px; }
.btn--block { width: 100%; padding: 13px 16px; font-size: 16px; }

.inline-form { margin: 0; display: inline; }

/* ---------- Inhalt ---------- */
.content {
    flex: 1;
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: clamp(20px, 5vw, 40px) clamp(16px, 4vw, 28px);
}

/* ---------- Hero / Startseite ---------- */
.hero__title {
    font-size: clamp(26px, 5vw, 40px);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 10px;
}
.hero__text { color: var(--text-soft); font-size: 17px; line-height: 1.5; max-width: 60ch; margin: 0 0 26px; }
.hint { color: var(--text-soft); font-size: 13px; margin-top: 18px; }

/* Platzhalter-Raster, gibt schon das spaetere Gefuehl */
.placeholder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 3px;
    border-radius: var(--radius);
    overflow: hidden;
}
.placeholder-grid__cell {
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, var(--bg-elevated), color-mix(in srgb, var(--bg-elevated) 70%, var(--separator)));
}

/* ---------- Panels (Login, Meldungen) ---------- */
.panel {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    padding: clamp(22px, 4vw, 34px);
    box-shadow: var(--shadow);
}
.panel--narrow { max-width: 380px; margin: 6vh auto 0; }
.panel--center { max-width: 420px; margin: 6vh auto 0; text-align: center; }
.panel__title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 18px; }
.panel__text { color: var(--text-soft); margin: 0 0 20px; }

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.field__input {
    font: inherit; font-size: 16px;
    padding: 12px 14px;
    border: 1px solid var(--separator);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
}
.field__input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.alert { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 14px; margin: 0 0 16px; }
.alert--error { background: rgba(255, 59, 48, 0.14); color: #ff3b30; }

/* ---------- Fusszeile ---------- */
.footer {
    border-top: 0.5px solid var(--separator);
    color: var(--text-soft);
    font-size: 13px;
    text-align: center;
    padding: 22px;
}

/* =========================================================
   Phase 2 – Zeitleiste, Raster, Kacheln, Detailansicht
   ========================================================= */

.nav__link { font-size: 15px; font-weight: 600; color: var(--accent); }

/* ---- Kopf der Zeitleiste mit Zoom-Tabs ---- */
.tl-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; margin: 0 0 18px;
}
.tl-tabs {
    display: inline-flex; gap: 2px; padding: 3px;
    background: var(--bg-elevated); border-radius: 999px;
}
.tl-tab {
    font-size: 14px; font-weight: 600; color: var(--text-soft);
    padding: 7px 15px; border-radius: 999px; transition: background .15s, color .15s;
}
.tl-tab.is-active { background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.tl-count { font-size: 13px; color: var(--text-soft); }
.tl-filter { font-size: 14px; color: var(--text-soft); margin: -6px 0 16px; }

/* ---- Foto-Raster (dichte, quadratische Kacheln wie in Fotos) ---- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 3px;
    margin-bottom: 8px;
}
.photo-grid--days {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 5px;
    margin-bottom: 26px;
}

.tile {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--bg-elevated);
    border-radius: 2px;
}
.tile__img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .25s ease;
    background: var(--bg-elevated);
}
.tile:hover .tile__img { transform: scale(1.04); }

.tile--video .tile__vbg {
    position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 45%,
                color-mix(in srgb, var(--bg-elevated) 60%, #000 40%),
                color-mix(in srgb, var(--bg-elevated) 90%, #000 10%));
}
.tile__play {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 26px;
    text-shadow: 0 1px 6px rgba(0,0,0,.5);
}

.day-head {
    font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
    margin: 26px 0 12px;
}
.day-head:first-child { margin-top: 0; }

/* ---- Jahres-/Monatskarten ---- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.card {
    position: relative; display: block; aspect-ratio: 4 / 3;
    border-radius: var(--radius); overflow: hidden;
    background: var(--bg-elevated); box-shadow: var(--shadow);
}
.card__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__meta {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 26px 16px 14px; color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,.65), transparent);
    display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
}
.card__title { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.card__count { font-size: 13px; opacity: .85; }

.loadmore { text-align: center; margin: 22px 0 8px; }

/* ---- Detailansicht ---- */
.viewer { display: flex; flex-direction: column; gap: 12px; }
.viewer__bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.viewer__date { font-size: 14px; color: var(--text-soft); font-weight: 600; }
.viewer__spacer { width: 80px; }
.viewer__stage {
    position: relative; display: flex; align-items: center; justify-content: center;
    background: var(--bg-elevated); border-radius: var(--radius);
    min-height: 50vh; overflow: hidden;
}
.viewer__media {
    max-width: 100%; max-height: 78vh; display: block;
    object-fit: contain; border-radius: var(--radius);
}
.viewer__nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; line-height: 1; color: #fff;
    background: rgba(0,0,0,.4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    transition: background .15s;
}
.viewer__nav:hover { background: rgba(0,0,0,.6); }
.viewer__nav--prev { left: 12px; }
.viewer__nav--next { right: 12px; }
.viewer__caption { color: var(--text-soft); font-size: 15px; text-align: center; }

.panel__subtitle {
    font-size: 16px; font-weight: 700; margin: 22px 0 8px; letter-spacing: -0.01em;
}

code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em; background: var(--bg-elevated);
    padding: 2px 6px; border-radius: 6px;
}

/* =========================================================
   Phase 3 – Upload, Dateiliste, Fortschritt, Verwalten
   ========================================================= */

.btn--danger { background: rgba(255,59,48,.14); color: #ff3b30; }
.btn--danger:hover { background: rgba(255,59,48,.22); }

.dropzone {
    display: flex; align-items: center; justify-content: center;
    min-height: 150px; padding: 24px; text-align: center; cursor: pointer;
    border: 2px dashed var(--separator); border-radius: var(--radius);
    background: var(--bg); transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--accent); background: var(--bg-elevated); }
.dropzone__input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone__text { font-size: 17px; font-weight: 600; color: var(--text); }
.dropzone__hint { font-size: 13px; font-weight: 400; color: var(--text-soft); }

.filelist { list-style: none; margin: 14px 0 0; padding: 0; }
.filelist__item {
    font-size: 14px; color: var(--text-soft);
    padding: 7px 0; border-bottom: 0.5px solid var(--separator);
}

.progress {
    height: 8px; border-radius: 999px; background: var(--bg-elevated);
    overflow: hidden; margin: 14px 0 4px;
}
.progress__bar { height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }

/* Verwalten in der Detailansicht */
.viewer__manage {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    justify-content: space-between; padding-top: 8px;
}
.manage-caption { display: flex; gap: 8px; flex: 1; min-width: 240px; margin: 0; }
.manage-caption .field__input { flex: 1; }
.manage-delete { margin: 0; }
