/* ------------------------------------------------------------------
   Home Energy — cookie lišta (GDPR consent)

   Vše je pod #hec-root, aby se to nepralo s GHL CSS na stránce.
   Lišta je ZÁMĚRNĚ pod survey modalem (z-index 2147482000 vs 2147483000)
   a při otevřeném modalu se schovává úplně.
   ------------------------------------------------------------------ */

#hec-root {
  --hec-accent: #18bd5b;
  --hec-accent-dark: #14a34e;
  --hec-text: #101828;
  --hec-muted: #475467;
  --hec-border: #d0d5dd;

  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147482000;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#hec-root[hidden] { display: none !important; }
/* lišta nesmí čouhat přes otevřený formulář — ani přes náš modal
   (`html.hes-modal-open`, nastavuje survey.js), ani přes nativní GHL popup
   s Jakubovým vlastním dotazníkem na on-nzu-01…04 (`#overlay.show`).
   Po zavření popupu se lišta zase objeví, takže souhlas nikam nezmizí. */
html.hes-modal-open #hec-root { display: none !important; }
/* POZOR: `:has()` musí být ve VLASTNÍM pravidle. V seznamu selektorů
   oddělených čárkou by jeden neznámý selektor zneplatnil celé pravidlo —
   tedy i řádek nad ním — ve starých prohlížečích, které `:has()` neumí. */
body:has(#overlay.show) #hec-root { display: none !important; }

#hec-root *,
#hec-root *::before,
#hec-root *::after { box-sizing: border-box; }

.hec-bar {
  background: #fff;
  border-top: 1px solid #eaecf0;
  box-shadow: 0 -8px 28px rgba(16, 24, 40, 0.14);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  max-height: 85vh;
  overflow-y: auto;
  animation: hec-rise 0.22s ease-out;
}

@keyframes hec-rise {
  from { opacity: 0; transform: translateY(16px) }
  to   { opacity: 1; transform: none }
}

.hec-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1170px;
  margin: 0 auto;
}

.hec-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--hec-muted);
}
.hec-text a {
  color: var(--hec-accent-dark);
  font-weight: 600;
  text-decoration: underline;
}

.hec-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.hec-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  margin: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.hec-btn:focus-visible { outline: 2px solid var(--hec-accent); outline-offset: 2px; }

.hec-btn-primary { background: var(--hec-accent); color: #fff; }
.hec-btn-primary:hover { background: var(--hec-accent-dark); }

.hec-btn-secondary {
  background: #fff;
  border-color: var(--hec-border);
  color: #344054;
}
.hec-btn-secondary:hover { background: #f9fafb; border-color: #98a2b3; }

.hec-btn-ghost {
  background: transparent;
  color: var(--hec-muted);
  font-weight: 600;
  text-decoration: underline;
  padding: 11px 10px;
}
.hec-btn-ghost:hover { color: var(--hec-text); }

/* ---------- panel „Upravit" ---------- */

.hec-panel {
  max-width: 1170px;
  margin: 14px auto 0;
  padding-top: 14px;
  border-top: 1px solid #eaecf0;
}
.hec-panel[hidden] { display: none; }

.hec-cat {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}
.hec-cat + .hec-cat { border-top: 1px solid #f2f4f7; }

.hec-cat input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--hec-accent);
  cursor: pointer;
}
.hec-cat input:disabled { cursor: not-allowed; opacity: 0.6; }

.hec-cat-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--hec-text);
}
.hec-cat-desc {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--hec-muted);
}

.hec-panel-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* ---------- mobil: kompaktní box, do ~30 % výšky ---------- */

@media (max-width: 640px) {
  #hec-root { left: 8px; right: 8px; bottom: 8px; }
  .hec-bar {
    border: 1px solid #eaecf0;
    border-radius: 14px;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    max-height: 78vh;
  }
  .hec-inner { flex-direction: column; align-items: stretch; gap: 12px; }
  .hec-text { font-size: 12.5px; line-height: 1.5; }
  .hec-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  /* „Upravit" je na mobilu odkaz přes celou šířku, ať zbydou dvě velká tlačítka */
  .hec-actions .hec-btn-ghost {
    grid-column: 1 / -1;
    order: 2;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .hec-btn { font-size: 14px; padding: 11px 10px; }
  .hec-panel { margin-top: 12px; }
  .hec-panel-foot .hec-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .hec-bar { animation: none; }
}
