/* ============================================================
   Bildupload – schlichtes, mobil-optimiertes Design
   ============================================================ */

:root {
  --bg:        #f4f5f7;
  --card:      #ffffff;
  --text:      #1c2024;
  --muted:     #6b7280;
  --border:    #e3e6ea;
  --primary:   #2563eb;
  --primary-d: #1d4ed8;
  --ok:        #16a34a;
  --err:       #dc2626;
  --warn-bg:   #fff7ed;
  --warn-tx:   #9a3412;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --radius:    14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #0f1115;
    --card:    #1a1d23;
    --text:    #e8eaed;
    --muted:   #9aa0a6;
    --border:  #2a2e35;
    --warn-bg: #2a1e12;
    --warn-tx: #fcd9b6;
    --shadow:  0 1px 3px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

/* ---- Buttons & Felder ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem;
  border: none; border-radius: 12px;
  padding: 14px 20px;
  font-size: 1.05rem; font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s, opacity .15s;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-primary:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-big { width: 100%; padding: 18px; font-size: 1.15rem; margin-top: 4px; }

.field {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.05rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
}
.field:focus { outline: none; border-color: var(--primary); }

/* ============================ PASSWORT-GATE ============================ */
.gate {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.gate-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 26px;
  text-align: center;
}
.gate-card .logo { font-size: 2.6rem; }
.gate-card h1 { font-size: 1.4rem; margin: 10px 0 6px; }
.gate-card .sub { color: var(--muted); margin: 0 0 20px; font-size: .95rem; }
.gate-card form { display: flex; flex-direction: column; gap: 12px; }

.alert { border-radius: 10px; padding: 10px 14px; font-size: .92rem; margin-bottom: 14px; }
.alert.error { background: rgba(220,38,38,.1); color: var(--err); }

/* ============================ UPLOAD-OBERFLÄCHE ============================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; }
.logout { color: var(--muted); font-size: .9rem; text-decoration: none; }
.logout:hover { color: var(--text); }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px 120px;
  display: flex; flex-direction: column; gap: 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.lbl { display: block; font-weight: 600; margin-bottom: 10px; }
.hint { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }

/* ---- Dropzone ---- */
.dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 30px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--primary); background: rgba(37,99,235,.05); }
.dz-icon { font-size: 2rem; }
.dz-title { font-weight: 600; margin: 8px 0 4px; }
.dz-sub { color: var(--muted); font-size: .88rem; margin: 0; }
.dropzone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

/* ---- Status-Karte ---- */
.status-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.status-text { font-weight: 600; }
.status-count { color: var(--muted); font-size: .9rem; }
.progress {
  height: 12px; border-radius: 999px; background: var(--border); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), #3b82f6);
  border-radius: 999px;
  transition: width .2s ease;
}
.status-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; margin-top: 8px; }

.warn {
  margin-top: 14px;
  background: var(--warn-bg); color: var(--warn-tx);
  border-radius: 10px; padding: 12px 14px; font-size: .9rem;
}
.done-box {
  margin-top: 14px;
  background: rgba(22,163,74,.1); color: var(--ok);
  border-radius: 10px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
  font-size: 1rem;
}

/* ---- Galerie ---- */
.gallery-title { font-size: 1rem; margin: 4px 2px 10px; color: var(--muted); }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--border);
  box-shadow: var(--shadow);
}
.thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.thumb .vid-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; background: #111827; color: #fff;
}
/* Overlay bei laufendem Upload */
.thumb .overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end;
  opacity: 1; transition: opacity .3s;
}
.thumb.done .overlay { opacity: 0; }
.thumb .mini-progress {
  width: 100%; height: 5px; background: rgba(255,255,255,.3);
}
.thumb .mini-fill {
  height: 100%; width: 0%; background: #fff; transition: width .2s;
}
/* Status-Badge oben rechts */
.thumb .badge {
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; color: #fff;
}
.thumb.done  .badge { background: var(--ok); }
.thumb.error .badge { background: var(--err); }
.thumb.uploading .badge,
.thumb.queued .badge { background: rgba(0,0,0,.55); }
.thumb .fname {
  position: absolute; bottom: 6px; left: 6px; right: 6px;
  color: #fff; font-size: .62rem; line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: none;
}
.thumb.error .fname { display: none; }
.thumb .retry-hint {
  position: absolute; bottom: 4px; left: 4px; right: 4px;
  color: #fff; font-size: .6rem; text-align: center;
}

/* ---- Sticky Bar (mobil) ---- */
.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,.06);
  z-index: 10;
}
.sticky-progress { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.sticky-label { text-align: center; font-size: .82rem; color: var(--muted); margin-top: 6px; }
