#hd-cookie-consent-root,
#hd-cookie-consent-root *,
#hd-cookie-consent-root *::before,
#hd-cookie-consent-root *::after {
  box-sizing: border-box;
}

#hd-cookie-consent-root {
  font-family: var(--hd-font-body);
  color: var(--hd-color-text-body);
  -webkit-font-smoothing: antialiased;
}

#hd-cookie-consent-root [hidden] {
  display: none !important;
}

.hd-cc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 43, 31, 0.45);
  backdrop-filter: blur(2px);
  z-index: 999998;
  opacity: 0;
  animation: hdCcFadeIn 0.25s ease forwards;
}

@keyframes hdCcFadeIn {
  to { opacity: 1; }
}

/* ==========================================================================
   Initial banner
   ========================================================================== */
.hd-cc-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  padding: 20px;
  animation: hdCcSlideUp var(--hd-transition-slow) forwards;
}

@keyframes hdCcSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.hd-cc-banner__inner {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--hd-color-surface);
  border: 1px solid var(--hd-color-border);
  border-radius: var(--hd-radius-lg);
  box-shadow: var(--hd-shadow-lg);
  padding: 28px 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
}

.hd-cc-banner__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--hd-radius-md);
  background: var(--hd-color-accent-pale);
  color: var(--hd-color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hd-cc-banner__title {
  font-family: var(--hd-font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--hd-color-text-main);
  margin: 0 0 6px;
  line-height: 1.3;
}

.hd-cc-banner__desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--hd-color-text-body);
  margin: 0;
}

.hd-cc-banner__desc a {
  color: var(--hd-color-primary-light);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.hd-cc-banner__desc a:hover {
  color: var(--hd-color-accent);
}

.hd-cc-banner__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.hd-cc-btn {
  font-family: var(--hd-font-body);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--hd-radius-pill);
  padding: 12px 22px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: var(--hd-transition);
  white-space: nowrap;
  line-height: 1;
}

.hd-cc-btn:focus-visible {
  outline: 2px solid var(--hd-color-accent);
  outline-offset: 2px;
}

.hd-cc-btn--primary {
  background: var(--hd-color-primary);
  color: var(--hd-color-white);
  border-color: var(--hd-color-primary);
}

.hd-cc-btn--primary:hover {
  background: var(--hd-color-primary-mid);
  border-color: var(--hd-color-primary-mid);
}

/* Reject All is intentionally equal visual weight to Accept All —
   required by EDPB guidance / multiple DPA enforcement decisions
   (a "dark pattern" grey Reject button next to a bold Accept button
   is a common violation this design deliberately avoids). */
.hd-cc-btn--outline {
  background: transparent;
  color: var(--hd-color-primary);
  border-color: var(--hd-color-border-strong);
}

.hd-cc-btn--outline:hover {
  border-color: var(--hd-color-primary);
  background: var(--hd-color-bg-alt);
}

.hd-cc-btn--ghost {
  background: transparent;
  color: var(--hd-color-text-muted);
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 12px 8px;
}

.hd-cc-btn--ghost:hover {
  color: var(--hd-color-primary);
}

/* ==========================================================================
   Preferences modal
   ========================================================================== */
.hd-cc-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hd-cc-modal__panel {
  background: var(--hd-color-surface);
  border-radius: var(--hd-radius-lg);
  box-shadow: var(--hd-shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: min(720px, 88vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: hdCcModalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes hdCcModalIn {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.hd-cc-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--hd-color-border);
  flex-shrink: 0;
}

.hd-cc-modal__title {
  font-family: var(--hd-font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--hd-color-text-main);
  margin: 0;
}

.hd-cc-modal__close {
  background: transparent;
  border: none;
  color: var(--hd-color-text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--hd-radius-sm);
  transition: var(--hd-transition);
  flex-shrink: 0;
}

.hd-cc-modal__close:hover {
  background: var(--hd-color-bg-alt);
  color: var(--hd-color-text-main);
}

.hd-cc-modal__body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.hd-cc-modal__intro {
  font-size: 14px;
  line-height: 1.65;
  color: var(--hd-color-text-body);
  margin: 0 0 22px;
}

.hd-cc-modal__intro a {
  color: var(--hd-color-primary-light);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hd-cc-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 28px;
  border-top: 1px solid var(--hd-color-border);
  flex-shrink: 0;
  background: var(--hd-color-bg);
}

/* ==========================================================================
   Category accordion
   ========================================================================== */
.hd-cc-categories {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hd-cc-category {
  border: 1px solid var(--hd-color-border);
  border-radius: var(--hd-radius-md);
  overflow: hidden;
  background: var(--hd-color-bg);
}

.hd-cc-category__header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--hd-font-body);
}

.hd-cc-category__header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hd-cc-chevron {
  color: var(--hd-color-text-muted);
  transition: transform var(--hd-transition);
  flex-shrink: 0;
}

.hd-cc-category[data-open="true"] .hd-cc-chevron {
  transform: rotate(90deg);
}

.hd-cc-category__label {
  font-size: 15px;
  font-weight: 600;
  color: var(--hd-color-text-main);
}

.hd-cc-badge-locked {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hd-color-success);
  background: var(--hd-color-accent-pale);
  padding: 5px 10px;
  border-radius: var(--hd-radius-pill);
  flex-shrink: 0;
}

.hd-cc-category__panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--hd-transition-slow), padding var(--hd-transition);
  padding: 0 18px;
}

.hd-cc-category[data-open="true"] .hd-cc-category__panel {
  max-height: 600px;
  padding: 0 18px 18px;
}

.hd-cc-category__desc {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--hd-color-text-muted);
  margin: 0 0 14px;
}

/* Cookie detail table */
.hd-cc-cookie-table-wrap {
  overflow-x: auto;
  border-radius: var(--hd-radius-sm);
  border: 1px solid var(--hd-color-border);
}

.hd-cc-cookie-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: var(--hd-color-surface);
}

.hd-cc-cookie-table th {
  text-align: left;
  font-weight: 700;
  color: var(--hd-color-text-main);
  background: var(--hd-color-bg-alt);
  padding: 9px 12px;
  white-space: nowrap;
  border-bottom: 1px solid var(--hd-color-border);
}

.hd-cc-cookie-table td {
  padding: 10px 12px;
  color: var(--hd-color-text-body);
  border-bottom: 1px solid var(--hd-color-border);
  vertical-align: top;
}

.hd-cc-cookie-table tr:last-child td {
  border-bottom: none;
}

.hd-cc-cookie-table code {
  font-size: 11.5px;
  background: var(--hd-color-highlight);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--hd-color-primary-mid);
}

/* ==========================================================================
   Toggle switch
   ========================================================================== */
.hd-cc-switch {
  position: relative;
  flex-shrink: 0;
}

.hd-cc-switch__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.hd-cc-switch__track {
  display: block;
  width: 42px;
  height: 24px;
  background: var(--hd-color-border-strong);
  border-radius: var(--hd-radius-pill);
  cursor: pointer;
  transition: var(--hd-transition);
  position: relative;
}

.hd-cc-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--hd-color-white);
  border-radius: 50%;
  transition: var(--hd-transition);
  box-shadow: var(--hd-shadow-sm);
}

.hd-cc-switch__input:checked + .hd-cc-switch__track {
  background: var(--hd-color-primary-light);
}

.hd-cc-switch__input:checked + .hd-cc-switch__track .hd-cc-switch__thumb {
  transform: translateX(18px);
}

.hd-cc-switch__input:focus-visible + .hd-cc-switch__track {
  outline: 2px solid var(--hd-color-accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Footer "Cookie Settings" reopen link
   ========================================================================== */
.hd-cc-reopen-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--hd-font-body);
  font-size: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  opacity: 0.85;
  transition: var(--hd-transition);
}

.hd-cc-reopen-link:hover {
  opacity: 1;
  color: var(--hd-color-accent-light);
}

/* Static cookie table (used on Privacy Policy page via shortcode) */
.hd-cc-policy-table-wrap h3 {
  font-family: var(--hd-font-display);
  color: var(--hd-color-text-main);
  margin: 28px 0 8px;
}

.hd-cc-policy-table-wrap p {
  font-size: 14.5px;
  color: var(--hd-color-text-body);
  line-height: 1.7;
}

.hd-cc-cookie-table--static {
  margin: 12px 0 24px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .hd-cc-banner__inner {
    grid-template-columns: 1fr;
    padding: 24px;
    gap: 16px;
  }

  .hd-cc-banner__icon {
    display: none;
  }

  .hd-cc-banner__actions {
    justify-content: stretch;
  }

  .hd-cc-banner__actions .hd-cc-btn {
    flex: 1;
  }

  .hd-cc-banner__actions .hd-cc-btn--ghost {
    flex-basis: 100%;
    order: 3;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .hd-cc-banner {
    padding: 12px;
  }

  .hd-cc-banner__inner {
    padding: 20px 18px;
    border-radius: var(--hd-radius-md);
  }

  .hd-cc-modal {
    padding: 0;
    align-items: flex-end;
  }

  .hd-cc-modal__panel {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--hd-radius-lg) var(--hd-radius-lg) 0 0;
    animation: hdCcModalInMobile 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  @keyframes hdCcModalInMobile {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }

  .hd-cc-cookie-table th,
  .hd-cc-cookie-table td {
    font-size: 11.5px;
    padding: 8px;
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .hd-cc-banner,
  .hd-cc-modal__panel,
  .hd-cc-overlay {
    animation: none !important;
  }

  .hd-cc-category__panel,
  .hd-cc-switch__track,
  .hd-cc-switch__thumb,
  .hd-cc-chevron,
  .hd-cc-btn {
    transition: none !important;
  }
}
