/* ==========================================================================
   GDPR Banner — Frontend Styles
   Uses CSS custom properties set by PHP (--gdpr-*) so every project can
   be themed from the admin settings page without touching this file.
   ========================================================================== */

/* Defaults — overridden by the :root block injected via wp_add_inline_style */
:root {
  --gdpr-bg:           #ffffff;
  --gdpr-text:         #0a0a0a;
  --gdpr-accent:       #0a0a0a;
  --gdpr-accent-text:  #ffffff;
  --gdpr-secondary-bg: #f0f0f0;
  --gdpr-radius:       8px;
  --gdpr-shadow:       0 4px 24px rgba(0, 0, 0, .12);
  --gdpr-transition:   .2s ease;
  --gdpr-z:            99999;
}

/* --------------------------------------------------------------------------
   Visibility helpers
   -------------------------------------------------------------------------- */
.gdpr-banner--hidden,
.gdpr-overlay--hidden,
.gdpr-reopen-btn--hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Banner — shared inner layout
   -------------------------------------------------------------------------- */
.gdpr-banner {
  position: fixed;
  z-index: var(--gdpr-z);
  background: var(--gdpr-bg);
  color: var(--gdpr-text);
  box-shadow: var(--gdpr-shadow);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.gdpr-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.gdpr-banner__content {
  flex: 1 1 300px;
}

.gdpr-banner__title {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 15px;
}

.gdpr-banner__desc {
  margin: 0;
  opacity: .85;
}

.gdpr-banner__desc a {
  color: var(--gdpr-accent);
  text-underline-offset: 2px;
}

.gdpr-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* --------------------------------------------------------------------------
   Banner positions
   -------------------------------------------------------------------------- */
.gdpr-banner--bottom-bar {
  inset: auto 0 0;
  border-top: 1px solid rgba(0,0,0,.08);
  border-radius: var(--gdpr-radius) var(--gdpr-radius) 0 0;
}

.gdpr-banner--bottom-left {
  bottom: 24px;
  left: 24px;
  right: auto;
  max-width: 420px;
  border-radius: var(--gdpr-radius);
}

.gdpr-banner--modal {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 48px);
  max-width: 560px;
  border-radius: var(--gdpr-radius);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.gdpr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: var(--gdpr-radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background var(--gdpr-transition), color var(--gdpr-transition), border-color var(--gdpr-transition);
  white-space: nowrap;
  text-decoration: none;
}

.gdpr-btn--primary {
  background: var(--gdpr-accent);
  color: var(--gdpr-accent-text);
  border-color: var(--gdpr-accent);
}

.gdpr-btn--primary:hover,
.gdpr-btn--primary:focus-visible {
  filter: brightness(1.12);
  outline: 3px solid var(--gdpr-accent);
  outline-offset: 2px;
}

.gdpr-btn--secondary {
  background: var(--gdpr-secondary-bg);
  color: var(--gdpr-text);
  border-color: var(--gdpr-secondary-bg);
}

.gdpr-btn--secondary:hover,
.gdpr-btn--secondary:focus-visible {
  border-color: var(--gdpr-text);
  outline: none;
}

.gdpr-btn--ghost {
  background: transparent;
  color: var(--gdpr-text);
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding-left: 4px;
  padding-right: 4px;
}

.gdpr-btn--ghost:hover,
.gdpr-btn--ghost:focus-visible {
  color: var(--gdpr-accent);
}

/* --------------------------------------------------------------------------
   Preferences overlay + panel
   -------------------------------------------------------------------------- */
.gdpr-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--gdpr-z) + 1);
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gdpr-prefs {
  background: var(--gdpr-bg);
  color: var(--gdpr-text);
  border-radius: var(--gdpr-radius);
  box-shadow: var(--gdpr-shadow);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gdpr-prefs__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.gdpr-prefs__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.gdpr-prefs__close {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gdpr-text);
  padding: 4px;
  border-radius: 4px;
  transition: opacity var(--gdpr-transition);
}

.gdpr-prefs__close:hover { opacity: .6; }

.gdpr-prefs__body {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
}

.gdpr-prefs__category {
  padding: 14px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.gdpr-prefs__category:last-child { border-bottom: none; }

.gdpr-prefs__category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.gdpr-prefs__category-name {
  font-weight: 600;
  font-size: 14px;
}

.gdpr-prefs__category-desc {
  margin: 0;
  font-size: 13px;
  opacity: .75;
}

.gdpr-prefs__footer {
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(0,0,0,.08);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Toggle switch
   -------------------------------------------------------------------------- */
.gdpr-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--gdpr-text);
  flex-shrink: 0;
}

.gdpr-toggle__track {
  display: block;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: #ccc;
  position: relative;
  transition: background var(--gdpr-transition);
  flex-shrink: 0;
}

.gdpr-toggle__thumb {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform var(--gdpr-transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.gdpr-toggle[aria-checked="true"] .gdpr-toggle__track {
  background: var(--gdpr-accent);
}

.gdpr-toggle[aria-checked="true"] .gdpr-toggle__thumb {
  transform: translateX(20px);
}

.gdpr-toggle:focus-visible .gdpr-toggle__track {
  outline: 3px solid var(--gdpr-accent);
  outline-offset: 2px;
}

/* Locked (necessary) toggle */
.gdpr-toggle--locked .gdpr-toggle__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gdpr-accent);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* --------------------------------------------------------------------------
   Floating re-open button
   -------------------------------------------------------------------------- */
.gdpr-reopen-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: var(--gdpr-z);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gdpr-accent);
  color: var(--gdpr-accent-text);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
  transition: transform var(--gdpr-transition), box-shadow var(--gdpr-transition);
}

.gdpr-reopen-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

.gdpr-reopen-btn:focus-visible {
  outline: 3px solid var(--gdpr-accent);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .gdpr-banner__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .gdpr-banner--bottom-left {
    bottom: 0;
    left: 0;
    right: 0;
    max-width: none;
    border-radius: var(--gdpr-radius) var(--gdpr-radius) 0 0;
  }

  .gdpr-btn {
    width: 100%;
    justify-content: center;
  }

  .gdpr-banner__actions {
    width: 100%;
  }

  .gdpr-prefs {
    max-height: 85vh;
  }
}

/* --------------------------------------------------------------------------
   Cookie accordion & table
   -------------------------------------------------------------------------- */
.gdpr-accordion__trigger {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .5rem;
  background: none;
  border: none;
  padding: .25rem 0;
  font-size: .82rem;
  color: var(--gdpr-accent);
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gdpr-accordion__icon {
  transition: transform .2s;
  flex-shrink: 0;
}

.gdpr-accordion__trigger[aria-expanded="true"] .gdpr-accordion__icon {
  transform: rotate(180deg);
}

.gdpr-cookie-table {
  margin-top: .5rem;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 5px;
  font-size: .78rem;
  overflow: hidden;
  max-height: 180px;
  overflow-y: auto;
}

.gdpr-cookie-table__head,
.gdpr-cookie-table__row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 3fr;
  gap: 0;
}

.gdpr-cookie-table__head {
  background: rgba(0,0,0,.04);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.gdpr-cookie-table__head span,
.gdpr-cookie-table__row span {
  padding: .35rem .6rem;
  border-right: 1px solid rgba(0,0,0,.06);
  overflow: hidden;
  text-overflow: ellipsis;
}

.gdpr-cookie-table__head span:last-child,
.gdpr-cookie-table__row span:last-child {
  border-right: none;
}

.gdpr-cookie-table__row {
  border-top: 1px solid rgba(0,0,0,.06);
}

.gdpr-cookie-table__row code {
  font-size: .75rem;
  word-break: break-all;
}
