/* ==========================================================================
   Skihütte Ski-Club Pirmasens – Portal Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Color tokens */
  --navy-950: #0A1F33;
  --navy-800: #123A5C;
  --navy-600: #1F5C8C;
  --navy-100: #E4ECF3;
  --snow-050: #F6F4EF;
  --snow-000: #FFFFFF;
  --wood-600: #B0742D;
  --wood-100: #F3E6D2;
  --ink-900: #14202B;
  --ink-500: #57616B;
  --ink-300: #8B949C;
  --line: #DDE3E8;
  --ok-green: #3F8F5F;
  --ok-green-bg: #E6F3EA;
  --warn-amber: #C97A16;
  --warn-amber-bg: #FBEEDA;
  --danger-red: #B23A24;
  --danger-red-bg: #FBE7E2;

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;

  /* Layout */
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(10, 31, 51, 0.04), 0 4px 16px rgba(10, 31, 51, 0.06);
  --header-h: 64px;
  --nav-h: 72px;
  --max-w: 640px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--snow-050);
  color: var(--ink-900);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  min-height: 100vh;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--snow-050);
}

.menu-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--snow-000);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.menu-btn svg { stroke: var(--navy-950); }

.app-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--navy-950);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy-800);
  color: var(--snow-000);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
}

/* ---------- Welcome hero ---------- */
.hero {
  background: linear-gradient(155deg, var(--navy-950) 0%, var(--navy-800) 100%);
  border-radius: var(--radius-lg);
  padding: 28px 24px 26px;
  color: var(--snow-000);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 24' preserveAspectRatio='none'%3E%3Cpath d='M0 12 Q 50 22 100 12 T 200 12 T 300 12 T 400 12 V24 H0 Z' fill='%23F6F4EF'/%3E%3C/svg%3E") bottom / 200px 22px repeat-x;
}

.hero-eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  color: #F0C879;
  font-size: 17px;
  margin-bottom: 6px;
}

.hero h1 { font-size: 26px; color: var(--snow-000); margin-bottom: 10px; }

.hero p {
  font-size: 14.5px;
  line-height: 1.5;
  color: rgba(255,255,255,0.82);
  margin: 0;
}

.hero p strong { color: #F0C879; font-weight: 600; }

/* ---------- Weather ---------- */
.weather-card {
  background: var(--snow-000);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px 14px;
  margin-top: -14px;
  position: relative;
  z-index: 1;
}

.weather-today {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weather-temp {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  color: var(--navy-950);
  display: flex;
  align-items: flex-start;
  gap: 2px;
}
.weather-temp span.deg { font-size: 20px; margin-top: 2px; }

.weather-meta { font-size: 13px; color: var(--ink-500); margin-top: 2px; }

.weather-day-label {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--navy-800);
  font-size: 15px;
}

.weather-hours {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.weather-hour { text-align: center; font-size: 12.5px; color: var(--ink-500); }
.weather-hour .t { font-weight: 600; color: var(--ink-900); font-size: 14px; }
.weather-hour .icon { font-size: 18px; margin: 4px 0; }

.weather-note {
  font-size: 11px;
  color: var(--ink-300);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* ---------- Sections ---------- */
.section { margin-top: 28px; }
.section-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--navy-950);
  margin-bottom: 4px;
}
.section-sub { font-size: 13.5px; color: var(--ink-500); margin-bottom: 14px; }

.eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--wood-600);
  margin-bottom: 8px;
}

/* ---------- Contact cards ---------- */
.contact-card {
  background: var(--snow-000);
  border-left: 4px solid var(--navy-800);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.contact-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.contact-name { font-weight: 600; font-size: 16px; }
.contact-role { font-size: 13px; color: var(--ink-500); }

.call-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--navy-100);
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--navy-950);
  cursor: pointer;
}
.call-btn .label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--navy-800);
}

/* ---------- FAQ accordion ---------- */
.faq-item {
  background: var(--snow-000);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 16px 18px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-900);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 12px;
}
.faq-q .chev { transition: transform 0.2s ease; flex-shrink: 0; stroke: var(--navy-800); }
.faq-item.open .faq-q .chev { transform: rotate(180deg); }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-500);
}
.faq-a-inner { padding: 0 18px 16px; }
.faq-a a { color: var(--navy-800); text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  border: none;
  cursor: pointer;
  width: 100%;
}
.btn-primary { background: var(--navy-950); color: var(--snow-000); }
.btn-primary:active { background: var(--navy-800); }
.btn-ghost { background: transparent; color: var(--navy-800); border: 1px solid var(--line); }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--snow-000);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 40;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-300);
}
.nav-item.active { color: var(--wood-600); }
.nav-item svg { stroke: currentColor; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(155deg, var(--navy-950) 0%, var(--navy-800) 100%);
}
.login-card {
  background: var(--snow-000);
  border-radius: var(--radius-lg);
  padding: 32px 26px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-mark {
  width: 52px; height: 52px;
  margin: 0 auto 16px;
}
.login-card h1 {
  text-align: center;
  font-size: 22px;
  color: var(--navy-950);
  margin-bottom: 4px;
}
.login-card .sub {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-500);
  margin-bottom: 24px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-500);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--snow-050);
}
.field input:focus {
  outline: 2px solid var(--navy-600);
  outline-offset: 1px;
}
.login-msg {
  font-size: 13px;
  text-align: center;
  margin-top: 14px;
  min-height: 18px;
}
.login-msg.error { color: var(--danger-red); }
.login-msg.ok { color: var(--ok-green); }

/* ---------- Dashboard / sensor cards ---------- */
.sensor-card {
  background: var(--snow-000);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.sensor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.sensor-title { font-weight: 600; font-size: 16px; }
.sensor-updated { font-size: 12px; color: var(--ink-300); font-family: var(--font-mono); }

.sensor-body { display: flex; align-items: center; gap: 18px; }

/* Pegel-Band tank visual */
.pegel-band {
  width: 64px;
  height: 100px;
  flex-shrink: 0;
}

.sensor-stats { flex: 1; }
.sensor-pct {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  color: var(--navy-950);
  line-height: 1;
}
.sensor-pct .unit { font-size: 16px; color: var(--ink-500); font-weight: 400; }
.sensor-status {
  display: inline-block;
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.status-ok { background: var(--ok-green-bg); color: var(--ok-green); }
.status-warn { background: var(--warn-amber-bg); color: var(--warn-amber); }
.status-danger { background: var(--danger-red-bg); color: var(--danger-red); }

.chip-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chip {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--snow-050);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 11px;
  color: var(--ink-500);
}

.sensor-card.placeholder {
  border: 1.5px dashed var(--line);
  box-shadow: none;
  color: var(--ink-300);
}
.sensor-card.placeholder .sensor-title { color: var(--ink-500); }
.placeholder-note { font-size: 13px; line-height: 1.5; }

.calib-toggle {
  font-size: 12.5px;
  color: var(--navy-800);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-top: 10px;
}
.calib-box {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  gap: 10px;
}
.calib-box.open { display: flex; }
.calib-box .field { flex: 1; margin-bottom: 0; }
.calib-box input { padding: 9px 10px; font-size: 13px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.logout-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--danger-red);
  background: none;
  border: none;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .faq-a, .faq-q .chev { transition: none; }
}
