/* ===== COOKIE BANNER + MODAL ===== */
/* Tapicería Alonso · RGPD/LOPDGDD/AEPD compliant · vanilla JS */

#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #1a1a1a;
  border-top: 1px solid #262626;
  padding: 24px 24px;
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.4);
  font-family: 'Inter', system-ui, sans-serif;
  color: #f5f5f5;
}
#cookie-banner.visible { transform: translateY(0); }

#cookie-banner .cb-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}
#cookie-banner h3 {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
#cookie-banner p {
  margin: 0;
  font-size: 14px;
  color: #a1a1aa;
  line-height: 1.5;
}
#cookie-banner p a {
  color: #dc2626;
  text-decoration: underline;
}
#cookie-banner .cb-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
#cookie-banner button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
#cookie-banner .cb-btn-primary {
  background: #dc2626;
  color: white;
}
#cookie-banner .cb-btn-primary:hover { background: #ef4444; }
#cookie-banner .cb-btn-reject {
  background: transparent;
  color: #f5f5f5;
  border: 1px solid #444;
}
#cookie-banner .cb-btn-reject:hover { background: #262626; }
#cookie-banner .cb-btn-config {
  background: transparent;
  color: #a1a1aa;
  text-decoration: underline;
  padding: 10px 6px;
}
#cookie-banner .cb-btn-config:hover { color: #f5f5f5; }

/* ===== MODAL ===== */
#cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: 'Inter', system-ui, sans-serif;
}
#cookie-modal.visible { display: flex; }

#cookie-modal .cm-content {
  background: #141414;
  border: 1px solid #262626;
  border-radius: 14px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  color: #f5f5f5;
}
#cookie-modal h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 8px 0;
  color: #fff;
}
#cookie-modal .cm-intro {
  font-size: 14px;
  color: #a1a1aa;
  margin-bottom: 24px;
  line-height: 1.6;
}
#cookie-modal .cm-intro a {
  color: #dc2626;
  text-decoration: underline;
}

#cookie-modal .cm-category {
  background: #1a1a1a;
  border: 1px solid #262626;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
#cookie-modal .cm-category-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
#cookie-modal .cm-category h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: #fff;
}
#cookie-modal .cm-category p {
  font-size: 13px;
  color: #a1a1aa;
  margin: 0;
  line-height: 1.5;
}
#cookie-modal .cm-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: #404040;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
#cookie-modal .cm-toggle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: left 0.2s;
}
#cookie-modal input[type="checkbox"] { display: none; }
#cookie-modal input[type="checkbox"]:checked + .cm-toggle { background: #dc2626; }
#cookie-modal input[type="checkbox"]:checked + .cm-toggle::before { left: 22px; }
#cookie-modal input[type="checkbox"]:disabled + .cm-toggle {
  background: #525252;
  cursor: not-allowed;
  opacity: 0.6;
}

#cookie-modal .cm-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}
#cookie-modal .cm-actions button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  flex: 1;
  min-width: 140px;
}
#cookie-modal .cm-btn-save {
  background: transparent;
  color: #f5f5f5;
  border: 1px solid #444;
}
#cookie-modal .cm-btn-save:hover { background: #262626; }
#cookie-modal .cm-btn-accept {
  background: #dc2626;
  color: white;
}
#cookie-modal .cm-btn-accept:hover { background: #ef4444; }

/* ===== GOOGLE MAPS CLICK-TO-LOAD ===== */
.map-consent-block {
  width: 100%;
  height: 100%;
  min-height: 320px;
  background: #1a1a1a;
  border: 1px dashed #444;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  font-family: 'Inter', system-ui, sans-serif;
}
.map-consent-block .map-icon {
  width: 56px;
  height: 56px;
  background: rgba(220, 38, 38, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
}
.map-consent-block h4 {
  font-size: 16px;
  font-weight: 700;
  color: #f5f5f5;
  margin: 0 0 8px 0;
}
.map-consent-block p {
  font-size: 13px;
  color: #a1a1aa;
  margin: 0 0 20px 0;
  max-width: 400px;
  line-height: 1.5;
}
.map-consent-block button {
  background: #dc2626;
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.map-consent-block button:hover { background: #ef4444; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  #cookie-banner .cb-inner {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  #cookie-banner .cb-actions { width: 100%; }
  #cookie-banner button { flex: 1; }
}
@media (max-width: 500px) {
  #cookie-banner { padding: 20px 18px; }
  #cookie-modal .cm-content { padding: 24px 20px; }
  #cookie-modal .cm-actions button { min-width: 0; }
}
