/* cookie-consent.css */

/* Mobile: largura total, centralizado na base */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--color-white);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  z-index: 9999;
  transform: translateY(calc(100% + 2rem));
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cookie-banner.show {
  transform: translateY(0);
}

/* Desktop e tablet: canto inferior esquerdo, largura limitada */
@media (min-width: 768px) {
  .cookie-banner {
    bottom: 1.5rem;
    left: 1.5rem;
    width: 420px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(calc(100% + 2rem));
  }

  .cookie-banner.show {
    transform: translateY(0);
  }
}

.cookie-content {
  flex: 1;
}

.cookie-title {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-secondary);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.cookie-text {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.cookie-text a {
  color: var(--color-primary);
  text-decoration: underline;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (min-width: 992px) {
  .cookie-banner {
    width: 460px;
  }
}

.btn-cookie {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
}

/* Botão "ghost" (Personalizar / Salvar) — sem fundo, com hover discreto. */
.btn-cookie--ghost {
  background: transparent;
  border: 1px solid var(--color-neutral-light);
  color: var(--color-secondary);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.btn-cookie--ghost:hover,
.btn-cookie--ghost:focus-visible {
  background: var(--color-neutral-light);
  border-color: var(--color-text-muted);
  outline: none;
}

/* =============================================================
   PAINEL DE PREFERÊNCIAS GRANULARES (modal)
   ============================================================= */
.cookie-panel[hidden] { display: none; }

.cookie-panel {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.cookie-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 25, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: cookie-panel-fade 0.2s ease-out;
}

.cookie-panel__card {
  position: relative;
  background: var(--color-white);
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 28px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  animation: cookie-panel-rise 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.cookie-panel__header h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-secondary);
  margin: 0;
}

.cookie-panel__close {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.cookie-panel__close:hover,
.cookie-panel__close:focus-visible {
  background: var(--color-neutral-light);
  color: var(--color-secondary);
  outline: none;
}
.cookie-panel__close svg { width: 18px; height: 18px; }

.cookie-panel__intro {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin: 0 0 1.25rem;
}
.cookie-panel__intro a { color: var(--color-primary); text-decoration: underline; }

.cookie-panel__categories {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.cookie-cat {
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 0.875rem 1rem;
  background: var(--color-white);
}
.cookie-cat--locked {
  background: var(--color-neutral-light);
  border-color: #E5E7EB;
}

.cookie-cat__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}
.cookie-cat__title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-neutral-dark);
  margin: 0;
}
.cookie-cat__desc {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}
.cookie-cat__badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
}
.cookie-cat__badge--locked {
  background: rgba(242, 138, 0, 0.12);
  color: var(--color-primary);
}

/* Toggle switch */
.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.cookie-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  margin: 0;
}
.cookie-toggle__slider {
  position: absolute;
  inset: 0;
  background: #CBD5E1;
  border-radius: 24px;
  transition: background var(--transition-fast);
}
.cookie-toggle__slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--color-white);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast);
}
.cookie-toggle input:checked + .cookie-toggle__slider {
  background: var(--color-primary);
}
.cookie-toggle input:checked + .cookie-toggle__slider::before {
  transform: translateX(20px);
}
.cookie-toggle input:focus-visible + .cookie-toggle__slider {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.cookie-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 0.5rem;
  border-top: 1px solid #F3F4F6;
}
.cookie-panel__actions .btn-cookie { flex: 0 1 auto; }

@keyframes cookie-panel-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes cookie-panel-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mobile: ações empilham e ocupam largura cheia */
@media (max-width: 560px) {
  .cookie-panel__card { padding: 22px 18px 18px; }
  .cookie-panel__actions { flex-direction: column-reverse; align-items: stretch; }
  .cookie-panel__actions .btn-cookie { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-panel__backdrop,
  .cookie-panel__card { animation: none; }
}
