/* ============================================================
   VENVITY — Customer Privacy / Consent UI
   ============================================================
   Elegant, calm, editorial styling for the first-layer consent
   banner and the preferences panel. Brand palette only:
     cream   #F4F1EC
     charcoal #2F3437
     sage    #6F8F86
     border  #D8CFC4
   ============================================================ */

#vny-privacy-root {
  /* Isolate stacking without affecting the rest of the page layout */
  position: relative;
  z-index: 9999;
}

/* Defensive, explicit hiding — the banner/overlay/panel must never
   flash visible while the Shopify Customer Privacy API is still
   loading. JS only ever removes the [hidden] attribute after the
   API is ready AND the show/hide decision has been made. */
#vny-consent-banner[hidden],
#vny-consent-overlay[hidden],
#vny-consent-panel[hidden] {
  display: none !important;
}

.vny-btn {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.vny-btn:disabled { opacity: 0.6; cursor: default; }

.vny-btn--primary {
  background: #2F3437;
  color: #F4F1EC;
  border-color: #2F3437;
}
.vny-btn--primary:hover:not(:disabled) { background: #23262a; }

.vny-btn--outline {
  background: transparent;
  color: #2F3437;
  border-color: #2F3437;
}
.vny-btn--outline:hover:not(:disabled) { background: rgba(47, 52, 55, 0.06); }

.vny-btn--ghost {
  background: transparent;
  color: #6F8F86;
  border-color: #D8CFC4;
}
.vny-btn--ghost:hover:not(:disabled) { background: rgba(111, 143, 134, 0.08); }

.vny-btn:focus-visible,
.vny-panel-close:focus-visible,
.vny-consent-toggle input:focus-visible + .vny-consent-toggle__track {
  outline: 2px solid #6F8F86;
  outline-offset: 2px;
}

.vny-consent-link {
  color: #6F8F86;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.vny-consent-link:hover { color: #2F3437; }

/* ----------------------------------------------------------
   First-layer banner
---------------------------------------------------------- */
.vny-consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #F4F1EC;
  border-top: 1px solid #D8CFC4;
  box-shadow: 0 -4px 24px rgba(47, 52, 55, 0.08);
  padding: 1rem 1.25rem;
}

.vny-consent-banner__inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.vny-consent-banner__text {
  flex: 1 1 480px;
  min-width: 260px;
}

.vny-consent-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 500;
  color: #2F3437;
  margin: 0 0 0.35rem 0;
}

.vny-consent-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #2F3437;
  margin: 0;
  max-width: 640px;
}

.vny-consent-banner__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   Preferences panel + overlay
---------------------------------------------------------- */
.vny-consent-overlay {
  position: fixed;
  inset: 0;
  background: rgba(47, 52, 55, 0.35);
  z-index: 9998;
}

.vny-consent-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 2rem));
  max-height: min(640px, calc(100vh - 2rem));
  overflow-y: auto;
  background: #F4F1EC;
  border: 1px solid #D8CFC4;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(47, 52, 55, 0.18);
  z-index: 9999;
}

.vny-consent-panel__inner { padding: 1.5rem 1.5rem 1.25rem; }

.vny-consent-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.vny-panel-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 500;
  color: #2F3437;
  margin: 0;
}

.vny-panel-close {
  background: transparent;
  border: none;
  color: #2F3437;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
}
.vny-panel-close:hover { background: rgba(47, 52, 55, 0.06); }

.vny-consent-category {
  border-top: 1px solid #D8CFC4;
  padding: 0.9rem 0;
}

.vny-consent-category__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.vny-consent-category__name {
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: #2F3437;
}

.vny-consent-category__desc {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #565b5e;
  margin: 0.35rem 0 0 2.85rem;
}

.vny-consent-message {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: #6F8F86;
  margin: 0.75rem 0 0;
}
.vny-consent-message--error { color: #a3453a; }

.vny-consent-panel__actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid #D8CFC4;
}

/* ----------------------------------------------------------
   Toggle switch (accessible checkbox styled as a switch)
---------------------------------------------------------- */
.vny-consent-toggle {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}
.vny-consent-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.vny-consent-toggle__track {
  position: absolute;
  inset: 0;
  background: #D8CFC4;
  border-radius: 999px;
  transition: background-color 0.15s ease;
}
.vny-consent-toggle__track::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #F4F1EC;
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(47, 52, 55, 0.25);
}
.vny-consent-toggle input:checked + .vny-consent-toggle__track {
  background: #6F8F86;
}
.vny-consent-toggle input:checked + .vny-consent-toggle__track::before {
  transform: translateX(18px);
}
.vny-consent-toggle--locked { cursor: default; }
.vny-consent-toggle--locked input { cursor: default; }
.vny-consent-toggle--locked .vny-consent-toggle__track { background: #6F8F86; opacity: 0.55; }

/* ----------------------------------------------------------
   Responsive — mobile
---------------------------------------------------------- */
@media (max-width: 767px) {
  .vny-consent-banner {
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }
  .vny-consent-banner__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  .vny-consent-banner__actions {
    justify-content: stretch;
  }
  .vny-consent-banner__actions .vny-btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 0.75rem 0.9rem;
  }
  .vny-consent-panel {
    width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 1.5rem);
  }
  .vny-consent-panel__actions {
    flex-direction: column;
  }
  .vny-consent-panel__actions .vny-btn {
    width: 100%;
    text-align: center;
  }
}
