/* ============================================================================
   COOKIE CONSENT - Unifying Services
   ============================================================================
   Banner, preferences modal, and welcome-back chip.
   Visual tokens reuse the design system variables from base.css.
   ============================================================================ */

/* ---- Cookie banner --------------------------------------------------------*/
.us-cookie-banner {
  position: fixed;
  left: 50%;
  bottom: var(--spacing-16, 16px);
  transform: translateX(-50%);
  width: min(960px, calc(100% - 32px));
  background: #fff;
  color: #333;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  z-index: 10000;
  font-family: Arial, sans-serif;
  animation: us-cookie-slide-in 0.3s ease-out;
}

@keyframes us-cookie-slide-in {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.us-cookie-banner__body { flex: 1 1 320px; }

.us-cookie-banner__title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  color: #3D2142;
}

.us-cookie-banner__text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #555;
}

.us-cookie-banner__text a { color: #3D2142; text-decoration: underline; }

.us-cookie-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- Buttons --------------------------------------------------------------*/
.us-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.us-btn--primary {
  background: #3D2142;
  color: #FFCB08;
}
.us-btn--primary:hover { background: #2a1630; }

.us-btn--ghost {
  background: transparent;
  color: #3D2142;
  border-color: rgba(61, 33, 66, 0.3);
}
.us-btn--ghost:hover {
  background: rgba(61, 33, 66, 0.08);
  border-color: #3D2142;
}

.us-btn:focus-visible {
  outline: 2px solid #FFCB08;
  outline-offset: 2px;
}

/* ---- Modal ---------------------------------------------------------------*/
.us-cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: Arial, sans-serif;
}

.us-cookie-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 10, 25, 0.55);
  backdrop-filter: blur(2px);
}

.us-cookie-modal__panel {
  position: relative;
  background: #fff;
  color: #333;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: us-cookie-pop 0.2s ease-out;
}

@keyframes us-cookie-pop {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.us-cookie-modal__panel h2 {
  margin: 0 0 8px;
  color: #3D2142;
  font-size: 1.3rem;
}

.us-cookie-modal__intro {
  margin: 0 0 20px;
  font-size: 0.92rem;
  color: #555;
}

.us-cookie-modal__intro a { color: #3D2142; text-decoration: underline; }

.us-cookie-modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #888;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.us-cookie-modal__close:hover { background: rgba(0, 0, 0, 0.06); color: #333; }

.us-cookie-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ---- Category row with toggle --------------------------------------------*/
.us-cookie-cat {
  display: block;
  padding: 14px 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
}

.us-cookie-cat:hover { border-color: rgba(61, 33, 66, 0.3); }

.us-cookie-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.us-cookie-cat__name {
  font-weight: 600;
  color: #3D2142;
  font-size: 0.98rem;
}

.us-cookie-cat__desc {
  display: block;
  margin-top: 6px;
  font-size: 0.86rem;
  color: #666;
  line-height: 1.45;
}

/* Toggle switch */
.us-cookie-cat__toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.us-cookie-cat__toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.us-cookie-cat__switch {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  transition: background 0.2s ease;
}

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

.us-cookie-cat__toggle input:checked + .us-cookie-cat__switch { background: #3D2142; }
.us-cookie-cat__toggle input:checked + .us-cookie-cat__switch::before { transform: translateX(18px); }
.us-cookie-cat__toggle input:disabled + .us-cookie-cat__switch { opacity: 0.55; cursor: not-allowed; }
.us-cookie-cat__toggle input:focus-visible + .us-cookie-cat__switch {
  outline: 2px solid #FFCB08;
  outline-offset: 2px;
}

/* ---- Welcome-back chip ---------------------------------------------------*/
.us-welcome-back {
  position: fixed;
  top: calc(var(--header-height, 5rem) + 8px);
  right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  background: #3D2142;
  color: #FFCB08;
  border-radius: 999px;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 9990;
  max-width: calc(100% - 32px);
  animation: us-cookie-slide-in 0.3s ease-out;
}

.us-welcome-back__text { opacity: 0.9; }

.us-welcome-back__go {
  background: #FFCB08;
  color: #3D2142;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.us-welcome-back__go:hover { background: #ffd838; }

.us-welcome-back__close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  padding: 2px 6px;
}
.us-welcome-back__close:hover { opacity: 1; }

/* ---- Responsive ----------------------------------------------------------*/
@media (max-width: 640px) {
  .us-cookie-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 18px;
  }
  .us-cookie-banner__actions {
    justify-content: stretch;
  }
  .us-cookie-banner__actions .us-btn {
    flex: 1 1 auto;
    text-align: center;
  }
  .us-welcome-back {
    top: auto;
    bottom: 16px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

/* ---- Reduced motion ------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
  .us-cookie-banner,
  .us-welcome-back,
  .us-cookie-modal__panel {
    animation: none;
  }
  .us-cookie-cat__switch,
  .us-cookie-cat__switch::before,
  .us-btn {
    transition: none;
  }
}
