/* ══════════════════════════════════════════
   ConsentHub v1.0.0 — Styles
   CSS nativo con custom properties.
   ══════════════════════════════════════════ */

/* ── Theme defaults (overridable via JS on #ch-root) ── */

:root {
  --ch-primary: #1a1a1a;
  --ch-primary-text: #ffffff;
  --ch-bg: #ffffff;
  --ch-text: #1a1a1a;
  --ch-text-secondary: #555555;
  --ch-border: #e0e0e0;
  --ch-toggle-on: #1a1a1a;
  --ch-toggle-off: #cccccc;
  --ch-radius: 12px;
  --ch-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Overlay ── */

#ch-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999998;
  opacity: 0;
  transition: opacity 0.3s;
}

#ch-overlay.ch-v {
  opacity: 1;
}

/* ── Banner ── */

#ch-banner {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 999999;
  font-family: var(--ch-font);
  font-size: 15px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.35s, transform 0.35s;
  pointer-events: none;
  box-sizing: border-box;
}

#ch-banner *,
#ch-prefs * {
  box-sizing: border-box;
}

#ch-banner.ch-bottom {
  bottom: 0;
  padding: 16px;
}

#ch-banner.ch-top {
  top: 0;
  padding: 16px;
  transform: translateY(-20px);
}

#ch-banner.ch-center {
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transform: scale(0.95);
}

#ch-banner.ch-v {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Banner box ── */

.ch-box {
  background: var(--ch-bg);
  color: var(--ch-text);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  padding: 24px 28px;
  max-width: 640px;
  margin: 0 auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

#ch-banner.ch-center .ch-box {
  max-width: 520px;
}

/* ── Typography ── */

.ch-t {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--ch-text);
}

.ch-d {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--ch-text-secondary);
  line-height: 1.6;
}

/* ── Buttons ── */

.ch-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ch-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  font-family: var(--ch-font);
  line-height: 1.3;
}

.ch-btn:hover {
  opacity: 0.85;
}

.ch-btn:active {
  transform: scale(0.97);
}

.ch-btn:focus-visible {
  outline: 2px solid var(--ch-primary);
  outline-offset: 2px;
}

.ch-bp {
  background: var(--ch-primary);
  color: var(--ch-primary-text);
}

.ch-bs {
  background: transparent;
  color: var(--ch-text);
  border: 1px solid var(--ch-border);
}

/* ── Preferences panel ── */

#ch-prefs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: var(--ch-font);
  font-size: 15px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  box-sizing: border-box;
}

#ch-prefs.ch-v {
  opacity: 1;
  pointer-events: auto;
}

.ch-pbox {
  background: var(--ch-bg);
  color: var(--ch-text);
  border: 1px solid var(--ch-border);
  border-radius: var(--ch-radius);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  transform: translateY(12px);
  transition: transform 0.3s;
}

#ch-prefs.ch-v .ch-pbox {
  transform: translateY(0);
}

/* ── Category rows ── */

.ch-cat {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--ch-border);
}

.ch-cat:last-of-type {
  border-bottom: none;
}

.ch-ci {
  flex: 1;
  padding-right: 16px;
}

.ch-cl {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 2px;
  color: var(--ch-text);
}

.ch-cd {
  font-size: 12px;
  color: var(--ch-text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ── Toggle switch ── */

.ch-tg {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.ch-tg input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.ch-tr {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--ch-toggle-off);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.ch-tg input:checked + .ch-tr {
  background: var(--ch-toggle-on);
}

.ch-tk {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.ch-tg input:checked ~ .ch-tk {
  transform: translateX(20px);
}

.ch-tg input:disabled + .ch-tr {
  background: var(--ch-toggle-on);
  opacity: 0.5;
  cursor: default;
}

.ch-tg input:focus-visible + .ch-tr {
  outline: 2px solid var(--ch-primary);
  outline-offset: 2px;
}

/* ── Preferences buttons spacing ── */

.ch-pbtns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ── Revisit button ── */

#ch-revisit {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 999997;
  background: var(--ch-primary);
  color: var(--ch-primary-text);
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--ch-font);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: opacity 0.3s, transform 0.2s;
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}

#ch-revisit.ch-v {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

#ch-revisit:hover {
  opacity: 0.85;
}

#ch-revisit:focus-visible {
  outline: 2px solid var(--ch-primary);
  outline-offset: 2px;
}

/* ── Mobile ── */

@media (max-width: 480px) {
  .ch-box {
    padding: 20px;
  }

  .ch-btns,
  .ch-pbtns {
    flex-direction: column;
  }

  .ch-pbox {
    padding: 20px;
  }

  #ch-revisit .ch-revisit-text {
    display: none;
  }

  #ch-revisit {
    padding: 8px 10px;
    font-size: 18px;
    line-height: 1;
  }
}
