/**
 * Casa Stella Cookie Banner
 * Desktop: barra inferiore | Mobile: stack | Colori: bianco + #0B6354
 */

:root {
  --cs-cookie-green: #0B6354;
  --cs-cookie-green-hover: #094f43;
  --cs-cookie-text: #1a1a1a;
  --cs-cookie-muted: #555;
  --cs-cookie-border: #d8d8d8;
  --cs-cookie-bg: #ffffff;
  --cs-cookie-radius: 6px;
}

#casa-stella-cookie-root {
  position: relative;
  z-index: 999999;
}

.cs-cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  background: var(--cs-cookie-bg);
  border-top: 1px solid var(--cs-cookie-border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  font-family: "Sarabun", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--cs-cookie-text);
  -webkit-font-smoothing: antialiased;
}

.cs-cookie-banner[hidden],
.cs-cookie-modal[hidden] {
  display: none !important;
}

.cs-cookie-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.cs-cookie-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.cs-cookie-title {
  margin: 0 0 6px;
  font-family: "Forum", Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--cs-cookie-text);
}

.cs-cookie-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cs-cookie-muted);
}

.cs-cookie-text a {
  color: var(--cs-cookie-green);
  text-decoration: underline;
}

.cs-cookie-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cs-cookie-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: var(--cs-cookie-radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.cs-cookie-btn:focus-visible {
  outline: 2px solid var(--cs-cookie-green);
  outline-offset: 2px;
}

.cs-cookie-btn--outline {
  background: #fff;
  border-color: #222;
  color: #222;
}

.cs-cookie-btn--outline:hover {
  background: #f5f5f5;
}

.cs-cookie-btn--primary {
  background: var(--cs-cookie-green);
  border-color: var(--cs-cookie-green);
  color: #fff;
}

.cs-cookie-btn--primary:hover {
  background: var(--cs-cookie-green-hover);
  border-color: var(--cs-cookie-green-hover);
}

.cs-cookie-powered {
  margin: 0;
  padding: 0 24px 10px;
  text-align: right;
  font-size: 11px;
  color: #999;
}

/* Modal personalizza */
.cs-cookie-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  background: rgba(0, 0, 0, 0.45);
}

.cs-cookie-modal {
  position: fixed;
  z-index: 1000001;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  padding: 24px;
  font-family: "Sarabun", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.cs-cookie-modal-title {
  margin: 0 0 8px;
  font-family: "Forum", Georgia, serif;
  font-size: 22px;
  font-weight: 400;
}

.cs-cookie-modal-intro {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cs-cookie-muted);
}

.cs-cookie-cat {
  border: 1px solid var(--cs-cookie-border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.cs-cookie-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cs-cookie-cat-label {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--cs-cookie-text);
}

.cs-cookie-cat-desc {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--cs-cookie-muted);
}

.cs-cookie-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.cs-cookie-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cs-cookie-switch-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cs-cookie-switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.cs-cookie-switch input:checked + .cs-cookie-switch-slider {
  background: var(--cs-cookie-green);
}

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

.cs-cookie-switch input:disabled + .cs-cookie-switch-slider {
  opacity: 0.7;
  cursor: not-allowed;
}

.cs-cookie-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.cs-cookie-modal-actions .cs-cookie-btn {
  flex: 1 1 auto;
}

/* Mobile — layout come CookieYes mobile */
@media (max-width: 768px) {
  .cs-cookie-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 20px 16px 12px;
    gap: 16px;
  }

  .cs-cookie-title {
    font-size: 18px;
  }

  .cs-cookie-text {
    font-size: 13px;
  }

  .cs-cookie-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .cs-cookie-btn {
    width: 100%;
    min-height: 46px;
    border-radius: 8px;
  }

  /* Ordine mobile: Accetta → Personalizza → Rifiuta */
  .cs-cookie-actions .cs-cookie-btn--accept {
    order: 1;
  }

  .cs-cookie-actions .cs-cookie-btn--customize {
    order: 2;
  }

  .cs-cookie-actions .cs-cookie-btn--reject {
    order: 3;
  }

  .cs-cookie-powered {
    text-align: center;
    padding: 0 16px 12px;
  }

  .cs-cookie-modal {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-height: 85vh;
    border-radius: 14px 14px 0 0;
    padding: 20px 16px 24px;
  }

  .cs-cookie-modal-actions {
    flex-direction: column;
  }
}
