:root {
  --bg-0: #140708;
  --bg-1: #24090b;
  --text: #fdeaea;
  --muted: #d29a9a;
  --accent: #db0000;
  --accent-hi: #ff2a2a;
  --accent-2: #a30000;
  --danger: #ff5a5a;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-brd: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% -10%, #5c0808 0%, transparent 60%),
              radial-gradient(1000px 700px at 110% 10%, #7a0000 0%, transparent 55%),
              linear-gradient(160deg, var(--bg-0), var(--bg-1));
  min-height: 100%;
  overflow-x: hidden;
}

/* schwebende Farb-Orbs im Hintergrund */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; }
.orb-1 { width: 420px; height: 420px; background: #db0000; top: -80px; left: -60px; }
.orb-2 { width: 380px; height: 380px; background: #8a0000; bottom: -100px; right: -40px; }
.orb-3 { width: 300px; height: 300px; background: #ff4d4d; top: 40%; left: 55%; opacity: 0.28; }

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
}

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

/* ---------- Login ---------- */
.center-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card-login { width: 100%; max-width: 380px; padding: 34px 30px; }
.brand { text-align: center; margin-bottom: 22px; }
.brand-mark {
  display: inline-block;
  width: 66px; height: 66px;
  margin: 0 auto 12px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(219, 0, 0, 0.4);
}
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand-mark.small { width: 40px; height: 40px; margin: 0; border-radius: 11px; }
.brand h1 { margin: 6px 0 2px; font-size: 1.4rem; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-brd);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(219, 0, 0, 0.28);
}

.btn {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transition: transform 0.05s, background 0.15s, border-color 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.14); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-hi), var(--accent-2));
  color: #fff; font-weight: 600; border: none;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-ghost { background: transparent; border-color: var(--glass-brd); }
.btn-danger { background: rgba(255, 107, 129, 0.16); border-color: rgba(255,107,129,0.4); color: #ffd0d8; }
.btn-danger:hover { background: rgba(255, 107, 129, 0.28); }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }
.link { background: none; border: none; color: var(--accent-hi); cursor: pointer; padding: 0; font: inherit; }

.alert { padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 0.88rem; }
.alert-error, .alert-danger { background: rgba(255, 107, 129, 0.15); border: 1px solid rgba(255,107,129,0.35); }
.alert-success { background: rgba(64, 220, 150, 0.14); border: 1px solid rgba(64,220,150,0.35); }

/* ---------- App / Dashboard ---------- */
.app { max-width: 1200px; margin: 0 auto; padding: 22px 20px 60px; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px; margin-bottom: 18px;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-brand > div { display: flex; flex-direction: column; line-height: 1.15; }
.search { flex: 1; }
.search input {
  width: 100%; padding: 11px 16px; border-radius: 12px;
  border: 1px solid var(--glass-brd); background: rgba(255,255,255,0.06);
  color: var(--text); outline: none; font-size: 0.92rem;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(219,0,0,0.25); }
.logout-form { margin: 0; }

.messages { margin-bottom: 16px; }

/* Dropzone */
.dropzone { padding: 26px; margin-bottom: 22px; text-align: center; transition: border-color 0.15s, background 0.15s; }
.dropzone.dragover { border-color: var(--accent); background: rgba(219,0,0,0.12); }
.dz-icon { font-size: 30px; margin-bottom: 6px; }
.dropzone-inner p { margin: 4px 0; }
.dz-selected { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
#dz-count { font-weight: 600; }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.card.asset { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.card.asset.inactive { opacity: 0.55; }
.thumb {
  height: 150px; display: grid; place-items: center; overflow: hidden;
  background-color: #e9e9ee;
  background-image:
    linear-gradient(45deg, #cfcfd6 25%, transparent 25%),
    linear-gradient(-45deg, #cfcfd6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cfcfd6 75%),
    linear-gradient(-45deg, transparent 75%, #cfcfd6 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; padding: 6px; }
.filetype {
  font-size: 0.8rem; color: var(--muted); padding: 8px 12px;
  border: 1px dashed var(--glass-brd); border-radius: 10px; max-width: 90%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.asset-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.asset-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: rgba(255,107,129,0.2); border: 1px solid rgba(255,107,129,0.4); font-size: 0.72rem;
}
.link-row { display: flex; gap: 6px; }
.link-input {
  flex: 1; min-width: 0; padding: 7px 10px; font-size: 0.76rem;
  border-radius: 10px; border: 1px solid var(--glass-brd);
  background: rgba(0,0,0,0.25); color: var(--muted);
}
.btn-copy { white-space: nowrap; }
.btn-copy.copied { background: rgba(64,220,150,0.22); border-color: rgba(64,220,150,0.4); color: #c7ffe4; }
.asset-actions { display: flex; gap: 8px; justify-content: space-between; }

/* ---------- Modal (SweetAlert-Stil, self-contained) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(10, 2, 3, 0.6);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 400px; padding: 28px 26px; text-align: center;
  transform: scale(0.94); transition: transform 0.18s ease;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-icon {
  width: 58px; height: 58px; margin: 0 auto 14px;
  display: grid; place-items: center; border-radius: 50%;
  font-size: 30px; line-height: 1;
  background: rgba(219, 0, 0, 0.16);
  border: 2px solid rgba(219, 0, 0, 0.5);
  color: var(--accent-hi);
}
.modal h2 { margin: 0 0 6px; font-size: 1.2rem; }
.modal p { margin: 0 0 20px; color: var(--muted); font-size: 0.9rem; word-break: break-word; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { min-width: 110px; }

.empty { text-align: center; padding: 50px 20px; grid-column: 1 / -1; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
}

/* ---------- Navigation ---------- */
.topnav { display: flex; gap: 6px; }
.topnav.grow { flex: 1; }
.navlink {
  padding: 8px 14px; border-radius: 10px; text-decoration: none;
  color: var(--muted); font-size: 0.9rem; transition: background 0.15s, color 0.15s;
}
.navlink:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.navlink.active { background: rgba(219,0,0,0.18); color: #fff; border: 1px solid rgba(219,0,0,0.4); }

/* ---------- Section-Head ---------- */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 2px 14px; gap: 12px; flex-wrap: wrap;
}
.section-head h2 { margin: 0; font-size: 1.15rem; }
.filter-form select {
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--glass-brd);
  background: rgba(0,0,0,0.3); color: var(--text); outline: none; font-size: 0.88rem;
}

/* ---------- Tabellen ---------- */
.table-wrap { padding: 6px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.data-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.data-table .nowrap { white-space: nowrap; }
.data-table .ellip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }

.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.status-dot.on { background: #40dc96; box-shadow: 0 0 6px rgba(64,220,150,0.7); }
.status-dot.off { background: #ff6b6b; }

/* ---------- Log-Tags ---------- */
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.76rem; background: rgba(255,255,255,0.1); border: 1px solid var(--glass-brd); }
.tag-upload { background: rgba(64,220,150,0.16); border-color: rgba(64,220,150,0.4); }
.tag-delete, .tag-user_delete { background: rgba(255,90,90,0.18); border-color: rgba(255,90,90,0.45); }
.tag-user_create { background: rgba(110,168,254,0.16); border-color: rgba(110,168,254,0.4); }
.tag-login { background: rgba(219,0,0,0.16); border-color: rgba(219,0,0,0.4); }

/* ---------- Modal-Formfelder ---------- */
.field.left { text-align: left; margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); margin: 4px 0 18px; text-align: left; }
.check input { width: auto; }

/* ---------- Konto-Formular ---------- */
.card-form { max-width: 440px; padding: 26px 28px; }
.card-form .btn-primary { width: 100%; margin-top: 6px; }
.field-err { color: var(--danger); font-size: 0.78rem; margin-top: 5px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 2, 3, 0.82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 30px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lb-close {
  position: absolute; top: 18px; right: 24px; z-index: 3;
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--glass-brd); background: rgba(255,255,255,0.08);
  color: #fff; font-size: 26px; line-height: 1;
}
.lb-close:hover { background: rgba(255,255,255,0.16); }
.lb-inner {
  display: flex; gap: 18px; width: 100%; max-width: 1150px; height: 82vh;
}
.lb-stage {
  flex: 1; position: relative; border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background-color: #e9e9ee;
  background-image:
    linear-gradient(45deg, #cfcfd6 25%, transparent 25%),
    linear-gradient(-45deg, #cfcfd6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cfcfd6 75%),
    linear-gradient(-45deg, transparent 75%, #cfcfd6 75%);
  background-size: 26px 26px;
  background-position: 0 0, 0 13px, 13px -13px, -13px 0;
}
.lb-img {
  max-width: 92%; max-height: 92%; object-fit: contain;
  transition: transform 0.12s ease; transform-origin: center center;
}
.lb-zoom {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; padding: 6px;
  background: rgba(20,7,8,0.6); border-radius: 12px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.lb-zoom .btn { min-width: 46px; }
.lb-side {
  width: 320px; flex-shrink: 0; padding: 22px; display: flex; flex-direction: column; gap: 14px;
  align-self: stretch;
}
.lb-name { margin: 0; font-size: 1.05rem; word-break: break-word; }
.lb-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.lb-actions .btn { width: 100%; text-align: center; text-decoration: none; }

@media (max-width: 760px) {
  .lb-inner { flex-direction: column; height: 88vh; }
  .lb-side { width: auto; }
  .lb-stage { flex: 1; }
}
