/* ==========================================================================
   GrupoQ-Cookies: Estilos encapsulados para Banner y Modal de Consentimiento
   ========================================================================== */

:root {
  --gq-cookie-blue: #0056b3;
  --gq-cookie-blue-hover: #004494;
  --gq-cookie-dark: #111827;
  --gq-cookie-text: #374151;
  --gq-cookie-muted: #6b7280;
  --gq-cookie-border: #e5e7eb;
  --gq-cookie-border-btn: #d1d5db;
  --gq-cookie-bg-btn-hover: #f9fafb;
  --gq-cookie-green: #059669;
  --gq-cookie-toggle-off: #cbd5e1;
  --gq-cookie-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Evitar scroll cuando el modal está abierto */
body.gq-cookie-modal-open {
  overflow: hidden !important;
}

/* ==========================================================================
   1. BANNER FIJADO INFERIOR
   ========================================================================== */
.gq-cookie-banner-wrapper {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: #ffffff;
  border-top: 1px solid var(--gq-cookie-border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  z-index: 999990;
  display: none; /* Se activa vía JS si no hay consentimiento */
  font-family: var(--gq-cookie-font);
  color: var(--gq-cookie-text);
  box-sizing: border-box;
  animation: gqSlideUp 0.35s ease-out forwards;
}

.gq-cookie-banner-wrapper *,
.gq-cookie-banner-wrapper *::before,
.gq-cookie-banner-wrapper *::after,
.gq-cookie-modal-overlay *,
.gq-cookie-modal-overlay *::before,
.gq-cookie-modal-overlay *::after {
  box-sizing: border-box;
}

@keyframes gqSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.gq-cookie-banner-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
}

.gq-cookie-banner-text {
  flex: 1 1 auto;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--gq-cookie-text);
  text-align: justify;
  text-justify: inter-word;
}

.gq-cookie-banner-text p {
  margin: 0 0 10px 0;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  text-align: inherit;
}

.gq-cookie-banner-text p:last-child {
  margin-bottom: 0;
}

.gq-cookie-banner-text a {
  color: var(--gq-cookie-blue);
  font-weight: 700;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.gq-cookie-banner-text a:hover {
  color: var(--gq-cookie-blue-hover);
}

.gq-cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

/* Botones genéricos de GrupoQ-Cookies */
.gq-cookie-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-family: var(--gq-cookie-font);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  outline: none;
  text-decoration: none;
}

.gq-cookie-btn-outline {
  background-color: #ffffff;
  color: #1f2937;
  border: 1px solid var(--gq-cookie-border-btn);
}

.gq-cookie-btn-outline:hover {
  background-color: var(--gq-cookie-bg-btn-hover);
  border-color: #9ca3af;
  color: #111827;
}

.gq-cookie-btn-primary {
  background-color: var(--gq-cookie-blue);
  color: #ffffff;
  border: 1px solid var(--gq-cookie-blue);
}

.gq-cookie-btn-primary:hover {
  background-color: var(--gq-cookie-blue-hover);
  border-color: var(--gq-cookie-blue-hover);
  color: #ffffff;
}

/* ==========================================================================
   2. MODAL DE PERSONALIZACIÓN DE CONSENTIMIENTO
   ========================================================================== */
.gq-cookie-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(2px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  font-family: var(--gq-cookie-font);
}

.gq-cookie-modal-overlay.gq-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gq-cookie-modal-container {
  background: #ffffff;
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.gq-cookie-modal-overlay.gq-active .gq-cookie-modal-container {
  transform: translateY(0) scale(1);
}

/* Encabezado del modal */
.gq-cookie-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid var(--gq-cookie-border);
  background: #ffffff;
}

.gq-cookie-modal-header h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--gq-cookie-dark);
  text-transform: uppercase;
}

.gq-cookie-modal-close {
  background: transparent;
  border: none;
  padding: 6px;
  margin: -6px;
  cursor: pointer;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.gq-cookie-modal-close:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}

.gq-cookie-modal-close svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

/* Cuerpo del modal */
.gq-cookie-modal-body {
  padding: 22px 26px;
  overflow-y: auto;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}

.gq-cookie-modal-description {
  font-size: 13.2px;
  line-height: 1.55;
  color: var(--gq-cookie-text);
  margin-bottom: 20px;
}

.gq-cookie-modal-description p {
  margin: 0 0 12px 0;
}

.gq-cookie-modal-description p:last-child {
  margin-bottom: 0;
}

/* Acordeones */
.gq-cookie-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.gq-cookie-accordion-item {
  border: 1px solid var(--gq-cookie-border);
  border-radius: 8px;
  background-color: #ffffff;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gq-cookie-accordion-item.gq-open {
  border-color: #cbd5e1;
}

.gq-cookie-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  cursor: pointer;
  user-select: none;
  background-color: #ffffff;
  transition: background-color 0.15s ease;
}

.gq-cookie-accordion-header:hover {
  background-color: #fcfcfc;
}

.gq-cookie-accordion-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gq-cookie-chevron {
  width: 16px;
  height: 16px;
  color: #4b5563;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.gq-cookie-accordion-item.gq-open .gq-cookie-chevron {
  transform: rotate(180deg);
}

.gq-cookie-accordion-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gq-cookie-dark);
}

.gq-cookie-accordion-status {
  display: flex;
  align-items: center;
}

.gq-cookie-always-active {
  font-size: 13px;
  font-weight: 600;
  color: var(--gq-cookie-green);
}

/* Switch estilo iOS Pill */
.gq-cookie-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
  margin: 0;
}

.gq-cookie-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.gq-cookie-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--gq-cookie-toggle-off);
  transition: background-color 0.25s ease;
  border-radius: 24px;
}

.gq-cookie-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.gq-cookie-switch input:checked + .gq-cookie-slider {
  background-color: var(--gq-cookie-blue);
}

.gq-cookie-switch input:checked + .gq-cookie-slider::before {
  transform: translateX(20px);
}

.gq-cookie-switch input:focus-visible + .gq-cookie-slider {
  box-shadow: 0 0 0 2px rgba(0, 86, 179, 0.3);
}

/* Contenido del acordeón colapsable */
.gq-cookie-accordion-content {
  display: none;
  padding: 13px 18px 16px 18px;
  border-top: 1px solid #f1f5f9;
  background-color: #ffffff;
  font-size: 13px;
  line-height: 1.55;
  color: var(--gq-cookie-text);
}

.gq-cookie-accordion-item.gq-open .gq-cookie-accordion-content {
  display: block;
  animation: gqFadeIn 0.2s ease-in;
}

@keyframes gqFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Pie del modal */
.gq-cookie-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 26px;
  border-top: 1px solid var(--gq-cookie-border);
  background-color: #ffffff;
}

/* ==========================================================================
   3. RESPONSIVE DESIGN (Móviles y Tablets)
   ========================================================================== */
@media (max-width: 991px) {
  .gq-cookie-banner-container {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 18px 20px;
  }
  
  .gq-cookie-banner-text {
    text-align: left;
  }
  
  .gq-cookie-banner-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .gq-cookie-banner-actions {
    flex-direction: column;
    width: 100%;
  }

  .gq-cookie-banner-actions .gq-cookie-btn {
    width: 100%;
  }

  .gq-cookie-modal-container {
    max-height: 94vh;
    border-radius: 10px;
  }

  .gq-cookie-modal-header {
    padding: 16px 18px;
  }

  .gq-cookie-modal-header h2 {
    font-size: 14.5px;
  }

  .gq-cookie-modal-body {
    padding: 16px 18px;
  }

  .gq-cookie-modal-footer {
    padding: 14px 18px;
    flex-direction: column-reverse;
  }

  .gq-cookie-modal-footer .gq-cookie-btn {
    width: 100%;
  }
}
