/* ============================================================
   Adminbereich – Reifen Peindl
   Eigenständiges Stylesheet (unabhängig von der Website)
   ============================================================ */

:root {
  --bg-950: #0c0e11;
  --bg-900: #111419;
  --surface: #14181e;
  --surface-2: #1a1f27;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f5f8;
  --text-soft: #c3cad4;
  --muted: #8a94a2;
  --accent: #e11d29;
  --accent-400: #ff3b47;
  --accent-glow: rgba(225, 29, 41, 0.3);
  --ok: #2ea043;
  --radius: 12px;
  --font-display: "Archivo", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

* , *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg-950); color: var(--text); font-family: var(--font-body); line-height: 1.6; }
h1, h2, h3 { font-family: var(--font-display); margin: 0 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.4rem; } h3 { font-size: 1.08rem; }
.muted { color: var(--muted); font-size: .88rem; margin: 0; }
.err { color: #ff8a90; font-size: .9rem; margin: .8rem 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent-400); outline-offset: 2px; }

/* ---------- Buttons / Felder ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: .92rem; padding: .7rem 1.1rem;
  border-radius: 9px; border: 1.5px solid transparent; transition: background .15s, border-color .15s, transform .15s; }
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-400); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent-400); background: rgba(255,255,255,.04); }
.btn-danger { background: transparent; color: #ff8a90; border-color: rgba(225,29,41,.45); }
.btn-danger:hover { background: rgba(225,29,41,.14); }
.btn-sm { padding: .5rem .8rem; font-size: .85rem; }
.btn-block { width: 100%; }

label { display: block; font-size: .85rem; color: var(--text-soft); margin: .9rem 0 .3rem; font-weight: 600; }
input, select, textarea { width: 100%; font-family: var(--font-body); font-size: .95rem; color: var(--text);
  background: var(--bg-950); border: 1px solid var(--line-strong); border-radius: 9px; padding: .65rem .8rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.login-remember { display: flex; align-items: flex-start; gap: .55rem; margin: .9rem 0 1rem;
  color: var(--text-soft); font-size: .82rem; line-height: 1.4; cursor: pointer; }
.login-remember input { flex: 0 0 auto; margin-top: .15rem; }
.field small { display: block; margin-top: .3rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.2rem;
  background: radial-gradient(120% 80% at 70% 0%, #1b2028, var(--bg-950) 60%); }
.login-box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 2rem; }
.login-logo { height: 44px; width: auto; display: block; margin-bottom: 1.4rem; }
.login-box h1 { font-size: 1.5rem; }
.login-box .btn { margin-top: 1.4rem; }

/* Passwort sichtbar machen – verhindert blindes Raten bei Tippfehlern/Autofill */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 5.4rem; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.07); border: 1px solid var(--line-strong); color: var(--text-soft);
  border-radius: 6px; padding: .35rem .6rem; font-size: .78rem; font-weight: 600; cursor: pointer; }
.pw-toggle:hover { color: #fff; border-color: var(--accent-400); }
.pw-hint { margin: .45rem 0 0; font-size: .78rem; color: var(--muted); min-height: 1em; }
.pw-hint.warn { color: #ffb27a; }

/* ---------- Header ---------- */
.admin-header { position: sticky; top: 0; z-index: 30; background: rgba(12,14,17,.95);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.admin-header-in { display: flex; align-items: center; gap: 1.2rem; padding: .7rem clamp(1rem, 3vw, 2rem); flex-wrap: wrap; }
.admin-logo { height: 34px; width: auto; flex-shrink: 0; }
.tabs { display: flex; gap: .3rem; flex: 1; flex-wrap: wrap; }
.tab { background: none; border: 0; color: var(--muted); font-family: var(--font-display); font-weight: 700;
  font-size: .92rem; padding: .55rem .85rem; border-radius: 8px; cursor: pointer; }
.tab:hover { color: #fff; background: rgba(255,255,255,.05); }
.tab.is-active { color: #fff; background: rgba(225,29,41,.16); box-shadow: inset 0 0 0 1px rgba(225,29,41,.35); }
.admin-user { display: flex; align-items: center; gap: .7rem; }

/* ---------- Layout ---------- */
.admin-main { padding: clamp(1rem, 3vw, 2rem); max-width: 1400px; margin-inline: auto; }
.view { display: none; }
.view.is-active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.view-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.sub-head { margin: 2rem 0 .8rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; margin-bottom: 1.2rem; }
.card h3 { margin-bottom: .4rem; }

/* ---------- Kalender ---------- */
.cal-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.calendar { min-width: 760px; }
.cal-head { display: grid; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface-2); z-index: 2; }
.cal-head div { padding: .7rem .5rem; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: .9rem; border-left: 1px solid var(--line); }
.cal-head div:first-child { border-left: 0; }
.cal-head .is-today { color: var(--accent-400); }
.cal-head small { display: block; font-weight: 500; color: var(--muted); font-size: .78rem; }
.cal-body { display: grid; position: relative; }
.cal-axis { border-right: 1px solid var(--line); position: relative; }
.cal-axis span { position: absolute; right: .45rem; transform: translateY(-50%); font-size: .72rem; color: var(--muted); }
.cal-col { position: relative; border-left: 1px solid var(--line); }
.cal-col:first-of-type { border-left: 0; }
.cal-open { position: absolute; left: 2px; right: 2px; background: rgba(255,255,255,.035); border-radius: 5px; }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(255,255,255,.06); }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--accent); z-index: 3; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.cal-ev { position: absolute; left: 3px; right: 3px; background: linear-gradient(180deg, #24303f, #1b2431);
  border: 1px solid rgba(255,255,255,.18); border-left: 3px solid var(--accent); border-radius: 6px;
  padding: .25rem .4rem; font-size: .74rem; overflow: hidden; cursor: pointer; z-index: 2; }
.cal-ev:hover { border-color: var(--accent-400); }
.cal-ev b { display: block; font-family: var(--font-display); font-size: .76rem; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev span { color: var(--text-soft); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-empty { padding: 2rem; text-align: center; color: var(--muted); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; min-width: 720px; }
.tbl th, .tbl td { padding: .75rem .8rem; text-align: left; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
.tbl th { background: var(--surface-2); font-family: var(--font-display); font-size: .8rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.plate { font-family: var(--font-display); font-weight: 700; letter-spacing: .04em; }
.tbl .row-actions { text-align: right; white-space: nowrap; }
.tbl input[type="text"], .tbl input[type="number"] { padding: .4rem .5rem; font-size: .88rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: .18rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.badge-on { background: rgba(46,160,67,.16); color: #8ff0a4; }
.badge-off { background: rgba(255,255,255,.08); color: var(--muted); }

/* ---------- Referenzen ---------- */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-top: 1rem; }
.ref-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ref-card.dragging { opacity: .45; }
.ref-card.drop-target { border-color: var(--accent-400); }
.ref-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--bg-950); cursor: grab; }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-pos { position: absolute; top: .4rem; left: .4rem; background: rgba(12,14,17,.8); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: .1rem .45rem; font-size: .74rem; font-weight: 700; }
.ref-body { padding: .8rem; }
.ref-title { display: block; color: #fff; line-height: 1.3; }
.ref-subtitle { min-height: 2.5em; margin: .3rem 0 .8rem; color: var(--muted); font-size: .84rem; line-height: 1.35; }
.ref-actions { display: flex; gap: .4rem; }
.ref-actions .btn { flex: 1; }
.ref-edit-preview { display: block; width: 100%; max-height: 250px; margin: .5rem 0 1.1rem;
  object-fit: contain; background: var(--bg-950); border: 1px solid var(--line); border-radius: 10px; }
.ref-edit-note { margin-top: .5rem; font-size: .8rem; line-height: 1.45; }

/* ---------- Öffnungszeiten-Editor ---------- */
.hours-editor { display: grid; gap: .6rem; margin-top: 1rem; }
.hours-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .6rem;
  background: var(--bg-950); border: 1px solid var(--line); border-radius: 9px; }
.hours-day { width: 92px; font-family: var(--font-display); font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.hours-wins { display: flex; gap: .5rem; flex-wrap: wrap; flex: 1; }
.hours-win { display: flex; align-items: center; gap: .3rem; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 7px; padding: .25rem .4rem; }
.hours-win input { width: 92px; padding: .3rem .4rem; font-size: .85rem; }
.hours-win button { background: none; border: 0; color: #ff8a90; cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 .2rem; }
.hours-closed { color: var(--muted); font-size: .85rem; }

.closed-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.closed-tool { padding: 1rem; background: var(--bg-950); border: 1px solid var(--line); border-radius: 10px; }
.closed-tool > strong { display: block; font-family: var(--font-display); font-size: .92rem; }
.closed-add { display: flex; gap: .5rem; align-items: center; margin: .7rem 0 0; flex-wrap: wrap; }
.closed-add input { width: auto; }
.closed-range { display: grid; grid-template-columns: 1fr 1fr auto; gap: .6rem; align-items: end; margin: .7rem 0 .5rem; }
.closed-range label { margin: 0; }
.closed-range label span { display: block; margin-bottom: .3rem; }
.closed-range input { min-width: 0; }
.closed-summary { margin: .2rem 0 .7rem; color: var(--text-soft); font-size: .88rem; font-weight: 600; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: .3rem .6rem; font-size: .84rem; }
.chip button { background: none; border: 0; color: #ff8a90; cursor: pointer; font-size: 1rem; line-height: 1; }

/* ---------- Modal / Toast ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 1.2rem;
  background: rgba(6,7,9,.85); backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-box { position: relative; width: 100%; max-width: 460px; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 14px; padding: 1.6rem; max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: .7rem; right: .8rem; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.07); border: 1px solid var(--line-strong); color: #fff; font-size: 1.4rem;
  line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--accent); }
.modal-time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.detail-row { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.detail-row:last-of-type { border-bottom: 0; }
.detail-row span:first-child { color: var(--muted); }
.detail-row span:last-child { text-align: right; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 1.6rem; transform: translateX(-50%); z-index: 80;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: .8rem 1.2rem; font-size: .9rem; box-shadow: 0 16px 40px -12px rgba(0,0,0,.7); }
.toast[hidden] { display: none; }
.toast.ok { border-color: rgba(46,160,67,.5); color: #8ff0a4; }
.toast.bad { border-color: rgba(225,29,41,.5); color: #ff8a90; }

@media (max-width: 640px) {
  .admin-header-in { gap: .6rem; }
  .tabs { order: 3; width: 100%; }
  .view-head { flex-direction: column; align-items: stretch; }
  .closed-tools { grid-template-columns: 1fr; }
  .closed-range { grid-template-columns: 1fr; }
  .modal-time-grid { grid-template-columns: 1fr; gap: 0; }
}
