/* =========================================================================
   SmartRicicla — Cookie Banner CSS
   Coerente con stile sito (font Inter, brand-green #019939)
   ========================================================================= */

#sr-cookie-banner,
#sr-cookie-preferences,
#sr-cookie-fab {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  box-sizing: border-box;
}

#sr-cookie-banner *,
#sr-cookie-preferences * {
  box-sizing: border-box;
}

/* ---------- Banner principale (in basso) ---------- */
#sr-cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  padding: 20px 24px;
  display: none;
  animation: srSlideUp .35s ease-out;
}
#sr-cookie-banner.sr-visible { display: block; }

@keyframes srSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.sr-banner-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.sr-banner-text {
  flex: 1 1 60%;
  min-width: 280px;
  font-size: 14px;
  line-height: 1.5;
  color: #374151;
}
.sr-banner-text strong { color: #111827; }
.sr-banner-text a {
  color: #019939;
  text-decoration: underline;
}

.sr-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

/* ---------- Pulsanti ---------- */
.sr-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.sr-btn:focus-visible {
  outline: 3px solid rgba(1, 153, 57, .35);
  outline-offset: 2px;
}

.sr-btn-primary {
  background: #019939;
  color: #ffffff;
}
.sr-btn-primary:hover { background: #017a2e; }

.sr-btn-secondary {
  background: #ffffff;
  color: #374151;
  border-color: #d1d5db;
}
.sr-btn-secondary:hover { background: #f9fafb; border-color: #9ca3af; }

.sr-btn-link {
  background: transparent;
  color: #019939;
  text-decoration: underline;
  padding: 10px 12px;
}
.sr-btn-link:hover { color: #017a2e; }

/* ---------- Modale preferenze ---------- */
#sr-cookie-preferences {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, .5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: srFadeIn .2s ease-out;
}
#sr-cookie-preferences.sr-visible { display: flex; }

@keyframes srFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sr-prefs-card {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

.sr-prefs-header {
  padding: 24px 28px 12px;
  border-bottom: 1px solid #f3f4f6;
}
.sr-prefs-header h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
  color: #111827;
}
.sr-prefs-header p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.5;
}

.sr-prefs-body {
  padding: 16px 28px;
}

.sr-pref-item {
  padding: 16px 0;
  border-bottom: 1px solid #f3f4f6;
}
.sr-pref-item:last-child { border-bottom: 0; }

.sr-pref-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.sr-pref-row h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}
.sr-pref-desc {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  margin: 0;
}

/* Toggle switch */
.sr-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.sr-toggle input { opacity: 0; width: 0; height: 0; }
.sr-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: .2s;
}
.sr-toggle-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.sr-toggle input:checked + .sr-toggle-slider { background: #019939; }
.sr-toggle input:checked + .sr-toggle-slider::before { transform: translateX(20px); }
.sr-toggle input:disabled + .sr-toggle-slider { background: #019939; opacity: .6; cursor: not-allowed; }
.sr-toggle-locked {
  font-size: 12px;
  color: #019939;
  font-weight: 600;
  flex-shrink: 0;
}

.sr-prefs-footer {
  padding: 20px 28px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

/* ---------- Pulsante fluttuante (riapri preferenze) ---------- */
#sr-cookie-fab {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 9998;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #019939;
  color: #fff;
  border: 0;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .15);
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
#sr-cookie-fab.sr-visible {
  display: flex;
}
#sr-cookie-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .2);
}
#sr-cookie-fab svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .sr-banner-inner { flex-direction: column; align-items: stretch; }
  .sr-banner-actions { width: 100%; flex-direction: column; }
  .sr-btn { width: 100%; }
  .sr-prefs-footer { flex-direction: column; }
  .sr-prefs-footer .sr-btn { width: 100%; }
}
