/* aacc-extras.css — Buttons, Switch, Overlay, Widget, Toggle, Policy, Focus, Responsive */

/* Buttons (shared across all containers) */
#aacc-bar .aacc-btn,
#aacc-modal .aacc-btn,
#aacc-details .aacc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

#aacc-bar .aacc-btn--primary,
#aacc-modal .aacc-btn--primary,
#aacc-details .aacc-btn--primary { background: #00b894; border-color: #00b894; color: #ffffff; }
#aacc-bar .aacc-btn--primary:hover,
#aacc-modal .aacc-btn--primary:hover,
#aacc-details .aacc-btn--primary:hover { background: #00a383; border-color: #00a383; }

#aacc-bar .aacc-btn--secondary,
#aacc-modal .aacc-btn--secondary { background: transparent; border-color: rgba(255,255,255,.4); color: #ffffff; }
#aacc-bar .aacc-btn--secondary:hover,
#aacc-modal .aacc-btn--secondary:hover { border-color: rgba(255,255,255,.7); background: rgba(255,255,255,.07); }

#aacc-bar .aacc-btn--outline,
#aacc-modal .aacc-btn--outline,
#aacc-details .aacc-btn--outline { background: transparent; border-color: #00b894; color: #00b894; }
#aacc-bar .aacc-btn--outline:hover,
#aacc-modal .aacc-btn--outline:hover,
#aacc-details .aacc-btn--outline:hover { background: rgba(0,184,148,.1); }

/* Links (dark context) */
#aacc-bar .aacc-link,
#aacc-bar .aacc-link-button,
#aacc-bar .aacc-ccpa-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: #7dd3fc;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  display: inline-flex;
  align-items: center;
  line-height: 1.4;
  font-weight: 500;
  white-space: nowrap;
}
#aacc-bar .aacc-link:hover,
#aacc-bar .aacc-link-button:hover,
#aacc-bar .aacc-ccpa-link:hover { text-decoration: none; }
#aacc-bar .aacc-ccpa-done { font-size: 12px; color: rgba(255,255,255,.6); }

/* Switch Toggle */
#aacc-bar .aacc-switch,
#aacc-modal .aacc-switch,
#aacc-details .aacc-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-width: 0;
  vertical-align: top;
  min-height: 24px;
  position: relative; /* required: input is position:absolute inside */
}

#aacc-bar .aacc-switch input,
#aacc-modal .aacc-switch input,
#aacc-details .aacc-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Slider dark context (bar + modal only — details uses light override in aacc-details.css) */
#aacc-bar .aacc-switch__slider,
#aacc-modal .aacc-switch__slider {
  flex: 0 0 40px;
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #555555;
  transition: background 0.2s ease;
  display: block;
}

/* Shared slider structure for details (no background — details.css sets it) */
#aacc-details .aacc-switch__slider {
  flex: 0 0 40px;
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  transition: background 0.2s ease;
  display: block;
}

#aacc-bar .aacc-switch__slider::before,
#aacc-modal .aacc-switch__slider::before,
#aacc-details .aacc-switch__slider::before { /* knob shared */
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

/* checked state: dark containers get green; details already handled in aacc-details.css */
#aacc-bar .aacc-switch input:checked + .aacc-switch__slider,
#aacc-modal .aacc-switch input:checked + .aacc-switch__slider { background: #00b894; }

#aacc-bar .aacc-switch input:checked + .aacc-switch__slider::before,
#aacc-modal .aacc-switch input:checked + .aacc-switch__slider::before,
#aacc-details .aacc-switch input:checked + .aacc-switch__slider::before { transform: translateX(18px); /* knob slide shared */ }

#aacc-bar .aacc-switch__label,
#aacc-modal .aacc-switch__label,
#aacc-details .aacc-switch__label {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

/* Overlay */
#aacc-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#aacc-overlay.aacc-overlay--active { opacity: 1; pointer-events: auto; }

/* Floating widget */
#aacc-widget.aacc-cw {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: var(--aacc-widget-z-index, 998);
  isolation: isolate;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  --aacc-widget-transform: none;
  transform: var(--aacc-widget-transform);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#aacc-widget.aacc-cw.aacc-cw--visible { opacity: .85; pointer-events: auto; }
#aacc-widget.aacc-cw:hover { opacity: 1; transform: var(--aacc-widget-transform) scale(1.05); }
#aacc-widget.aacc-cw--bottom-left { top: auto; right: auto; bottom: 20px; left: 20px; --aacc-widget-transform: none; border-radius: 999px; }
#aacc-widget.aacc-cw--bottom-right { top: auto; right: 20px; bottom: 20px; left: auto; --aacc-widget-transform: none; border-radius: 999px; }
#aacc-widget.aacc-cw--bottom-center { top: auto; right: auto; bottom: 20px; left: 50%; --aacc-widget-transform: translateX(-50%); border-radius: 999px; }
#aacc-widget.aacc-cw--top-left { top: 20px; right: auto; bottom: auto; left: 20px; --aacc-widget-transform: none; border-radius: 999px; }
#aacc-widget.aacc-cw--top-right { top: 20px; right: 20px; bottom: auto; left: auto; --aacc-widget-transform: none; border-radius: 999px; }
#aacc-widget.aacc-cw--top-center { top: 20px; right: auto; bottom: auto; left: 50%; --aacc-widget-transform: translateX(-50%); border-radius: 999px; }
#aacc-widget.aacc-cw--middle-right { top: 50%; right: 0; bottom: auto; left: auto; --aacc-widget-transform: translateY(-50%); border-radius: 8px 0 0 8px; }
#aacc-widget.aacc-cw--middle-left { top: 50%; right: auto; bottom: auto; left: 0; --aacc-widget-transform: translateY(-50%); border-radius: 0 8px 8px 0; }

/* Reopen button shortcode/button API output */
button.aacc-toggle:not(#aacc-toggle) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #00b894;
  border-radius: 999px;
  background: transparent;
  color: #00b894;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

button.aacc-toggle:not(#aacc-toggle):hover {
  background: rgba(0,184,148,.1);
}

#aacc-details .aacc-details__service-toggle {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
}

#aacc-details .aacc-details__service-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: #374151;
  cursor: pointer;
}

/* Toggle button — visibility managed entirely by JS (style.display='none' / JS-driven).
   CSS :focus is not applicable; display:none elements cannot receive focus. */
#aacc-toggle.aacc-toggle {
  position: fixed;
  bottom: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Privacy Policy Shortcode */
.aacc-policy { max-width: 100%; margin: 0 0 1.5em; font-size: 14px; line-height: 1.6; }
.aacc-policy__categories { margin: 0 0 1.5em; padding: 0; list-style: none; }
.aacc-policy__categories dt { font-weight: 700; margin: 1em 0 .25em; }
.aacc-policy__categories dt:first-child { margin-top: 0; }
.aacc-policy__categories dd { margin: 0 0 .5em; padding: 0 0 .5em; border-bottom: 1px solid rgba(0,0,0,.08); }
.aacc-policy__categories dd:last-of-type { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.aacc-policy--dse { margin-top: 1.5em; }

/* Cookie details shortcode page wrapper */
.aacc-details-page {
max-width: 100%;
margin: 0 0 1.5em;
font-size: 14px;
line-height: 1.6;
}

.aacc-details-page > h2,
.aacc-details-page > h3,
.aacc-policy > h2,
.aacc-policy > h3 {
margin: 0 0 .75em;
line-height: 1.3;
}

.aacc-details-page > p,
.aacc-policy > p {
margin: 0 0 1em;
}

.aacc-details-page .aacc-details__groups {
margin-top: 1rem;
}

.aacc-details-page .aacc-details__group {
border: 1px solid #e5e7eb;
border-radius: 8px;
margin: 0 0 10px;
overflow: hidden;
background: #ffffff;
}

.aacc-details-page .aacc-details__group-header {
width: 100%;
min-height: 48px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 14px;
border: 0;
background: #ffffff;
color: #111827;
font: inherit;
font-weight: 700;
text-align: left;
cursor: pointer;
}

.aacc-details-page .aacc-details__group-header:hover {
background: #f9fafb;
}

.aacc-details-page .aacc-details__group-title {
flex: 1 1 auto;
min-width: 0;
overflow-wrap: anywhere;
}

.aacc-details-page .aacc-details__group-indicator {
flex: 0 0 auto;
font-size: 18px;
font-weight: 700;
line-height: 1;
color: #6b7280;
}

.aacc-details-page .aacc-details__group-body {
display: none;
padding: 10px 14px 14px;
border-top: 1px solid #e5e7eb;
background: #f9fafb;
}

.aacc-details-page .aacc-details__group.aacc-details__group--open > .aacc-details__group-body {
display: block;
}

.aacc-details-page .aacc-details__cookie {
padding: 10px 0;
border-bottom: 1px solid #e5e7eb;
}

.aacc-details-page .aacc-details__cookie:last-child {
border-bottom: 0;
}

.aacc-details-page .aacc-details__cookie-name {
font-weight: 700;
color: #111827;
overflow-wrap: anywhere;
}

.aacc-details-page .aacc-details__cookie-meta {
margin-top: 6px;
font-size: 13px;
color: #4b5563;
}

.aacc-details-page .aacc-details__meta-row {
margin: 0 0 4px;
line-height: 1.45;
}

.aacc-details-page .aacc-details__meta-label {
font-weight: 700;
color: #374151;
}

.aacc-details-page .aacc-details__meta-value,
.aacc-details-page .aacc-link {
white-space: normal;
overflow-wrap: anywhere;
word-break: break-word;
}

/* Data request shortcode */
.aacc-data-request-wrap {
max-width: 520px;
margin: 0 0 1.5em;
font-size: 14px;
line-height: 1.5;
}

.aacc-data-request__label-row {
margin: 0 0 8px;
}

.aacc-data-request__label {
display: inline-block;
font-weight: 600;
}

.aacc-data-request__input {
width: 100%;
min-height: 42px;
padding: 10px 12px;
box-sizing: border-box;
border: 1px solid #d1d5db;
border-radius: 8px;
background: #fff;
color: #111827;
}

.aacc-data-request__actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 10px;
}

.aacc-data-request__button {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 42px;
padding: 9px 18px;
border: 1px solid transparent;
border-radius: 8px;
color: #fff;
font-weight: 600;
cursor: pointer;
}

.aacc-data-request__button--get {
background: #0073aa;
}

.aacc-data-request__button--delete {
background: #c0392b;
}

.aacc-data-request__button:hover {
opacity: .92;
}

.aacc-data-request__result {
margin-top: 14px;
}

.aacc-data-request__notice {
padding: 10px 12px;
border-radius: 8px;
border: 1px solid transparent;
}

.aacc-data-request__notice--success {
border-color: #2d8a4e;
background: #f4faf6;
color: #14532d;
}

.aacc-data-request__notice--error {
border-color: #c0392b;
background: #fdf4f4;
color: #7f1d1d;
}

.aacc-data-request__records {
margin: 8px 0 0;
padding-left: 16px;
}

.aacc-data-request__input:focus-visible,
.aacc-data-request__button:focus-visible {
outline: 2px solid #00b894;
outline-offset: 2px;
}

/* Focus / Accessibility */
#aacc-bar .aacc-btn:focus-visible,
#aacc-modal .aacc-btn:focus-visible,
#aacc-details .aacc-btn:focus-visible,
#aacc-bar .aacc-link:focus-visible,
#aacc-bar .aacc-link-button:focus-visible,
#aacc-modal .aacc-modal__close:focus-visible,
#aacc-details .aacc-details__back:focus-visible,
#aacc-details .aacc-details__toplink:focus-visible,
#aacc-details .aacc-details__tab:focus-visible,
#aacc-details .aacc-details__group-header:focus-visible,
#aacc-details .aacc-svc-category__header:focus-visible,
#aacc-details .aacc-svc-info-btn:focus-visible,
button.aacc-toggle:not(#aacc-toggle):focus-visible,
#aacc-widget:focus-visible,
#aacc-toggle:focus-visible {
  outline: 2px solid #00b894;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Responsive: tablet / mobile */
@media (max-width: 640px) {
  #aacc-bar {
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    max-height: min(82dvh, 640px);
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #aacc-bar .aacc-bar__content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 16px;
    max-width: none;
    width: auto;
    min-width: 0;
    max-inline-size: 100%;
    box-sizing: border-box;
  }
  #aacc-bar .aacc-bar__text {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    max-inline-size: 100%;
    font-size: 13px;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  #aacc-bar .aacc-bar__text * {
    max-inline-size: 100%;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  #aacc-bar .aacc-bar__buttons {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }
  #aacc-bar .aacc-bar__buttons .aacc-btn {
    flex: 0 0 auto;
    width: 100%;
    min-height: 38px;
    white-space: normal;
  }
  #aacc-bar .aacc-bar__links {
    width: 100%;
    min-width: 0;
    max-inline-size: 100%;
    overflow-wrap: anywhere;
  }
  #aacc-bar .aacc-link,
  #aacc-bar .aacc-link-button,
  #aacc-bar .aacc-ccpa-link {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #aacc-bar.aacc-bar--box,
  #aacc-bar.aacc-bar--modal { left: 10px; right: 10px; max-width: none; border-radius: 12px; }

  #aacc-modal { padding: 12px; align-items: flex-end; }
  #aacc-modal .aacc-modal__dialog { max-height: 90vh; border-radius: 16px 16px 0 0; }
  #aacc-modal .aacc-modal__header { padding: 18px 18px 14px; }
  #aacc-modal .aacc-modal__body { padding: 14px 18px; }
  #aacc-modal .aacc-modal__footer { padding: 14px 18px 18px; flex-direction: column; }
  #aacc-modal .aacc-modal__footer .aacc-btn { flex: 1 1 100%; min-height: 48px; }
  #aacc-modal .aacc-modal__footer [data-aacc-action="reject-all"],
  #aacc-modal .aacc-modal__footer [data-aacc-action="save-selection"] {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  #aacc-details { padding: 0; align-items: flex-end; }
  #aacc-details .aacc-details__dialog { max-width: 100%; max-height: 95vh; border-radius: 16px 16px 0 0; }
  #aacc-details .aacc-details__topbar {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    padding: 14px 16px 12px;
    gap: 8px 12px;
  }
  #aacc-details .aacc-details__topbar h2 { grid-column: 1 / -1; text-align: left; font-size: 18px; }
  #aacc-details .aacc-details__toplinks { grid-column: 1 / -1; justify-self: start; justify-content: flex-start; }
  #aacc-details .aacc-details__body { padding: 0 16px 20px; }
  #aacc-details .aacc-details__footer { padding: 14px 16px 18px; gap: 8px; }
  #aacc-details .aacc-details__footer-btn { flex: 1 1 100%; min-height: 48px; }
  #aacc-details .aacc-history__item-grid { grid-template-columns: 1fr; }
  #aacc-details .aacc-svc-provider__table th,
  #aacc-details .aacc-svc-provider__table td,
  #aacc-details .aacc-svc-cookie__meta th,
  #aacc-details .aacc-svc-cookie__meta td {
    display: block;
    width: 100%;
    padding-right: 0;
  }
  #aacc-details .aacc-svc-provider__table th,
  #aacc-details .aacc-svc-cookie__meta th { padding-bottom: 2px; }
  #aacc-details .aacc-svc-provider__table td,
  #aacc-details .aacc-svc-cookie__meta td { padding-bottom: 8px; }
}

@media (max-width: 420px) {
  #aacc-bar .aacc-btn { font-size: 12px; padding: 8px 14px; }
  #aacc-details .aacc-details__back { display: none; }
  #aacc-details .aacc-details__topbar { grid-template-columns: 1fr; }
}

/* Scroll lock — JS lockScroll() adds these classes to html + body */
html.aacc-no-scroll,
body.aacc-no-scroll { overflow: hidden; }

/* WordPress admin bar offset — top-bar banner variant only */
body.admin-bar #aacc-bar.aacc-bar--top_bar { top: 32px; }
@media screen and (max-width: 782px) {
  body.admin-bar #aacc-bar.aacc-bar--top_bar { top: 46px; }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  #aacc-bar,
  #aacc-modal,
  #aacc-details,
  #aacc-overlay,
  #aacc-widget,
  #aacc-bar .aacc-btn,
  #aacc-modal .aacc-btn,
  #aacc-details .aacc-btn,
  .aacc-switch__slider,
  .aacc-svc-arrow,
  .aacc-svc-service__body {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Print — hide all plugin UI when printing */
@media print {
  #aacc-bar,
  #aacc-overlay,
  #aacc-modal,
  #aacc-details,
  #aacc-widget,
  #aacc-toggle {
    display: none !important;
    visibility: hidden !important;
  }
  html.aacc-no-scroll,
  body.aacc-no-scroll { overflow: visible !important; }
}
