/* ===================================================
   Cookie Consent Banner — Midi Coder
   Reusable widget for all Hemidi landing pages.
   No rounded corners (Carbon Design System compliance).
   Supports dark/light theme via CSS custom properties.
   =================================================== */

/* ---- Overlay ---- */
.cookie-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 2099;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cookie-consent-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Banner ---- */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2100;
  padding: 0;
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.3s ease;
  pointer-events: none;
}

.cookie-consent.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.cookie-consent__inner {
  max-width: min(calc(100% - 2rem), 75rem);
  margin: 0 auto 1rem;
  padding: 1.5rem 2rem;
  background: var(--panel-bg, #111118);
  border: 1px solid var(--panel-border, rgba(255, 255, 255, 0.06));
  box-shadow:
    0 -8px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ---- Main layout ---- */
.cookie-consent__main {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}

.cookie-consent__body {
  flex: 1;
  min-width: 0;
}

.cookie-consent__icon {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--brand-color-rgb, 252, 103, 103), 0.1);
  border: 1px solid rgba(var(--brand-color-rgb, 252, 103, 103), 0.18);
  color: var(--brand-color, #fc6767);
}

.cookie-consent__icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.cookie-consent__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #f0f0f5);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.cookie-consent__desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-secondary, #8e8ea0);
}

.cookie-consent__desc a {
  color: var(--brand-color, #fc6767);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.cookie-consent__desc a:hover {
  color: var(--brand-color-deep, #e90089);
}

/* ---- Action buttons ---- */
.cookie-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.cookie-consent__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
}

.cookie-consent__btn--accept {
  background: var(--accent-gradient, linear-gradient(135deg, #fc6767, #e90089));
  color: #fff;
  box-shadow: 0 4px 16px rgba(var(--brand-color-rgb, 252, 103, 103), 0.25);
}

.cookie-consent__btn--accept:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(var(--brand-color-rgb, 252, 103, 103), 0.35);
  filter: brightness(1.06);
}

.cookie-consent__btn--reject {
  background: transparent;
  border: 1px solid var(--panel-border-hover, rgba(255, 255, 255, 0.12));
  color: var(--text-primary, #f0f0f5);
}

.cookie-consent__btn--reject:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--text-muted, #555568);
}

.cookie-consent__btn--customize {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary, #8e8ea0);
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.cookie-consent__btn--customize:hover {
  color: var(--text-primary, #f0f0f5);
  border-color: var(--panel-border-hover, rgba(255, 255, 255, 0.12));
}

/* ---- Customize panel ---- */
.cookie-consent__customize {
  display: none;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--panel-border, rgba(255, 255, 255, 0.06));
}

.cookie-consent__customize.is-open {
  display: block;
}

.cookie-consent__group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cookie-consent__group:last-child {
  border-bottom: none;
}

.cookie-consent__group-info {
  flex: 1;
  min-width: 0;
  padding-right: 1rem;
}

.cookie-consent__group-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #f0f0f5);
  margin: 0 0 0.15rem;
}

.cookie-consent__group-desc {
  font-size: 0.78rem;
  color: var(--text-muted, #555568);
  margin: 0;
  line-height: 1.5;
}

/* ---- Toggle switch ---- */
.cookie-consent__toggle {
  position: relative;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 1.375rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.cookie-consent__toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-consent__toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  background: var(--text-secondary, #8e8ea0);
  transition: transform 0.2s ease, background 0.2s ease;
}

.cookie-consent__toggle input:checked ~ .cookie-consent__toggle-knob {
  transform: translateX(1.375rem);
  background: var(--brand-color, #fc6767);
}

.cookie-consent__toggle:has(input:checked) {
  background: rgba(var(--brand-color-rgb, 252, 103, 103), 0.15);
  border-color: rgba(var(--brand-color-rgb, 252, 103, 103), 0.3);
}

.cookie-consent__toggle--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cookie-consent__toggle--disabled input {
  cursor: not-allowed;
}

/* ---- Save preferences button ---- */
.cookie-consent__save-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--panel-border, rgba(255, 255, 255, 0.06));
}

/* ---- Warning toast ---- */
.cookie-consent-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(2rem);
  z-index: 2101;
  padding: 0.75rem 1.5rem;
  background: var(--panel-bg, #111118);
  border: 1px solid rgba(255, 180, 0, 0.3);
  color: var(--text-primary, #f0f0f5);
  font-size: 0.84rem;
  line-height: 1.5;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-consent-toast.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.cookie-consent-toast__icon {
  margin-right: 0.5rem;
}

/* ---- Footer settings link ---- */
.cookie-consent-settings-link {
  cursor: pointer;
  color: var(--text-secondary, #8e8ea0);
  transition: color 0.2s ease;
  text-decoration: none;
  font-size: inherit;
}

.cookie-consent-settings-link:hover {
  color: var(--text-primary, #f0f0f5);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .cookie-consent__inner {
    margin: 0;
    padding: 1.25rem 1rem;
  }

  .cookie-consent__main {
    flex-direction: column;
    gap: 0.75rem;
  }

  .cookie-consent__icon {
    display: none;
  }

  .cookie-consent__actions {
    flex-direction: column;
  }

  .cookie-consent__btn {
    width: 100%;
  }

  .cookie-consent__group {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .cookie-consent__group-info {
    padding-right: 0;
  }

  .cookie-consent-toast {
    left: 1rem;
    right: 1rem;
    transform: translateX(0) translateY(2rem);
    text-align: center;
  }

  .cookie-consent-toast.is-visible {
    transform: translateX(0) translateY(0);
  }
}
