/* ===============================================================
   Meteo Němčany – vzhled
   Skiny se přepínají atributem data-skin na <html>.
   Barvy grafů čte i app.js (getComputedStyle), takže nový skin
   = jen nový blok proměnných níže.
   =============================================================== */

:root,
:root[data-skin="klasik"] {
  --appbar: #2196F3;
  --appbar-text: #ffffff;
  --appbar-sub: rgba(255,255,255,.92);
  --tab-ind: #ffffff;
  --tl-a: #1976D2;          /* časová osa – den A */
  --tl-b: #2196F3;          /* časová osa – den B */
  --tl-text: #ffffff;
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #212121;
  --text-2: #616161;
  --divider: #e6e6e6;
  --grid: rgba(0,0,0,.075);
  --grid-strong: rgba(0,0,0,.14);
  --night: #ebebeb;
  --past: rgba(0,0,0,.10);
  --cursor: #757575;
  --label: #333333;

  --temp: #FF9800;
  --temp-fill-top: rgba(255,183,77,.85);
  --temp-fill-bot: rgba(255,224,178,.55);
  --temp-accent: #FFA726;
  --wind: #26A69A;
  --wind-fill-top: rgba(77,182,172,.85);
  --wind-fill-bot: rgba(178,223,219,.45);
  --wind-accent: #4DB6AC;
  --cloud-line: #8FA1AD;
  --cloud-high: rgba(236,239,241,.95);
  --cloud-mid: rgba(207,216,220,.9);
  --cloud-low: rgba(176,190,197,.9);
  --cloud-accent: #B0BEC5;
  --press: #F48FB1;
  --press-fill-top: rgba(244,143,177,.55);
  --press-fill-bot: rgba(252,228,236,.55);
  --press-accent: #F06292;
  --humid: #2196F3;
  --precip: #7986CB;
  --orange-label: #FF9800;
  --blue-label: #2196F3;

  --ico-cloud: #9EAAB3;
  --ico-cloud-dark: #7E8B95;
  --ico-sun: #FFA726;
  --ico-moon: #C2CCD2;
  --ico-drop: #7986CB;
  --ico-snow: #90A4AE;
  --ico-bolt: #FFC107;

  --drawer-head: #2196F3;
  --ripple: rgba(0,0,0,.08);
  color-scheme: light;
}

:root[data-skin="tmavy"] {
  --appbar: #1C2733;
  --appbar-text: #ECEFF1;
  --appbar-sub: rgba(236,239,241,.8);
  --tab-ind: #4FC3F7;
  --tl-a: #1C2733;
  --tl-b: #263545;
  --tl-text: #CFD8DC;
  --bg: #121212;
  --surface: #121212;
  --text: #ECEFF1;
  --text-2: #9EA7AD;
  --divider: #2a2a2a;
  --grid: rgba(255,255,255,.06);
  --grid-strong: rgba(255,255,255,.12);
  --night: #1b1b1b;
  --past: rgba(0,0,0,.35);
  --cursor: #9E9E9E;
  --label: #E0E0E0;
  --temp-fill-top: rgba(255,152,0,.55);
  --temp-fill-bot: rgba(255,152,0,.10);
  --wind-fill-top: rgba(38,166,154,.6);
  --wind-fill-bot: rgba(38,166,154,.1);
  --cloud-line: #78909C;
  --cloud-high: rgba(96,110,120,.55);
  --cloud-mid: rgba(120,136,146,.6);
  --cloud-low: rgba(150,166,176,.65);
  --press-fill-top: rgba(240,98,146,.45);
  --press-fill-bot: rgba(240,98,146,.08);
  --humid: #4FC3F7;
  --blue-label: #4FC3F7;
  --precip: #8C9EFF;
  --ico-cloud: #8A98A3;
  --ico-cloud-dark: #6D7B86;
  --ico-moon: #8E9AA2;
  --drawer-head: #1C2733;
  --ripple: rgba(255,255,255,.08);
  color-scheme: dark;
}

:root[data-skin="les"] {
  --appbar: #388E3C;
  --tl-a: #2E7D32;
  --tl-b: #43A047;
  --drawer-head: #388E3C;
  --humid: #1E88E5;
  --blue-label: #1E88E5;
}

:root[data-skin="minimal"] {
  --appbar: #FAFAFA;
  --appbar-text: #212121;
  --appbar-sub: #757575;
  --tab-ind: #212121;
  --tl-a: #EEEEEE;
  --tl-b: #F7F7F7;
  --tl-text: #424242;
  --night: #F3F3F3;
  --drawer-head: #ECEFF1;
  --temp-fill-top: rgba(255,183,77,.5);
  --temp-fill-bot: rgba(255,224,178,.25);
  --wind-fill-top: rgba(77,182,172,.5);
  --wind-fill-bot: rgba(178,223,219,.2);
}

/* ---------------------------------------------------------------- */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--humid); }
[hidden] { display: none !important; }

#app {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin: 0 auto;
  background: var(--surface);
}

/* --- horní lišta -------------------------------------------------- */
.appbar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--appbar);
  color: var(--appbar-text);
  padding: calc(env(safe-area-inset-top) + 6px) 4px 2px;
  min-height: 64px;
}
.icon-btn {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  flex: none;
}
.icon-btn:active { background: rgba(255,255,255,.18); }
.icon-btn svg { width: 25px; height: 25px; }
.titles { flex: 1; min-width: 0; padding-left: 8px; }
.title { font-size: 22px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { font-size: 16px; font-weight: 700; color: var(--appbar-sub); line-height: 1.25; white-space: nowrap; }

/* --- záložky ------------------------------------------------------- */
.tabs {
  position: relative;
  display: flex;
  background: var(--appbar);
  color: var(--appbar-text);
}
.tabs button {
  flex: 1; height: 48px;
  display: grid; place-items: center;
  opacity: .9;
}
.tabs button svg { width: 26px; height: 26px; }
.tabs button[aria-selected="true"] { opacity: 1; }
.tab-ind {
  position: absolute; bottom: 0; left: 0;
  height: 3px; width: 25%;
  padding: 0 3.3%;
  background-clip: content-box;
  background-color: var(--tab-ind);
  transition: transform .25s ease;
}

/* --- obsah --------------------------------------------------------- */
#views { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.view.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }

.panel {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 12px 14px 2px 16px;
  min-height: 76px;
  flex: none;
}
.accent {
  position: absolute; left: 0; top: 13px;
  width: 4px; height: 44px;
  border-radius: 0 3px 3px 0;
  background: var(--temp-accent);
}
.p-left { flex: 1; min-width: 0; }
.p-value { font-size: 30px; line-height: 1.1; letter-spacing: -.2px; white-space: nowrap; }
.p-desc { font-size: 17px; color: var(--text-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-top: 4px; }
.p-row { font-size: 16.5px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.p-row .lbl-o { color: var(--orange-label); }
.p-row .lbl-b { color: var(--blue-label); }
.p-row .val { color: var(--text-2); }
.drops { display: inline-flex; gap: 2px; }
.drops svg { width: 13px; height: 19px; }
.compass { width: 72px; height: 72px; margin-top: -6px; }
.cloud-ico { width: 64px; height: 50px; color: var(--text-2); }

.chartwrap { flex: 1; min-height: 0; position: relative; overflow: hidden; }
#view-forecast { padding-bottom: env(safe-area-inset-bottom); background: var(--tl-a); }
#view-forecast .panel { background: var(--surface); }
#chart {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  display: block;
  will-change: transform;
}
.loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
  opacity: 0; transition: opacity .2s;
}
.loading.on { opacity: 1; }
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 4px solid var(--divider); border-top-color: var(--appbar);
  animation: spin .9s linear infinite;
}
:root[data-skin="minimal"] .spinner { border-top-color: #616161; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- oblíbená místa ----------------------------------------------- */
#view-favs { overflow-y: auto; }
.fav-list { padding: 8px 10px 24px; display: flex; flex-direction: column; gap: 10px; }
.fav-card {
  background: var(--surface);
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,.22), 0 1px 1px rgba(0,0,0,.08);
  overflow: hidden;
  cursor: pointer;
}
:root[data-skin="tmavy"] .fav-card { background: #1d1d1d; box-shadow: none; border: 1px solid #2a2a2a; }
.fav-head { display: flex; align-items: center; padding: 6px 4px 2px 14px; }
.fav-name { flex: 1; font-size: 20px; }
.fav-head .icon-btn { width: 40px; height: 40px; color: var(--text-2); }
.fav-head .icon-btn:active { background: var(--ripple); }
.fav-card canvas { display: block; width: 100%; height: 150px; }
.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.btn {
  background: var(--appbar); color: var(--appbar-text);
  padding: 10px 20px; border-radius: 4px; font-weight: 500; letter-spacing: .3px;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.btn-text { color: var(--humid); font-weight: 600; padding: 10px 14px; text-transform: uppercase; letter-spacing: .5px; font-size: 14px; }

/* --- nastavení ------------------------------------------------------ */
.list { padding-bottom: 32px; }
.list-section { font-size: 15px; color: #6b6b85; padding: 22px 28px 8px; font-weight: 500; }
:root[data-skin="tmavy"] .list-section { color: #8f98b8; }
.list-item { display: block; width: 100%; text-align: left; padding: 14px 28px; }
.list-item:active { background: var(--ripple); }
.list-item .li-title { font-size: 19px; }
.list-item .li-sub { font-size: 16px; color: var(--text-2); margin-top: 3px; }

/* --- o aplikaci ------------------------------------------------------ */
.ab-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px;
  background: var(--appbar); color: var(--appbar-text);
  padding: 22px 20px 34px;
}
.ab-hero img { border-radius: 16px; position: relative; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.ab-hero > div { position: relative; }
.ab-wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 70px; }
:root[data-skin="minimal"] .ab-wave path { fill: rgba(0,0,0,.04); }
.ab-name { font-size: 22px; font-weight: 600; }
.ab-ver { font-size: 14px; opacity: .85; margin-top: 3px; }
.ab-tag { margin: 16px 20px 6px; color: var(--text-2); font-size: 15px; line-height: 1.45; }
.ab-list { padding: 4px 0 8px; }
.ab-row { display: flex; gap: 18px; align-items: flex-start; padding: 13px 20px; color: var(--text); text-decoration: none; }
.ab-row:active { background: var(--ripple); }
.ab-row svg { width: 24px; height: 24px; flex: none; color: var(--appbar); margin-top: 1px; }
:root[data-skin="minimal"] .ab-row svg, :root[data-skin="tmavy"] .ab-row svg { color: var(--humid); }
.ab-t { font-size: 16.5px; font-weight: 500; }
.ab-s { font-size: 14px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.ab-s:empty { display: none; }
.ab-foot { text-align: center; color: var(--text-2); font-size: 13px; padding: 8px 0 calc(env(safe-area-inset-bottom) + 24px); }
.muted { color: var(--text-2); }
.small { font-size: 14px; }

/* --- boční menu ------------------------------------------------------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; opacity: 0; transition: opacity .2s; }
.scrim.on { opacity: 1; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0;
  width: min(300px, 82vw);
  background: var(--surface);
  z-index: 21;
  transform: translateX(-102%);
  transition: transform .22s ease;
  display: flex; flex-direction: column;
  box-shadow: 2px 0 12px rgba(0,0,0,.25);
}
.drawer.on { transform: none; }
.drawer-head {
  background: var(--drawer-head);
  color: var(--appbar-text);
  padding: calc(env(safe-area-inset-top) + 28px) 18px 18px;
  display: flex; align-items: center; gap: 14px;
}
.drawer-head img { border-radius: 14px; }
.drawer-title { font-size: 19px; font-weight: 600; }
.drawer-sub { font-size: 14px; opacity: .85; margin-top: 2px; }
.drawer-nav { padding: 8px 0; overflow-y: auto; flex: 1; }
.drawer-nav button, .drawer-nav a {
  display: flex; align-items: center; gap: 24px;
  width: 100%; padding: 14px 20px; font-size: 16px; font-weight: 500;
  text-align: left; color: var(--text); text-decoration: none;
}
.drawer-nav button:active, .drawer-nav a:active { background: var(--ripple); }
.drawer-nav button.on { color: var(--humid); background: var(--ripple); }
.drawer-nav svg { width: 24px; height: 24px; color: var(--text-2); flex: none; }
.drawer-nav button.on svg { color: var(--humid); }
.drawer-nav hr { border: 0; border-top: 1px solid var(--divider); margin: 8px 0; }
.drawer-foot { padding: 12px 20px calc(env(safe-area-inset-bottom) + 14px); font-size: 13px; color: var(--text-2); }

/* --- hledání -------------------------------------------------------- */
.search {
  position: fixed; inset: 0; z-index: 30;
  background: var(--surface);
  display: flex; flex-direction: column;
  max-width: 1100px; margin: 0 auto;
}
.search-bar {
  display: flex; align-items: center; gap: 4px;
  background: var(--appbar); color: var(--appbar-text);
  padding: calc(env(safe-area-inset-top) + 8px) 8px 8px 4px;
}
.search-bar input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 19px;
  padding: 10px 12px; border-radius: 4px; border: 0;
  background: rgba(255,255,255,.95); color: #212121;
  outline: none;
}
:root[data-skin="minimal"] .search-bar input { background: #ececec; }
.search-list { overflow-y: auto; flex: 1; padding: 6px 0 24px; }
.s-item { display: flex; align-items: center; gap: 18px; width: 100%; padding: 12px 20px; text-align: left; }
.s-item:active { background: var(--ripple); }
.s-item svg { width: 24px; height: 24px; color: var(--text-2); flex: none; }
.s-item .s-name { font-size: 18px; }
.s-item .s-sub { font-size: 14px; color: var(--text-2); }
.s-head { padding: 14px 20px 4px; font-size: 14px; color: var(--text-2); font-weight: 500; }
.s-msg { padding: 24px 20px; color: var(--text-2); }

/* --- popup a dialog --------------------------------------------------- */
.popup {
  position: fixed; z-index: 40;
  background: var(--surface);
  min-width: 210px;
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(0,0,0,.28);
  padding: 6px 0;
}
:root[data-skin="tmavy"] .popup, :root[data-skin="tmavy"] .dialog { background: #262626; }
.popup button { display: block; width: 100%; text-align: left; padding: 12px 18px; font-size: 16px; }
.popup button:active { background: var(--ripple); }
.dialog-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 24px; }
.dialog { background: var(--surface); border-radius: 6px; width: min(360px, 100%); padding: 20px 8px 6px; box-shadow: 0 10px 40px rgba(0,0,0,.35); max-height: 80vh; overflow-y: auto; }
.dialog h3 { margin: 0 16px 10px; font-size: 20px; font-weight: 500; }
.radio { display: flex; align-items: center; gap: 18px; width: 100%; padding: 12px 16px; text-align: left; font-size: 17px; }
.radio:active { background: var(--ripple); }
.radio i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text-2); flex: none; position: relative; }
.radio.on i { border-color: var(--humid); }
.radio.on i::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--humid); }
.dialog-actions { display: flex; justify-content: flex-end; padding-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 72px);
  transform: translateX(-50%);
  background: #323232; color: #fff;
  padding: 12px 18px; border-radius: 4px; font-size: 15px;
  z-index: 60; max-width: 90vw; text-align: center;
  box-shadow: 0 3px 12px rgba(0,0,0,.3);
}

/* Velké obrazovky – pohodlnější šířka */
@media (min-width: 700px) {
  .p-value { font-size: 40px; }
}
