/* ==========================================================================
   COOKIE CONSENT BANNER & MODALS - IMMOBILIARE CON MICHELE
   Stile integrato con il Design System (Space Grotesk / Teko, Brand Blue, Brand Yellow)
   ========================================================================== */

:root {
  --cc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Space Grotesk", sans-serif;
  --cc-blue: #0044FF;
  --cc-blue-dark: #0033cc;
  --cc-yellow: #FFD90F;
  --cc-yellow-hover: #f0c900;
  --cc-text: #1e293b;
  --cc-muted: #64748b;
  --cc-bg: #ffffff;
  --cc-border: #e2e8f0;
  --cc-radius: 16px;
  --cc-shadow: 0 14px 40px -4px rgba(0, 31, 140, 0.22), 0 6px 18px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   FLOATING BOTTOM BANNER (NON BLOCCANTE)
   ========================================================================== */
.cc-banner-wrap {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  max-width: 580px;
  margin: 0 auto 0 0;
  z-index: 9995;
  font-family: var(--cc-font);
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Su schermi grandi, posizionato con discrezione in basso a sinistra senza coprire il FAB di destra */
@media (min-width: 640px) {
  .cc-banner-wrap {
    left: 1.5rem;
    right: auto;
    bottom: 1.5rem;
    width: calc(100% - 3rem);
  }
}

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

.cc-banner {
  background: var(--cc-bg);
  color: var(--cc-text);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  border: 1.5px solid var(--cc-border);
  border-top: 4px solid var(--cc-yellow);
  padding: 1.35rem 1.35rem 1.15rem;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.cc-banner-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.cc-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(0, 68, 255, 0.08);
  color: var(--cc-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cc-banner-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cc-text);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.25;
}

.cc-banner-desc {
  font-size: 0.85rem;
  color: var(--cc-muted);
  line-height: 1.55;
  margin: 0 0 1.15rem;
}

.cc-banner-desc a {
  color: var(--cc-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.cc-banner-desc a:hover {
  color: var(--cc-blue-dark);
}

.cc-banner-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .cc-banner-actions {
    grid-template-columns: 1.25fr 1fr 1fr;
    gap: 0.55rem;
  }
}

/* Pulsanti del banner */
.cc-btn {
  font-family: var(--cc-font);
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  user-select: none;
  line-height: 1.2;
}

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

/* Accetta tutti: Primario blu intenso con testo bianco brillante */
.cc-btn-accept {
  background: var(--cc-blue);
  color: #ffffff;
  border-color: var(--cc-blue);
  box-shadow: 0 4px 12px rgba(0, 68, 255, 0.25);
}

.cc-btn-accept:hover {
  background: var(--cc-blue-dark);
  border-color: var(--cc-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 68, 255, 0.32);
}

/* Rifiuta: Neutro/Secondario con bordo sobrio */
.cc-btn-reject {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.cc-btn-reject:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

/* Personalizza: Outline discreto */
.cc-btn-customize {
  background: transparent;
  color: var(--cc-blue);
  border-color: rgba(0, 68, 255, 0.3);
}

.cc-btn-customize:hover {
  background: rgba(0, 68, 255, 0.06);
  border-color: var(--cc-blue);
}

/* ==========================================================================
   MODALI: PREFERENZE & POLICY OVERLAYS
   ========================================================================== */
.cc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cc-modal-backdrop.cc-active {
  opacity: 1;
  visibility: visible;
}

.cc-modal-dialog {
  background: #ffffff;
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  border-radius: 20px;
  box-shadow: 0 24px 50px -8px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--cc-border);
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.cc-modal-backdrop.cc-active .cc-modal-dialog {
  transform: scale(1) translateY(0);
}

.cc-modal-dialog.cc-modal-wide {
  max-width: 820px;
  max-height: 90vh;
}

/* Header modale */
.cc-modal-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--cc-border);
  background: #fafbfc;
}

.cc-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cc-text);
  margin: 0;
}

.cc-modal-close {
  background: transparent;
  border: none;
  color: var(--cc-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.cc-modal-close:hover {
  background: #e2e8f0;
  color: var(--cc-text);
}

/* Corpo modale */
.cc-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-family: var(--cc-font);
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.6;
}

.cc-modal-body p {
  margin-bottom: 1rem;
}

.cc-modal-body h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--cc-text);
  margin: 1.25rem 0 0.4rem;
}

/* Footer modale */
.cc-modal-footer {
  padding: 1.1rem 1.5rem;
  border-top: 1px solid var(--cc-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  background: #fafbfc;
}

/* ==========================================================================
   PANNELLO CATEGORIE PREFERENZE (SWITCHES)
   ========================================================================== */
.cc-categories-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.cc-category-card {
  border: 1px solid var(--cc-border);
  border-radius: 12px;
  padding: 1.1rem;
  background: #f8fafc;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.cc-category-card:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.cc-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

.cc-category-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cc-category-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cc-text);
}

.cc-badge-required {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 8px;
  border-radius: 6px;
}

.cc-category-desc {
  font-size: 0.82rem;
  color: var(--cc-muted);
  line-height: 1.5;
  margin: 0;
}

/* Switch toggle iOS-style */
.cc-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.cc-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cc-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 24px;
}

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

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

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

.cc-switch input:disabled + .cc-slider {
  opacity: 0.7;
  cursor: not-allowed;
  background-color: var(--cc-blue);
}

/* ==========================================================================
   PULSANTE FLUTTUANTE RIAPERTURA / REVOCA CONSENSO (GDPR ART. 7)
   ========================================================================== */
.cc-reopen-trigger {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  width: 40px;
  height: 40px;
  background: #ffffff;
  border: 1.5px solid var(--cc-border);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  color: var(--cc-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9990;
  transition: all 0.25s ease;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
}

.cc-reopen-trigger.cc-active {
  opacity: 0.88;
  pointer-events: auto;
  transform: scale(1);
}

.cc-reopen-trigger:hover {
  opacity: 1;
  background: var(--cc-blue);
  color: #ffffff;
  border-color: var(--cc-blue);
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 68, 255, 0.35);
}

/* ==========================================================================
   FORMATTAZIONE TESTI DI POLICY NELLE MODALI
   ========================================================================== */
.cc-policy-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cc-text);
  margin-top: 1.4rem;
  margin-bottom: 0.45rem;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.25rem;
}

.cc-policy-content h3:first-of-type {
  margin-top: 0;
}

.cc-policy-content ul {
  padding-left: 1.35rem;
  margin-bottom: 1rem;
}

.cc-policy-content li {
  margin-bottom: 0.35rem;
}

.cc-policy-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.1rem 0;
  font-size: 0.82rem;
}

.cc-policy-table th,
.cc-policy-table td {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--cc-border);
  text-align: left;
}

.cc-policy-table th {
  background: #f8fafc;
  font-weight: 700;
  color: var(--cc-text);
}

