/* ==========================================================================
   Cookie Consent — Frontend Styles
   BEM: .arcc-{block}__{element}--{modifier}
   Variables: --arcc-* (inline desde PHP, fallbacks aquí)
   ========================================================================== */

/* --- Variables fallback --- */
:root {
  --arcc-primary: #0066cc;
  --arcc-accept: #0066cc;
  --arcc-reject: #6c757d;
  --arcc-settings-bg: transparent;
  --arcc-bg: #ffffff;
  --arcc-text: #333333;
  --arcc-radius: 8px;
  --arcc-overlay: 0.5;
}

/* ==========================================================================
   Banner
   ========================================================================== */
.arcc-banner {
  position: fixed;
  z-index: 999999;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--arcc-text);
  box-sizing: border-box;
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.arcc-banner[hidden] {
  display: block !important;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

.arcc-banner.arcc-banner--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* --- Bottom Bar --- */
.arcc-banner--bottom-bar {
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.08);
}

.arcc-banner--bottom-bar .arcc-banner__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* --- Bottom Left / Right --- */
.arcc-banner--bottom-left,
.arcc-banner--bottom-right {
  bottom: 20px;
  max-width: 420px;
  width: calc(100% - 40px);
  background: var(--arcc-bg);
  border-radius: var(--arcc-radius);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.arcc-banner--bottom-left {
  left: 20px;
}

.arcc-banner--bottom-right {
  right: 20px;
}

.arcc-banner--bottom-left .arcc-banner__inner,
.arcc-banner--bottom-right .arcc-banner__inner {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Center Modal --- */
.arcc-banner--center-modal {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, var(--arcc-overlay));
  padding: 20px;
}

.arcc-banner--center-modal .arcc-banner__inner {
  background: var(--arcc-bg);
  border-radius: var(--arcc-radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
  padding: 32px;
  max-width: 560px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Banner Content --- */
.arcc-banner__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: var(--arcc-text);
  line-height: 1.3;
}

.arcc-banner__text {
  margin: 0;
  font-size: 14px;
  color: var(--arcc-text);
  opacity: 0.85;
  line-height: 1.6;
}

.arcc-banner__text a {
  color: var(--arcc-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.arcc-banner__text a:hover {
  opacity: 0.8;
}

/* --- Banner Actions --- */
.arcc-banner__actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.arcc-banner--bottom-left .arcc-banner__actions,
.arcc-banner--bottom-right .arcc-banner__actions,
.arcc-banner--center-modal .arcc-banner__actions {
  flex-direction: column;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.arcc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border-radius: var(--arcc-radius);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
  text-align: center;
}

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

/* Accept */
.arcc-btn--accept {
  background: var(--arcc-accept);
  color: #fff;
  border-color: var(--arcc-accept);
}

.arcc-btn--accept:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

/* Reject */
.arcc-btn--reject {
  background: var(--arcc-reject);
  color: #fff;
  border-color: var(--arcc-reject);
}

.arcc-btn--reject:hover {
  filter: brightness(1.1);
}

/* Settings */
.arcc-btn--settings {
  background: var(--arcc-settings-bg);
  color: var(--arcc-primary);
  border-color: var(--arcc-primary);
}

.arcc-btn--settings:hover {
  background: var(--arcc-primary);
  color: #fff;
}

/* Save */
.arcc-btn--save {
  background: transparent;
  color: var(--arcc-primary);
  border-color: var(--arcc-primary);
}

.arcc-btn--save:hover {
  background: var(--arcc-primary);
  color: #fff;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.arcc-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    sans-serif;
  font-size: 14px;
  color: var(--arcc-text);
  box-sizing: border-box;
  transition: opacity 0.3s ease;
}

.arcc-modal[hidden] {
  display: flex !important;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.arcc-modal.arcc-modal--visible {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.arcc-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, var(--arcc-overlay));
  cursor: pointer;
}

.arcc-modal__content {
  position: relative;
  background: var(--arcc-bg);
  border-radius: calc(var(--arcc-radius) + 4px);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.15),
    0 4px 16px rgba(0, 0, 0, 0.08);
  max-width: 560px;
  width: calc(100% - 40px);
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(0) scale(1);
  transition: transform 0.3s ease;
}

.arcc-modal[hidden] .arcc-modal__content {
  transform: translateY(30px) scale(0.96);
}

/* --- Modal Header --- */
.arcc-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.arcc-modal__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--arcc-text);
}

.arcc-modal__close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: var(--arcc-text);
  opacity: 0.5;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.arcc-modal__close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
}

/* --- Modal Body --- */
.arcc-modal__body {
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
}

/* --- Modal Footer --- */
.arcc-modal__footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  justify-content: flex-end;
}

.arcc-modal__footer .arcc-btn {
  flex: 1;
}

/* ==========================================================================
   Categories
   ========================================================================== */
.arcc-category {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.arcc-category:last-child {
  border-bottom: none;
}

.arcc-category__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  cursor: default;
}

.arcc-category__name {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  color: var(--arcc-text);
}

.arcc-category__badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--arcc-primary);
  background: rgba(0, 102, 204, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
}

.arcc-category__expand {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--arcc-text);
  opacity: 0.4;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.arcc-category__expand:hover {
  opacity: 0.8;
  background: rgba(0, 0, 0, 0.04);
}

.arcc-category__expand[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

.arcc-category__expand svg {
  transition: transform 0.2s ease;
}

/* --- Category Details --- */
.arcc-category__details {
  padding: 0 24px 14px 68px;
  animation: arccSlideDown 0.25s ease;
}

.arcc-category__details[hidden] {
  display: none;
}

.arcc-category__desc {
  margin: 0 0 8px 0;
  font-size: 13px;
  opacity: 0.75;
  line-height: 1.5;
}

.arcc-category__cookies {
  margin: 0;
  font-size: 12px;
  color: var(--arcc-text);
  opacity: 0.55;
  word-break: break-all;
}

.arcc-category__cookies strong {
  opacity: 1;
}

@keyframes arccSlideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Toggle (iOS-style)
   ========================================================================== */
.arcc-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.arcc-toggle__input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.arcc-toggle__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: all 0.25s ease;
}

.arcc-toggle__slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.arcc-toggle__input:checked + .arcc-toggle__slider {
  background: var(--arcc-primary);
}

.arcc-toggle__input:checked + .arcc-toggle__slider::before {
  transform: translateX(20px);
}

.arcc-toggle__input:disabled + .arcc-toggle__slider {
  opacity: 0.7;
  cursor: not-allowed;
}

.arcc-toggle__input:focus-visible + .arcc-toggle__slider {
  outline: 2px solid var(--arcc-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Iframe Placeholders (blocked content)
   ========================================================================== */
.arcc-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: var(--arcc-radius, 8px);
  min-height: 200px;
  text-align: center;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    sans-serif;
  font-size: 14px;
  color: var(--arcc-text, #333);
  overflow: hidden;
  box-sizing: border-box;
}

.arcc-placeholder__inner {
  padding: 30px 20px;
  max-width: 420px;
}

.arcc-placeholder__icon {
  font-size: 36px;
  display: block;
  margin-bottom: 14px;
  opacity: 0.7;
}

.arcc-placeholder__text {
  font-size: 14px;
  line-height: 1.5;
  color: #6c757d;
  margin: 0 0 18px;
}

.arcc-placeholder .arcc-btn {
  display: inline-block;
  padding: 10px 24px;
  border: none;
  border-radius: var(--arcc-radius, 8px);
  background: var(--arcc-primary, #0066cc);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.arcc-placeholder .arcc-btn:hover {
  opacity: 0.85;
}

/* ==========================================================================
   Float Button
   ========================================================================== */
.arcc-float {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 999998;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--arcc-bg, #fff);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.1),
    0 1px 4px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--arcc-primary);
  transition: all 0.3s ease;
  padding: 0;
}

.arcc-float[hidden] {
  display: flex !important;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6);
}

.arcc-float.arcc-float--visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.arcc-float:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  transform: scale(1.08);
}

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

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
  /* Banner siempre full-width bottom en móvil */
  .arcc-banner--bottom-left,
  .arcc-banner--bottom-right {
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 100%;
    width: 100%;
    border-radius: 0;
  }

  .arcc-banner--bottom-bar .arcc-banner__inner {
    flex-direction: column;
    padding: 16px 20px;
    gap: 14px;
  }

  .arcc-banner__actions {
    width: 100%;
  }

  .arcc-banner--bottom-bar .arcc-banner__actions {
    flex-direction: column;
  }

  .arcc-banner__actions .arcc-btn {
    width: 100%;
  }

  /* Modal */
  .arcc-modal__content {
    width: calc(100% - 20px);
    max-height: calc(100vh - 40px);
    border-radius: var(--arcc-radius);
  }

  .arcc-modal__header {
    padding: 16px 18px;
  }

  .arcc-category__header {
    padding: 12px 18px;
  }

  .arcc-category__details {
    padding: 0 18px 12px 58px;
  }

  .arcc-modal__footer {
    padding: 14px 18px;
    flex-direction: column;
  }

  /* Float button */
  .arcc-float {
    bottom: 14px;
    left: 14px;
    width: 42px;
    height: 42px;
  }
}

/* ==========================================================================
   Print: ocultar todo
   ========================================================================== */
@media print {
  .arcc-banner,
  .arcc-modal,
  .arcc-float {
    display: none !important;
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .arcc-banner,
  .arcc-modal,
  .arcc-modal__content,
  .arcc-float,
  .arcc-toggle__slider,
  .arcc-toggle__slider::before,
  .arcc-category__expand svg {
    transition: none !important;
    animation: none !important;
  }
}

/* ==========================================================================
   Box sizing reset (encapsulado)
   ========================================================================== */
.arcc-banner *,
.arcc-modal *,
.arcc-float * {
  box-sizing: border-box;
}
