/* ── Cookie Consent — Opscadia ── */

/* Banner */
#cc-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -4px 24px rgba(0,0,0,.10);
  z-index: 1100;
  padding: 16px 24px;
}
.cc-banner__inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.cc-banner__text {
  flex: 1;
  font-size: 14px;
  color: #374151;
  line-height: 1.5;
  margin: 0;
}
.cc-banner__link {
  color: #7c3aed;
  text-decoration: underline;
  white-space: nowrap;
}
.cc-banner__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Buttons */
.cc-btn {
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, color .15s, transform .1s;
  white-space: nowrap;
}
.cc-btn--primary  { background: #7c3aed; color: #fff; }
.cc-btn--primary:hover  { background: #6d28d9; }
.cc-btn--outline  { background: transparent; color: #7c3aed; border: 1.5px solid #7c3aed; }
.cc-btn--outline:hover  { background: #f5f3ff; }
.cc-btn--ghost    { background: #f3f4f6; color: #374151; }
.cc-btn--ghost:hover    { background: #e5e7eb; }
.cc-btn:active    { transform: scale(.97); }

/* Overlay */
#cc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#cc-overlay[hidden] { display: none; }

/* Modal */
.cc-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  padding: 28px 28px 24px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.20);
  max-height: 90vh;
  overflow-y: auto;
}
.cc-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f3f4f6;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: background .15s;
}
.cc-modal__close:hover { background: #e5e7eb; color: #111; }
.cc-modal__title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px;
}
.cc-modal__intro {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 20px;
  line-height: 1.5;
}
.cc-modal__list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cc-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f9fafb;
  border-radius: 10px;
  padding: 12px 14px;
}
.cc-row__info {
  flex: 1;
}
.cc-row__info strong {
  display: block;
  font-size: 14px;
  color: #111827;
  margin-bottom: 2px;
}
.cc-row__info span {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}
.cc-row__more {
  display: none;
  font-size: 12px;
  color: #7c3aed;
  text-decoration: underline;
  margin-top: 2px;
}
.cc-modal__footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Toggle switch */
.cc-toggle {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  flex-shrink: 0;
}
.cc-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.cc-toggle__track {
  width: 40px;
  height: 22px;
  background: #d1d5db;
  border-radius: 11px;
  position: relative;
  transition: background .2s;
}
.cc-toggle__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.cc-toggle input:checked + .cc-toggle__track { background: #7c3aed; }
.cc-toggle input:checked + .cc-toggle__track::after { transform: translateX(18px); }
.cc-toggle--locked { opacity: .6; cursor: not-allowed; }

/* Pallino gestione cookie */
#cc-dot {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: transform .15s ease, opacity .15s ease;
}
#cc-dot:hover { transform: scale(1.08); opacity: .85; }
#cc-dot img { width: 34px; height: 34px; filter: none; }
#cc-dot.cc-dot--hidden { display: none; }

@media (max-width: 640px) {
  /* Banner */
  #cc-banner { padding: 14px 16px 20px; }
  .cc-banner__inner { flex-direction: column; align-items: stretch; gap: 14px; }
  .cc-banner__text { font-size: 13px; }
  .cc-banner__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  #cc-accept-all { grid-column: 1 / -1; }

  /* Overlay: sheet dal basso */
  #cc-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .cc-modal {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    max-height: 85vh;
    padding: 20px 18px 32px;
  }
  /* Drag handle visivo */
  .cc-modal::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto 16px;
  }
  .cc-modal__footer { flex-direction: row; justify-content: space-between; }
  .cc-modal__footer .cc-btn { flex: 1; text-align: center; }
  .cc-modal__footer #cc-reject-modal { order: 1; }
  .cc-modal__footer #cc-save { order: 2; }
  .cc-row { align-items: flex-start; }
  .cc-toggle { margin-top: 2px; }

  /* descrizioni troncate a 1 riga + link espandi */
  .cc-row__desc {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .cc-row--expanded .cc-row__desc {
    -webkit-line-clamp: unset;
    overflow: visible;
  }
  .cc-row__more { display: inline-block; }
}
