/*
 * Avís i panell de cookies — hereta els tokens de style.css
 * (--dark, --mid, --light, --white, --font, --r)
 */

.cc-banner[hidden], .cc-overlay[hidden] { display: none; }

/* ─── Primera capa ─── */
.cc-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  max-width: var(--max-w);
  margin: 0 auto;
  background: var(--white);
  color: #333;
  border: 1px solid var(--light);
  border-top: 4px solid var(--dark);
  border-radius: var(--r);
  box-shadow: 0 10px 40px rgba(19,59,63,.18);
  font-family: var(--font);
}

.cc-banner__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 20px 24px;
}

.cc-banner__text { flex: 1; }

.cc-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}

.cc-banner__text p:not(.cc-title) {
  font-size: .85rem;
  line-height: 1.6;
  color: #444;
}

.cc-banner a,
.cc-panel a {
  color: var(--dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Botons: els tres idèntics (mateixa mida, pes i jerarquia) ─── */
.cc-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.cc-btn {
  flex: 1 1 0;
  min-width: 150px;
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--white);
  background: var(--dark);
  border: 2px solid var(--dark);
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.cc-btn:hover { background: var(--mid); border-color: var(--mid); }

.cc-btn:focus-visible,
.cc-close:focus-visible,
.cc-switch input:focus-visible + .cc-switch__track,
.footer-cookies-btn:focus-visible {
  outline: 3px solid var(--mid);
  outline-offset: 2px;
}

/* ─── Segona capa ─── */
.cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(19,59,63,.55);
}

.cc-panel {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--r);
  font-family: var(--font);
  color: #333;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.cc-panel:focus { outline: none; }

.cc-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--light);
}

.cc-panel__head .cc-title { margin: 0; font-size: 1.1rem; }

.cc-close {
  width: 36px;
  height: 36px;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--dark);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.cc-close:hover { background: var(--light); }

.cc-panel__body {
  padding: 18px 24px;
  overflow-y: auto;
  font-size: .87rem;
  line-height: 1.6;
}

.cc-panel__body > p { margin-bottom: 16px; color: #444; }

.cc-cat {
  border: 1px solid var(--light);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.cc-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cc-cat__name { font-weight: 600; color: var(--dark); }

.cc-always {
  font-size: .78rem;
  font-weight: 600;
  color: var(--dark);
  background: var(--light);
  border-radius: 20px;
  padding: 3px 10px;
}

.cc-cat__desc { margin-top: 6px; color: #555; }
.cc-cat__none { margin-top: 4px; font-size: .8rem; font-style: italic; color: #5f6b6d; }

.cc-cat__list { margin-top: 6px; padding-left: 18px; list-style: disc; font-size: .8rem; color: #555; }

.cc-cat__list code {
  font-size: .78rem;
  background: var(--light);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Interruptor */
.cc-switch { position: relative; display: inline-flex; cursor: pointer; }

.cc-switch input {
  position: absolute;
  opacity: 0;
  width: 44px;
  height: 24px;
  margin: 0;
  cursor: pointer;
}

.cc-switch__track {
  width: 44px;
  height: 24px;
  background: #8a9a9c;
  border-radius: 12px;
  position: relative;
  transition: background .2s;
}

.cc-switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--white);
  border-radius: 50%;
  transition: transform .2s;
}

.cc-switch input:checked + .cc-switch__track { background: var(--dark); }
.cc-switch input:checked + .cc-switch__track::after { transform: translateX(20px); }

.cc-panel__foot {
  padding: 16px 24px;
  border-top: 1px solid var(--light);
}

/* Enllaç «Configuració de cookies» del peu (és un botó) */
.footer-cookies-btn {
  font-family: var(--font);
  font-size: .9rem;
  color: rgba(255,255,255,.8);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  transition: color .2s;
}

.footer-cookies-btn:hover { color: var(--white); }

/* Placeholder per a iframes bloquejats */
.cc-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 200px;
  padding: 24px;
  text-align: center;
  background: var(--light);
  border-radius: var(--r);
  font-size: .87rem;
  color: var(--dark);
}

@media (max-width: 860px) {
  .cc-banner__inner { flex-direction: column; align-items: stretch; gap: 16px; }
}

@media (max-width: 560px) {
  .cc-banner { left: 8px; right: 8px; bottom: 8px; }
  .cc-banner__inner { padding: 16px; }
  .cc-actions { flex-direction: column; }
  .cc-btn { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cc-btn, .cc-switch__track, .cc-switch__track::after { transition: none; }
}
