/* ============================================
   Mutui Sicuri — Cookie Consent Banner
   Google Consent Mode v2 — GDPR Compliant
   ============================================ */

/* ---- Overlay sfondo ---- */
#ms-consent-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 45, 0.55);
  z-index: 99998;
  backdrop-filter: blur(2px);
}
#ms-consent-overlay.show { display: block; }

/* ---- Banner principale ---- */
#ms-consent-banner {
  display: block;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  background: #ffffff;
  border-top: 4px solid #c8a42d;
  box-shadow: 0 -4px 32px rgba(13, 43, 94, 0.18);
  padding: 20px 24px 20px;
  font-family: 'Poppins', Arial, sans-serif;
}
#ms-consent-banner.show { display: block; }
#ms-consent-banner.ms-hidden { display: none !important; }

.ms-consent-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* Logo + testo */
.ms-consent-text {
  flex: 1;
  min-width: 260px;
}
.ms-consent-text strong {
  display: block;
  color: #0d2b5e;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}
.ms-consent-text p {
  margin: 0;
  color: #5f6b7a;
  font-size: 13px;
  line-height: 1.55;
}
.ms-consent-text a {
  color: #0d2b5e;
  text-decoration: underline;
  font-weight: 600;
}

/* Bottoni */
.ms-consent-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

.ms-btn {
  padding: 11px 22px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: 'Poppins', Arial, sans-serif;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap;
}
.ms-btn:active { transform: scale(0.97); }

.ms-btn-accept {
  background: #c8a42d;
  color: #0d2b5e;
}
.ms-btn-accept:hover { opacity: 0.88; }

.ms-btn-reject {
  background: transparent;
  color: #0d2b5e;
  border: 2px solid #0d2b5e;
}
.ms-btn-reject:hover { background: #f0f3fa; }

.ms-btn-manage {
  background: transparent;
  color: #8a95a3;
  border: 1.5px solid #d0d7e3;
  font-weight: 500;
}
.ms-btn-manage:hover { background: #f4f6fa; color: #0d2b5e; }

/* ---- Pannello preferenze ---- */
#ms-consent-prefs {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#ms-consent-prefs.show { display: flex; }

.ms-prefs-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 48px rgba(13, 43, 94, 0.22);
  max-width: 520px;
  width: 100%;
  overflow: hidden;
}
.ms-prefs-header {
  background: #0d2b5e;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ms-prefs-header h2 {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}
.ms-prefs-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.ms-prefs-close:hover { color: #fff; }

.ms-prefs-body { padding: 20px 24px; }

.ms-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #eef1f6;
}
.ms-toggle-row:last-child { border-bottom: none; }

.ms-toggle-info { flex: 1; }
.ms-toggle-info strong { display: block; color: #0d2b5e; font-size: 14px; margin-bottom: 3px; }
.ms-toggle-info span { font-size: 12px; color: #8a95a3; line-height: 1.4; }

/* Toggle switch */
.ms-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}
.ms-toggle input { opacity: 0; width: 0; height: 0; }
.ms-toggle-slider {
  position: absolute;
  inset: 0;
  background: #d0d7e3;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.ms-toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.ms-toggle input:checked + .ms-toggle-slider { background: #c8a42d; }
.ms-toggle input:checked + .ms-toggle-slider:before { transform: translateX(20px); }
.ms-toggle input:disabled + .ms-toggle-slider { opacity: 0.5; cursor: not-allowed; }

.ms-prefs-footer {
  padding: 16px 24px 20px;
  display: flex;
  gap: 10px;
  border-top: 1px solid #eef1f6;
}
.ms-prefs-footer .ms-btn { flex: 1; text-align: center; }

/* ---- Pulsante riapertura (angolo basso sinistra) ---- */
#ms-consent-reopen {
  display: none;
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 9999;
  background: #0d2b5e;
  color: #c8a42d;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(13,43,94,0.30);
  transition: opacity 0.2s;
  align-items: center;
  justify-content: center;
}
#ms-consent-reopen.show { display: flex; }
#ms-consent-reopen:hover { opacity: 0.85; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  #ms-consent-banner { padding: 16px; }
  .ms-consent-inner { flex-direction: column; gap: 14px; }
  .ms-consent-actions { width: 100%; justify-content: stretch; }
  .ms-btn { flex: 1; text-align: center; padding: 11px 10px; font-size: 13px; }
}
