/*
 * Cookie-consent banner and settings dialog for the Hopi Ads landing page.
 *
 * Scope: these styles are loaded ONLY by the static landing page (public/landing/index.html) and
 * are namespaced `hpa-consent-*` so they cannot collide with the Hopi Ads panel's Tailwind layer
 * or with the landing's own `hpa-*` component classes.
 *
 * Design source: the Hopi consent bar shown on hopi.com.tr - white surface pinned to the bottom of
 * the viewport, explanatory copy on the left, one text action plus two filled actions on the right.
 * Colour and type tokens are taken from Hopi's own landing stylesheet (css/hopiads.css) rather than
 * invented: the cyan is the `#00b0d2` stop of the Hopi brand gradient, the body font is Open Sans,
 * and the muted grey matches `--hpa-muted`.
 *
 * Layout contract: the bar is `position: fixed` and therefore outside the document flow, so it
 * cannot shift the page. `--hpa-consent-height` is published by consent.js and consumed as bottom
 * padding on <body> while the bar is open, so the bar can never cover the footer's last line.
 */

:root {
  /* Published by consent.js while the bar is visible; 0 when it is not. */
  --hpa-consent-height: 0px;
}

/* The landing page reserves room for the bar instead of letting it overlap the footer. */
body.hpa.hpa-consent-open {
  padding-bottom: var(--hpa-consent-height);
}

/* ─────────────────────────────── The bar ─────────────────────────────── */

.hpa-consent {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 32px;
  padding: 18px max(24px, calc((100% - 1280px) / 2));
  background: #fff;
  border-top: 1px solid var(--hpa-border, #e3e3e8);
  box-shadow: 0 -4px 24px rgb(0 0 0 / 8%);
  font-family: 'Open Sans', Arial, sans-serif;
}

.hpa-consent[hidden] {
  display: none;
}

.hpa-consent-text {
  flex: 1 1 520px;
  color: #4a4a52;
  font-size: 13px;
  line-height: 1.6;
}

.hpa-consent-text p {
  margin: 0;
}

.hpa-consent-text a {
  color: #00b0d2;
  text-decoration: underline;
}

.hpa-consent-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ──────────────────────────── Action buttons ─────────────────────────── */

.hpa-consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #00b0d2;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: filter .2s ease;
}

.hpa-consent-btn:hover {
  filter: brightness(.94);
}

/* "Ayarlar" is a text action, not a filled button - it must not compete with the two choices. */
.hpa-consent-btn--text {
  min-height: auto;
  padding: 0 8px;
  background: none;
  color: #00b0d2;
}

.hpa-consent-btn--text:hover {
  filter: none;
  text-decoration: underline;
}

/* ─────────────────────── The settings dialog ─────────────────────────── */

.hpa-consent-dialog {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(0 0 0 / 45%);
  font-family: 'Open Sans', Arial, sans-serif;
}

.hpa-consent-dialog[hidden] {
  display: none;
}

.hpa-consent-panel {
  width: min(680px, 100%);
  max-height: min(86vh, 760px);
  overflow-y: auto;
  padding: 24px 28px 28px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 64px rgb(0 0 0 / 24%);
}

.hpa-consent-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.hpa-consent-panel-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.3;
}

.hpa-consent-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--hpa-light-btn, #f2f3f7);
  color: #000;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.hpa-consent-close:hover {
  filter: brightness(.95);
}

/* Hopi's category tabs. On narrow screens they scroll horizontally rather than wrap into a wall. */
.hpa-consent-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--hpa-border, #e3e3e8);
}

.hpa-consent-tab {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: #6b6b70;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.hpa-consent-tab:hover {
  color: #000;
}

.hpa-consent-tab.is-active {
  border-bottom-color: #00b0d2;
  color: #000;
}

.hpa-consent-pane p {
  margin: 0 0 16px;
  color: #4a4a52;
  font-size: 13px;
  line-height: 1.7;
}

.hpa-consent-pane[hidden] {
  display: none;
}

/* "Her Zaman Aktif" — the locked state of the strictly necessary category. */
.hpa-consent-always {
  display: inline-block;
  color: #00b0d2;
  font-size: 13px;
  font-weight: 700;
}

.hpa-consent-switch {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hpa-consent-switch-control {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex: 0 0 auto;
}

.hpa-consent-switch-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.hpa-consent-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c9c9d1;
  transition: background .2s ease;
  pointer-events: none;
}

.hpa-consent-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}

.hpa-consent-switch-control input:checked + .hpa-consent-slider {
  background: #00b0d2;
}

.hpa-consent-switch-control input:checked + .hpa-consent-slider::before {
  transform: translateX(22px);
}

.hpa-consent-switch-control input:focus-visible + .hpa-consent-slider {
  outline: 3px solid #007a91;
  outline-offset: 3px;
}

.hpa-consent-switch-label {
  color: #a9a9a9;
  font-size: 13px;
  font-weight: 600;
}

.hpa-consent-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--hpa-border, #e3e3e8);
}

/* A secondary choice inside the dialog: readable, but visually below the primary save action. */
.hpa-consent-btn--secondary {
  border-color: #00b0d2;
  background: #fff;
  color: #00b0d2;
}

/* ───────────────────── Footer re-open affordance ─────────────────────── */

/* The visitor must be able to change the answer later; a consent UI that cannot be reopened is not
   a consent UI. This button lives in the footer link column and looks like its siblings. */
.hpa-consent-reopen {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hpa-consent-reopen:hover {
  text-decoration: underline;
}

/* ──────────────────────────── Small screens ──────────────────────────── */

@media (max-width: 767.98px) {
  .hpa-consent {
    gap: 14px;
    padding: 16px 20px;
  }

  .hpa-consent-text {
    flex-basis: 100%;
    font-size: 12px;
  }

  .hpa-consent-actions {
    width: 100%;
  }

  /* Stacked full-width targets: at 375px three side-by-side buttons fall below the 44px tap size. */
  .hpa-consent-actions .hpa-consent-btn {
    flex: 1 1 100%;
    min-height: 44px;
  }

  .hpa-consent-actions .hpa-consent-btn--text {
    order: 3;
    min-height: 44px;
  }

  .hpa-consent-panel {
    padding: 22px 18px;
  }

  .hpa-consent-panel-actions .hpa-consent-btn {
    flex: 1 1 100%;
    min-height: 44px;
  }
}

/* Honour the visitor's motion preference and keep the bar out of print output. */
@media (prefers-reduced-motion: reduce) {
  .hpa-consent-btn {
    transition: none;
  }
}

@media print {
  .hpa-consent,
  .hpa-consent-dialog {
    display: none !important;
  }
}
