/* ═══════════════════════════════════════════════════════════════════════════
   gdpr.css — Chords Master
   Estilos del banner de consentimiento RGPD, modal de preferencias y
   botón flotante de privacidad.
   Compatible con el tema oscuro de la PWA y de la landing page.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables locales (no dependen del :root del resto de la app) ───────── */
:root {
  --gdpr-bg:          #111111;
  --gdpr-surface:     #1a1a1a;
  --gdpr-border:      #2e2e2e;
  --gdpr-text:        #e8e8e8;
  --gdpr-muted:       #9a9a9a;
  --gdpr-accent:      #f59e0b;
  --gdpr-accent-dark: #b45309;
  --gdpr-danger:      #ef4444;
  --gdpr-radius:      12px;
  --gdpr-radius-sm:   8px;
  --gdpr-shadow:      0 -4px 32px rgba(0, 0, 0, 0.7);
  --gdpr-modal-shadow:0 8px 48px rgba(0, 0, 0, 0.85);
  --gdpr-z-banner:    9000;
  --gdpr-z-modal:     9001;
  --gdpr-z-float:     8999;
}

/* ══════════════════════════════════════════════════════════════════════════
   BANNER DE COOKIES
   ══════════════════════════════════════════════════════════════════════════ */
#gdpr-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--gdpr-z-banner);
  background: var(--gdpr-bg);
  border-top: 1px solid var(--gdpr-border);
  box-shadow: var(--gdpr-shadow);
  padding: 18px 20px;
  animation: gdpr-slide-up 0.3s ease-out;
}

#gdpr-banner[hidden] {
  display: none;
}

@keyframes gdpr-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.gdpr-banner__inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.gdpr-banner__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gdpr-accent);
  font-size: 1rem;
  margin-top: 2px;
}

.gdpr-banner__text {
  flex: 1;
  min-width: 0;
}

.gdpr-banner__text h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gdpr-text);
  margin-bottom: 6px;
}

.gdpr-banner__text p {
  font-size: 0.83rem;
  color: var(--gdpr-muted);
  line-height: 1.55;
  margin-bottom: 6px;
}

.gdpr-banner__text a {
  color: var(--gdpr-accent);
  font-size: 0.83rem;
  text-decoration: underline;
}

.gdpr-banner__actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

/* ── Responsive: stack on mobile ──────────────────────────────────────────── */
@media (max-width: 700px) {
  .gdpr-banner__inner {
    flex-direction: column;
    gap: 14px;
  }
  .gdpr-banner__icon { display: none; }
  .gdpr-banner__actions {
    flex-direction: column;
    min-width: 0;
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   MODAL DE PREFERENCIAS
   ══════════════════════════════════════════════════════════════════════════ */
#gdpr-modal {
  position: fixed;
  inset: 0;
  z-index: var(--gdpr-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#gdpr-modal[hidden] {
  display: none;
}

#gdpr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.gdpr-modal__box {
  position: relative;
  z-index: 1;
  background: var(--gdpr-surface);
  border: 1px solid var(--gdpr-border);
  border-radius: var(--gdpr-radius);
  box-shadow: var(--gdpr-modal-shadow);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: gdpr-modal-in 0.22s ease-out;
}

@keyframes gdpr-modal-in {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.gdpr-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--gdpr-border);
}

.gdpr-modal__header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gdpr-text);
}

.gdpr-modal__close {
  background: none;
  border: none;
  color: var(--gdpr-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}

.gdpr-modal__close:hover {
  color: var(--gdpr-text);
  background: rgba(255, 255, 255, 0.07);
}

.gdpr-modal__body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Fila de categoría de cookie ─────────────────────────────────────────── */
.gdpr-cookie-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--gdpr-border);
  border-radius: var(--gdpr-radius-sm);
}

.gdpr-cookie-info {
  flex: 1;
  min-width: 0;
}

.gdpr-cookie-info strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gdpr-text);
  margin-bottom: 5px;
}

.gdpr-cookie-info p {
  font-size: 0.8rem;
  color: var(--gdpr-muted);
  line-height: 1.5;
  margin: 0;
}

.gdpr-cookie-info a {
  color: var(--gdpr-accent);
  text-decoration: underline;
  font-size: 0.8rem;
}

/* ── Toggle switch ───────────────────────────────────────────────────────── */
.gdpr-toggle {
  flex-shrink: 0;
  position: relative;
  width: 44px;
  height: 26px;
  margin-top: 2px;
}

.gdpr-toggle input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.gdpr-toggle__track {
  position: absolute;
  inset: 0;
  background: #333;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.gdpr-toggle__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #888;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.gdpr-toggle input:checked + .gdpr-toggle__track {
  background: var(--gdpr-accent);
}

.gdpr-toggle input:checked + .gdpr-toggle__track::after {
  transform: translateX(18px);
  background: #fff;
}

.gdpr-toggle input:disabled + .gdpr-toggle__track {
  opacity: 0.5;
  cursor: not-allowed;
}

.gdpr-toggle input:focus-visible + .gdpr-toggle__track {
  outline: 2px solid var(--gdpr-accent);
  outline-offset: 2px;
}

/* ── Badge "siempre activo" ──────────────────────────────────────────────── */
.gdpr-always-on {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 999px;
  padding: 1px 8px;
  margin-top: 4px;
}

.gdpr-modal__footer {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--gdpr-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ══════════════════════════════════════════════════════════════════════════
   BOTONES GDPR
   ══════════════════════════════════════════════════════════════════════════ */
.gdpr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--gdpr-radius-sm);
  font-size: 0.83rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
  line-height: 1;
}

.gdpr-btn--primary {
  background: var(--gdpr-accent);
  color: #000;
}
.gdpr-btn--primary:hover { background: #e08e00; }

.gdpr-btn--secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--gdpr-text);
  border: 1px solid var(--gdpr-border);
}
.gdpr-btn--secondary:hover { background: rgba(255, 255, 255, 0.14); }

.gdpr-btn--outline {
  background: transparent;
  color: var(--gdpr-muted);
  border: 1px solid var(--gdpr-border);
}
.gdpr-btn--outline:hover { color: var(--gdpr-text); border-color: #555; }

/* ══════════════════════════════════════════════════════════════════════════
   BOTÓN FLOTANTE DE PRIVACIDAD
   Solo visible en landing page y página de política (en la PWA se usa el
   botón de escudo integrado en la toolbar).
   ══════════════════════════════════════════════════════════════════════════ */
#gdpr-float-btn {
  position: fixed;
  bottom: 14px;
  right: 14px;
  left: auto;
  z-index: var(--gdpr-z-float);
  background: var(--gdpr-surface);
  border: 1px solid var(--gdpr-border);
  border-radius: 999px;
  padding: 8px 14px 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gdpr-muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

#gdpr-float-btn[hidden] { display: none; }

#gdpr-float-btn:hover {
  color: var(--gdpr-accent);
  border-color: var(--gdpr-accent);
  background: rgba(245, 158, 11, 0.06);
}

#gdpr-float-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* En móvil: solo icono, sin texto */
@media (max-width: 600px) {
  #gdpr-float-btn {
    padding: 9px;
    border-radius: 50%;
    bottom: 10px;
    right: 10px;
  }
  #gdpr-float-btn .gdpr-float-label { display: none; }
  #gdpr-float-btn svg { width: 16px; height: 16px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   TOAST DE RECARGA
   Aparece cuando el usuario retira el consentimiento publicitario y ya
   estaba cargado AdSense. La página se recarga automáticamente.
   ══════════════════════════════════════════════════════════════════════════ */
#gdpr-reload-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: calc(var(--gdpr-z-modal) + 1);
  background: var(--gdpr-surface);
  border: 1px solid var(--gdpr-border);
  border-left: 3px solid var(--gdpr-accent);
  border-radius: var(--gdpr-radius-sm);
  padding: 12px 20px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--gdpr-text);
  box-shadow: 0 4px 24px rgba(0,0,0,0.6);
  white-space: nowrap;
  animation: gdpr-toast-in 0.25s ease-out;
}

#gdpr-reload-toast[hidden] { display: none; }

#gdpr-reload-toast::before {
  content: '🛡 Aplicando cambios de privacidad — recargando…';
}

@keyframes gdpr-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 500px) {
  #gdpr-reload-toast {
    white-space: normal;
    width: calc(100vw - 32px);
    left: 16px;
    transform: none;
  }
}
