/* durchblick - light theme: white, greys, anthracite, orange accent */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #F4F5F6;
  --surface: #FFFFFF;
  --ink: #26292E;
  --ink-soft: #4A4F57;
  --muted: #7A828C;
  --line: #E4E7EA;
  --accent: #F06E1D;
  --accent-soft: #FDEEE2;
  --live: #E53935;
  --ok: #2E9E5B;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(38, 41, 46, 0.05), 0 4px 16px rgba(38, 41, 46, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button { font-family: inherit; }

/* ---------- Header ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.brand .dot { color: var(--accent); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--muted);
  font-size: 14px;
}

#clock {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.topbar-link {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--surface);
  cursor: pointer;
}
.topbar-link:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Status strip (Lagebericht) ---------- */

.statusstrip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  align-items: center;
  margin: 24px 32px 0;
  padding: 14px 20px;
  background: var(--surface);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 14px;
  color: var(--ink-soft);
}
.statusstrip strong { color: var(--ink); font-weight: 600; }
.statusstrip .pill-live { color: var(--live); font-weight: 600; }
.statusstrip .pill-alert { color: var(--accent); font-weight: 600; }

/* ---------- Grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  padding: 24px 32px 48px;
  align-items: start;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

.card h2 {
  margin: 0 0 16px;
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card h2 .meta { font-family: 'Inter', sans-serif; letter-spacing: 0; text-transform: none; font-weight: 400; font-size: 12px; }

.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

@media (max-width: 1100px) {
  .col-4, .col-5, .col-7, .col-8 { grid-column: span 12; }
}

.empty { color: var(--muted); font-size: 14px; }

/* ---------- Weather ---------- */

.weather-now {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.weather-temp {
  font-family: 'Sora', sans-serif;
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
}
.weather-desc { font-size: 15px; color: var(--ink-soft); }
.weather-place { color: var(--muted); font-size: 13px; margin-top: 2px; }

.weather-meta {
  display: flex;
  gap: 22px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
.weather-meta strong { color: var(--ink); font-weight: 600; }

.alerts { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.alert {
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  background: var(--accent-soft);
  color: #B4500D;
  border: 1px solid #F8CFAE;
}
.alert.warn { background: #F1F2F4; color: var(--ink-soft); border-color: var(--line); }

.forecast {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.forecast-day { flex: 1; text-align: center; font-size: 13px; color: var(--muted); }
.forecast-day .d { font-weight: 600; color: var(--ink-soft); }
.forecast-day .t { margin-top: 2px; }
.forecast-day .t strong { color: var(--ink); }

/* ---------- Calendar ---------- */

.event {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.event:last-child { border-bottom: none; }
.event-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  min-width: 92px;
}
.event.today .event-time { color: var(--accent); }
.event-title { font-weight: 500; }
.event-loc { color: var(--muted); font-size: 13px; }

/* ---------- Twitch ---------- */

.streamer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: default;
}
.streamer.live { cursor: pointer; }
.streamer.live:hover { background: var(--bg); }
.streamer img { width: 38px; height: 38px; border-radius: 50%; }
.streamer .name { font-weight: 600; }
.streamer .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.streamer .state { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.streamer.live .state { color: var(--live); }
.streamer.live .state::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--live);
  margin-right: 6px;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .streamer.live .state::before { animation: none; } }

.player-wrap { margin-top: 14px; }
.player-wrap iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 10px;
  background: #000;
}

/* ---------- News ---------- */

.newsfeed { margin-bottom: 18px; }
.newsfeed:last-child { margin-bottom: 0; }
.newsfeed h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.news-item {
  display: block;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
}
.news-item:last-child { border-bottom: none; }
.news-item .time { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 8px; }

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 360px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px;
  text-align: center;
}
.login-card .brand { font-size: 22px; margin-bottom: 24px; display: block; }

/* ---------- Forms (login + admin) ---------- */

input[type="text"], input[type="password"], input[type="url"], input[type="number"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

.btn {
  display: inline-block;
  padding: 11px 20px;
  border: none;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: #D95F13; }
.btn.secondary { background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line); }
.btn.secondary:hover { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.btn.danger { background: transparent; color: var(--muted); border: none; padding: 6px 10px; font-size: 13px; }
.btn.danger:hover { color: var(--live); }

.form-row { display: flex; gap: 10px; margin-top: 12px; }
.form-row input { flex: 1; }

.msg { margin-top: 12px; font-size: 13px; min-height: 18px; }
.msg.error { color: var(--live); }
.msg.ok { color: var(--ok); }

/* ---------- Admin ---------- */

.admin-list { margin: 0; padding: 0; list-style: none; }
.admin-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.admin-list li:last-child { border-bottom: none; }
.admin-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-list .sub { color: var(--muted); font-size: 12px; }

.status-tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.status-tag.on { background: #E4F4EA; color: var(--ok); }
.status-tag.off { background: #F1F2F4; color: var(--muted); }

/* ---------- Header icons ---------- */

.htitle { display: inline-flex; align-items: center; gap: 8px; }
.hicon { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }

/* ---------- Weather condition icons ---------- */

.wicon-big { width: 56px; height: 56px; flex-shrink: 0; }
.wicon-small { width: 26px; height: 26px; display: block; margin: 0 auto 4px; }
.weather-now { align-items: center; }

/* ---------- Single-view dashboard (everything on one screen) ---------- */

body.single { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
body.single .topbar, body.single .statusstrip { flex-shrink: 0; }
body.single .grid {
  flex: 1;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  padding-bottom: 24px;
}
body.single .card {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
body.single .card::-webkit-scrollbar { width: 6px; }
body.single .card::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
body.single .card::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1100px) {
  body.single { height: auto; overflow: auto; }
  body.single .grid { grid-template-rows: none; }
  body.single .card { height: auto; }
}

/* ---------- Weather v3: bigger, animated, condition tinted ---------- */

.wicon-big { width: 72px; height: 72px; }
.weather-temp { font-size: 60px; }

.weather-card { transition: background 0.6s ease; }
.weather-card.wx-clear-day { background: linear-gradient(160deg, #FFF6E8 0%, var(--surface) 55%); }
.weather-card.wx-clear-night { background: linear-gradient(160deg, #EBF0F9 0%, var(--surface) 55%); }
.weather-card.wx-cloud { background: linear-gradient(160deg, #F1F3F5 0%, var(--surface) 55%); }
.weather-card.wx-rain { background: linear-gradient(160deg, #EAF1F8 0%, var(--surface) 55%); }
.weather-card.wx-snow { background: linear-gradient(160deg, #F0F6FC 0%, var(--surface) 55%); }
.weather-card.wx-storm { background: linear-gradient(160deg, #F3EFEA 0%, var(--surface) 55%); }
.weather-card.wx-fog { background: linear-gradient(160deg, #F2F3F4 0%, var(--surface) 55%); }

.alert.calm { background: #EFF6F1; color: #2E7D4F; border-color: #D4E9DC; }

/* Icon animations */
.w-rays, .w-sun, .w-moon, .w-cloud, .w-drop, .w-flake, .w-bolt, .w-fog path {
  transform-box: fill-box;
  transform-origin: center;
}
.w-rays { animation: w-spin 26s linear infinite; }
.w-sun { animation: w-breathe 3.5s ease-in-out infinite; }
.w-cloud { animation: w-drift 6s ease-in-out infinite; }
.w-drop { animation: w-fall 1.3s ease-in infinite; }
.w-drop:nth-of-type(2) { animation-delay: 0.45s; }
.w-drop:nth-of-type(3) { animation-delay: 0.9s; }
.w-flake { animation: w-fall 2.6s ease-in-out infinite; }
.w-flake:nth-of-type(2) { animation-delay: 0.9s; }
.w-flake:nth-of-type(3) { animation-delay: 1.7s; }
.w-bolt { animation: w-flash 2.8s ease-in-out infinite; }
.w-fog path { animation: w-drift 5s ease-in-out infinite; }
.w-fog path:nth-of-type(2) { animation-delay: 0.6s; animation-direction: reverse; }
.w-fog path:nth-of-type(3) { animation-delay: 1.2s; }

@keyframes w-spin { to { transform: rotate(360deg); } }
@keyframes w-breathe { 50% { transform: scale(1.07); } }
@keyframes w-drift { 50% { transform: translateX(1.2px); } }
@keyframes w-fall {
  0% { transform: translateY(-2px); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(3px); opacity: 0; }
}
@keyframes w-flash { 0%, 100% { opacity: 1; } 46% { opacity: 1; } 50% { opacity: 0.25; } 54% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .w-rays, .w-sun, .w-moon, .w-cloud, .w-drop, .w-flake, .w-bolt, .w-fog path { animation: none; }
}

/* ---------- v4: stream tile becomes the player ---------- */

.card.playing { display: flex; flex-direction: column; }
.card.playing h2 { display: none; }
.card.playing #twitch { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.player-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  flex-shrink: 0;
}
.player-head img { width: 32px; height: 32px; border-radius: 50%; }
.player-head .name { font-weight: 600; }
.player-head .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-head .state { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--live); flex-shrink: 0; }
.player-head .state::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--live);
  margin-right: 6px;
  animation: pulse 1.6s infinite;
}
.player-close {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 8px;
  width: 30px; height: 30px;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 10px;
}
.player-close:hover { color: var(--live); border-color: var(--live); }

.player-frame { flex: 1; min-height: 0; }
.player-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
  background: #000;
  display: block;
}

/* ---------- v4: news thumbnails ---------- */

.news-item { display: flex; align-items: center; gap: 12px; }
.news-thumb {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 7px;
  flex-shrink: 0;
  background: var(--bg);
}
.news-thumb.ph {
  display: inline-block;
  background: linear-gradient(135deg, var(--bg) 0%, var(--line) 100%);
}
.news-title { min-width: 0; }

/* ---------- v5: status strip chips with icons ---------- */

.statusstrip { gap: 8px 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.chip svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--accent); }
.chip svg.chip-w { width: 18px; height: 18px; }
.chip strong { color: var(--ink); font-weight: 600; }
.chip.alertchip { background: var(--accent-soft); border-color: #F8CFAE; color: #B4500D; font-weight: 500; }
.chip.alertchip svg { color: var(--accent); }
.chip.alertchip strong { color: #B4500D; }
.chip.livechip { background: #FDECEC; border-color: #F5CBCB; color: var(--live); font-weight: 500; }
.chip.livechip svg { color: var(--live); }
.chip.livechip strong { color: var(--live); }

/* ---------- v7: player without any chrome, edge to edge ---------- */

.card.playing { padding: 0; overflow: hidden; }
.player-solo { position: relative; height: 100%; }
.player-solo iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #000;
}
.player-close.solo {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  background: rgba(20, 20, 20, 0.55);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  opacity: 0.55;
  transition: opacity 0.2s;
}
.player-close.solo:hover { opacity: 1; color: #fff; }
