/* Gemeinsame Grundlage aller Seiten: Farben, Kopfzeile, Buttons, Formularfelder.
   Vorher steckte das dreifach kopiert in style.css, admin.css und planung.css.
   Seitenspezifisches bleibt in der jeweiligen Datei.

   Zwei Regeln gelten hier überall, weil sie auf dem Handy sonst weh tun:
   - Eingabefelder haben auf schmalen Geräten 16px Schrift. Darunter zoomt
     iOS Safari beim Antippen automatisch in die Seite hinein.
   - Bedienelemente sind mindestens --tap groß, sonst trifft man sie mit dem
     Finger nicht zuverlässig.
*/

:root {
  --fire: #e11d2a;
  --fire-dark: #b3121d;
  --fire-glow: rgba(225, 29, 42, 0.35);
  --bg: #0e1014;
  --bg-2: #151922;
  --panel: #171b24;
  --panel-2: #1d2230;
  --border: #2a3140;
  --border-soft: #232a37;
  --text: #eef1f6;
  --muted: #9aa5b8;
  --muted-2: #6c778a;
  --ok: #2ecc71;
  --warn: #f2b807;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --tap: 44px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: "Barlow", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
}
body {
  min-height: 100vh;
  /* dvh: sonst springt das Layout, sobald die Adressleiste ein-/ausfährt */
  min-height: 100dvh;
  /* verhindert seitliches Wackeln, wenn doch mal etwas zu breit gerät */
  overflow-x: hidden;
}
img { max-width: 100%; }

/* ---------- Kopfzeile ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px clamp(14px, 4vw, 40px);
  border-bottom: 1px solid var(--border-soft);
  background: rgba(14, 16, 20, 0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  color: var(--fire);
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  flex: 0 0 auto;
  background: rgba(225, 29, 42, 0.12);
  border: 1px solid rgba(225, 29, 42, 0.3);
  border-radius: 12px;
  filter: drop-shadow(0 0 10px var(--fire-glow));
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 17px; letter-spacing: 0.2px; }
.brand-text small { color: var(--muted); font-size: 12.5px; }
.wehr-wappen {
  height: 44px;
  width: auto;
  max-width: 56px;
  object-fit: contain;
  flex: none;
}

.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-box { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
}
.user-chip svg { color: var(--fire); flex: 0 0 auto; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 3px 8px; border-radius: 999px; background: var(--fire); color: #fff;
  flex: 0 0 auto;
}
.logout-form { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: none;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
}
.btn-primary {
  appearance: none;
  border: none;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 9px;
  background: var(--fire);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 5px 15px var(--fire-glow);
  transition: background 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
}
.btn-primary:hover { background: var(--fire-dark); }
.btn-primary:disabled { background: var(--border); color: var(--muted-2); box-shadow: none; cursor: not-allowed; }

.btn-ghost, .btn-logout, .btn-admin {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  min-height: var(--tap);
}
.btn-ghost:hover { border-color: var(--muted-2); }
.btn-ghost:disabled { color: var(--muted-2); cursor: not-allowed; opacity: 0.6; }
.btn-admin { font-weight: 700; color: #fff; background: rgba(225, 29, 42, 0.16); border-color: var(--fire); }
.btn-admin:hover { background: var(--fire); }
.btn-logout { color: var(--muted); background: transparent; }
.btn-logout:hover { color: #fff; border-color: var(--fire); background: rgba(225, 29, 42, 0.14); }

.btn-sm {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  min-height: 36px;
}
.btn-sm:hover { border-color: var(--muted-2); }
.btn-sm.danger:hover { border-color: var(--fire); color: #ffb3ba; background: rgba(225, 29, 42, 0.12); }

/* ---------- Formularfelder ---------- */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
label .opt, .muted-inline { color: var(--muted-2); font-weight: 500; font-size: 12px; }
label .val, .val { float: right; color: var(--text); font-weight: 700; }

input[type="text"],
input[type="password"],
input[type="search"],
input[type="datetime-local"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="file"] { padding: 8px; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--fire);
  box-shadow: 0 0 0 3px var(--fire-glow);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%239aa5b8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

input[type="color"] {
  width: 100%; height: 42px; padding: 3px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  appearance: none;
  background: var(--border);
  border-radius: 4px;
  outline: none;
  /* großzügiger Griff: auf dem Handy sonst kaum zu treffen */
  margin: 14px 0;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--fire);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--fire);
  cursor: pointer;
  border: 3px solid #fff;
}

/* Kästchen zum Ankreuzen (.check in der App, .chk in Admin/Planung) */
.check, .chk {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  margin: 4px 0 8px;
  min-height: 36px;
}
.check { color: var(--muted); font-weight: 500; }
.check input, .chk input {
  width: 20px; height: 20px;
  accent-color: var(--fire);
  cursor: pointer;
  flex: 0 0 auto;
}

/* ---------- Meldungen ---------- */
.notice {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
}
.notice.ok { background: rgba(46, 204, 113, 0.12); border: 1px solid var(--ok); color: #a6e9c3; }
.notice.err { background: rgba(225, 29, 42, 0.12); border: 1px solid var(--fire); color: #ffb3ba; }
.notice.warn { background: rgba(242, 184, 7, 0.1); border: 1px solid var(--warn); color: #f4dd94; }

/* ---------- Handy ---------- */
@media (max-width: 768px) {
  /* 16px verhindert das automatische Hineinzoomen von iOS beim Antippen */
  input[type="text"],
  input[type="password"],
  input[type="search"],
  input[type="datetime-local"],
  input[type="file"],
  select,
  textarea {
    font-size: 16px;
  }
}

@media (max-width: 720px) {
  .app-header { padding: 10px 14px; gap: 10px; }
  .brand-mark { width: 38px; height: 38px; }
  .wehr-wappen { height: 38px; }
  /* Untertitel und Benutzername sind auf dem Handy verzichtbar – der Platz
     in der (klebenden) Kopfzeile ist wertvoller. */
  .brand-text small { display: none; }
  .user-chip { display: none; }
  .header-right { gap: 8px; }
  .btn-ghost, .btn-logout, .btn-admin { padding: 9px 12px; font-size: 13px; }
}
