/* ==========================================================================
   Cookie Consent — SHA Theme
   ========================================================================== */

/* --------------------------------------------------------------------------
   Banner — Compact Card (bottom-right, opt-in only)
   -------------------------------------------------------------------------- */

.sha-cookie-consent {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  z-index: 9998;
  background: #fafaf9;
  color: #31312c;
  max-width: 380px;
  width: calc(100% - 48px);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 300ms ease, transform 300ms ease;
}

.sha-cookie-consent[hidden] {
  display: block;
  visibility: hidden;
  pointer-events: none;
}

.sha-cookie-consent.is-visible {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.sha-cookie-consent.is-hidden {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Banner Inner
   -------------------------------------------------------------------------- */

.sha-cookie-consent__inner {
  padding: 24px;
}

/* --------------------------------------------------------------------------
   Banner Title
   -------------------------------------------------------------------------- */

.sha-cookie-consent__title {
  font-family: var(--wp--preset--font-family--sans, sans-serif);
  font-size: var(--font-size-md, 1rem);
  font-weight: 600;
  margin: 0 0 10px;
  color: #31312c;
}

/* --------------------------------------------------------------------------
   Banner Message
   -------------------------------------------------------------------------- */

.sha-cookie-consent__message {
  font-size: var(--font-size-xs, 0.778rem);
  line-height: 1.6;
  color: #777;
  margin: 0 0 20px;
}

.sha-cookie-consent__link--policy {
  color: #31312c;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 180ms ease;
}

.sha-cookie-consent__link--policy:hover {
  color: #000;
}

/* --------------------------------------------------------------------------
   Banner Actions
   -------------------------------------------------------------------------- */

.sha-cookie-consent__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* --------------------------------------------------------------------------
   Buttons (shared)
   -------------------------------------------------------------------------- */

.sha-cookie-consent__btn {
  padding: 8px 18px;
  font-family: var(--wp--preset--font-family--sans, sans-serif);
  font-size: var(--font-size-xs, 0.778rem);
  font-weight: 500;
  letter-spacing: 0.84px;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
  line-height: 1;
  white-space: nowrap;
}

/* Accept — prominent */
.sha-cookie-consent__btn--accept {
  background: #31312c;
  color: #fafaf9;
  border: 1px solid #31312c;
}

.sha-cookie-consent__btn--accept:hover {
  background: #000;
  border-color: #000;
}

/* Reject — subtle */
.sha-cookie-consent__btn--reject {
  background: transparent;
  color: #31312c;
  border: 1px solid rgba(49, 49, 44, 0.25);
}

.sha-cookie-consent__btn--reject:hover {
  border-color: rgba(49, 49, 44, 0.6);
}

/* Save */
.sha-cookie-consent__btn--save {
  background: #31312c;
  color: #fafaf9;
  border: 1px solid #31312c;
}

.sha-cookie-consent__btn--save:hover {
  background: #000;
  border-color: #000;
}

/* --------------------------------------------------------------------------
   Customize Link
   -------------------------------------------------------------------------- */

.sha-cookie-consent__link--manage {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  color: #31312c;
  font-family: var(--wp--preset--font-family--sans, sans-serif);
  font-size: var(--font-size-xs, 0.778rem);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 180ms ease;
}

.sha-cookie-consent__link--manage:hover {
  color: #000;
}

/* --------------------------------------------------------------------------
   Floating Cookie Preferences — Drawer Style
   -------------------------------------------------------------------------- */

.sha-cookie-consent-float {
  position: fixed;
  bottom: 80px;
  right: 0;
  z-index: 9997;
}

.sha-cookie-consent-float[hidden] {
  display: none;
}

.sha-cookie-consent-float__btn {
  appearance: none;
  background: #31312c;
  border: none;
  border-radius: 4px 0 0 4px;
  color: #fafaf9;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--wp--preset--font-family--sans, sans-serif);
  font-size: var(--font-size-xs, 0.778rem);
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 10px 6px;
  white-space: nowrap;
  transform: translateX(calc(100% - 22px));
  transition: transform 300ms ease, background-color 180ms ease, padding 300ms ease;
}

.sha-cookie-consent-float__btn:hover,
.sha-cookie-consent-float__btn:focus-visible {
  transform: translateX(0);
  padding: 10px 12px;
  background: #444440;
}

.sha-cookie-consent-float__icon {
  flex-shrink: 0;
}

.sha-cookie-consent-float__label {
  opacity: 0;
  transition: opacity 200ms ease 80ms;
}

.sha-cookie-consent-float__btn:hover .sha-cookie-consent-float__label,
.sha-cookie-consent-float__btn:focus-visible .sha-cookie-consent-float__label {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Preferences Panel (Overlay)
   -------------------------------------------------------------------------- */

.sha-cookie-consent-prefs {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(49, 49, 44, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
}

.sha-cookie-consent-prefs.is-visible {
  opacity: 1;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   Preferences Inner
   -------------------------------------------------------------------------- */

.sha-cookie-consent-prefs__inner {
  position: relative;
  background: #fafaf9;
  color: #31312c;
  max-width: 480px;
  width: calc(100% - 48px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* --------------------------------------------------------------------------
   Preferences Close Button
   -------------------------------------------------------------------------- */

.sha-cookie-consent-prefs__close {
  position: absolute;
  top: 12px;
  right: 12px;
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: #bab7b8;
  cursor: pointer;
  transition: color 180ms ease;
}

.sha-cookie-consent-prefs__close:hover {
  color: #31312c;
}

/* --------------------------------------------------------------------------
   Preferences Heading
   -------------------------------------------------------------------------- */

.sha-cookie-consent-prefs__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.sha-cookie-consent-prefs__desc {
  font-size: var(--font-size-sm, 0.889rem);
  color: #777;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Category Row
   -------------------------------------------------------------------------- */

.sha-cookie-consent-category {
  padding: 16px 0;
  border-bottom: 1px solid rgba(217, 217, 217, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.sha-cookie-consent-category:last-child {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   Category Info
   -------------------------------------------------------------------------- */

.sha-cookie-consent-category__info {
  flex: 1;
}

.sha-cookie-consent-category__name {
  font-size: var(--font-size-sm, 0.889rem);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.84px;
}

.sha-cookie-consent-category__desc {
  font-size: var(--font-size-xs, 0.778rem);
  color: #777;
  margin-top: 4px;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Toggle Switch
   -------------------------------------------------------------------------- */

.sha-cookie-consent-toggle {
  display: inline-flex;
  cursor: pointer;
  flex-shrink: 0;
}

.sha-cookie-consent-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sha-cookie-consent-toggle__track {
  width: 40px;
  height: 22px;
  background: #bab7b8;
  border-radius: 11px;
  position: relative;
  transition: background-color 200ms ease;
}

.sha-cookie-consent-toggle__thumb {
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 200ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Checked */
input:checked + .sha-cookie-consent-toggle__track {
  background: #31312c;
}

input:checked + .sha-cookie-consent-toggle__track .sha-cookie-consent-toggle__thumb {
  transform: translateX(18px);
}

/* Disabled */
input:disabled + .sha-cookie-consent-toggle__track {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Preferences Footer
   -------------------------------------------------------------------------- */

.sha-cookie-consent-prefs__footer {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Responsive (< 48rem)
   -------------------------------------------------------------------------- */

@media (max-width: 48rem) {
  .sha-cookie-consent {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }

  .sha-cookie-consent__inner {
    padding: 20px;
  }

  .sha-cookie-consent__actions {
    flex-wrap: wrap;
  }

  .sha-cookie-consent__btn {
    flex: 1;
    text-align: center;
  }

  .sha-cookie-consent__btn--save {
    width: 100%;
  }

  .sha-cookie-consent-float {
    bottom: 80px;
    right: 0;
  }

  .sha-cookie-consent-prefs__footer {
    justify-content: stretch;
  }

  .sha-cookie-consent-prefs__footer .sha-cookie-consent__btn {
    flex: 1;
    text-align: center;
  }
}

/* --------------------------------------------------------------------------
   Shortcode: Consent Status
   -------------------------------------------------------------------------- */

.sha-cookie-consent-status {
  margin: 32px 0;
}

.sha-cookie-consent-status__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.sha-cookie-consent-status__desc {
  color: #777;
  font-size: var(--font-size-sm, 0.889rem);
  margin-bottom: 20px;
}

.sha-cookie-consent-status__table {
  width: 100%;
  max-width: 400px;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.sha-cookie-consent-status__table th,
.sha-cookie-consent-status__table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(217, 217, 217, 0.3);
  font-size: var(--font-size-sm, 0.889rem);
}

.sha-cookie-consent-status__table th {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.84px;
  font-size: var(--font-size-xs, 0.778rem);
  color: #777;
}

.sha-cookie-consent-status__badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: var(--font-size-xs, 0.778rem);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 500;
}

.sha-cookie-consent-status__badge--active {
  color: #166534;
  background: rgba(22, 101, 52, 0.08);
}

.sha-cookie-consent-status__badge--rejected {
  color: #991b1b;
  background: rgba(153, 27, 27, 0.08);
}

.sha-cookie-consent-status__meta {
  color: #999;
  margin-top: 12px;
}

.sha-cookie-consent-status__meta code {
  font-size: var(--font-size-xs, 0.778rem);
  color: #777;
}
