/* ============================================
   ATR Cookie Consent — Banner Styles v2.0
   Theme-native: inherits colors, fonts, radius from active WP theme.
   Respects Heim theme day/night mode automatically.
   ============================================ */

:root {
  --cc-radius: 8px;
  --cc-radius-sm: 6px;
  --cc-accent: var(--wp--preset--color--primary, #4a6cf7);
}

/* Scoped reset */
.cc-overlay *, .cc-overlay *::before, .cc-overlay *::after,
.cc-reopen-btn { box-sizing: border-box; margin: 0; padding: 0; }

/* Tame WordPress emoji-to-img conversions inside the banner */
.cc-overlay img.emoji,
.cc-overlay img.wp-smiley {
  width: 1em !important;
  height: 1em !important;
  max-width: 1em !important;
  max-height: 1em !important;
  min-width: auto !important;
  min-height: auto !important;
  display: inline !important;
  vertical-align: -0.1em !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: none !important;
  object-fit: contain !important;
}

/* ════════ OVERLAY ════════ */
.cc-overlay {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  z-index: 999999 !important;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex !important;
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 16px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  overflow: visible !important;
  font-family: inherit;
}
.cc-overlay.cc-visible { opacity: 1; visibility: visible; }

/* ════════ BANNER ════════ */
.cc-banner {
  position: relative;
  width: 100%; max-width: 680px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  background: var(--wp--preset--color--base, #fff);
  color: var(--wp--preset--color--contrast, #333);
  border: 1px solid rgba(128,128,128,0.2);
  border-radius: var(--cc-radius);
  box-shadow: 0 16px 48px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  overflow: visible;
  transform: translateY(30px);
  transition: transform 0.5s cubic-bezier(0.16,1,0.3,1);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
}
.cc-overlay.cc-visible .cc-banner { transform: translateY(0); }

/* Subtle top accent bar */
.cc-banner-topbar {
  height: 3px; flex-shrink: 0;
  background: var(--cc-accent);
  border-radius: var(--cc-radius) var(--cc-radius) 0 0;
  opacity: 0.8;
}

.cc-banner-scanlines { display: none; }

/* ════════ SCROLLABLE INNER ════════ */
.cc-banner-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 24px 28px;
  position: relative;
  z-index: 2;
  border-radius: 0 0 var(--cc-radius) var(--cc-radius);
  scrollbar-width: thin;
  scrollbar-color: rgba(128,128,128,0.3) transparent;
}
.cc-banner-inner::-webkit-scrollbar { width: 5px; }
.cc-banner-inner::-webkit-scrollbar-track { background: transparent; }
.cc-banner-inner::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.3); border-radius: 3px; }

/* ════════ CONTENT ════════ */
.cc-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cc-cookie-icon { width: 32px; height: 32px; flex-shrink: 0; }
.cc-title {
  font-size: 16px;
  font-weight: 700;
  color: inherit;
  line-height: 1.3;
  font-family: inherit;
}

.cc-description {
  font-size: 13.5px;
  line-height: 1.7;
  color: inherit;
  opacity: 0.8;
  margin-bottom: 18px;
  max-width: 600px;
}
.cc-description strong { font-weight: 600; opacity: 1; }

/* ════════ BUTTONS ════════ */
.cc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cc-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--cc-radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.4;
}
.cc-btn:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: 2px; }

.cc-btn-accept { background: var(--cc-accent); color: #fff; }
.cc-btn-accept:hover { opacity: 0.9; transform: translateY(-1px); }

.cc-btn-reject { background: transparent; color: inherit; border: 1px solid rgba(128,128,128,0.3); }
.cc-btn-reject:hover { border-color: rgba(128,128,128,0.5); background: rgba(128,128,128,0.05); }

.cc-btn-settings { background: transparent; color: inherit; opacity: 0.7; border: 1px solid rgba(128,128,128,0.2); }
.cc-btn-settings:hover { opacity: 1; border-color: rgba(128,128,128,0.4); }

.cc-btn-save { background: var(--cc-accent); color: #fff; }
.cc-btn-save:hover { opacity: 0.9; transform: translateY(-1px); }

/* ════════ SETTINGS PANEL ════════ */
.cc-settings-panel { display: none; }
.cc-settings-panel.cc-open { display: block; }
.cc-settings-inner { padding: 20px 0 8px; border-top: 1px solid rgba(128,128,128,0.15); margin-top: 18px; }
.cc-settings-intro { font-size: 12.5px; opacity: 0.6; margin-bottom: 18px; line-height: 1.6; }

/* ════════ CATEGORY CARDS ════════ */
.cc-category {
  background: rgba(128,128,128,0.04);
  border: 1px solid rgba(128,128,128,0.12);
  border-radius: var(--cc-radius-sm);
  margin-bottom: 10px;
  transition: border-color 0.2s ease;
}
.cc-category:hover { border-color: rgba(128,128,128,0.25); }

.cc-category-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer; gap: 14px; user-select: none;
}
.cc-category-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.cc-category-icon { font-size: 16px; flex-shrink: 0; width: 24px; text-align: center; }
.cc-category-name { font-size: 13px; font-weight: 600; color: inherit; margin-bottom: 2px; }
.cc-category-count { font-size: 11px; opacity: 0.5; }
.cc-expand-arrow { opacity: 0.4; font-size: 10px; transition: transform 0.3s ease; flex-shrink: 0; }
.cc-category.cc-expanded .cc-expand-arrow { transform: rotate(90deg); }

/* ════════ TOGGLE ════════ */
.cc-toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.cc-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.cc-toggle-track {
  position: absolute; inset: 0;
  background: rgba(128,128,128,0.25);
  border-radius: 11px;
  transition: background 0.3s ease;
  cursor: pointer;
}
.cc-toggle input:checked + .cc-toggle-track { background: var(--cc-accent); }
.cc-toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff; border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.cc-toggle input:checked ~ .cc-toggle-thumb { transform: translateX(18px); }
.cc-toggle input:disabled + .cc-toggle-track { opacity: 0.4; cursor: not-allowed; }
.cc-toggle input:focus-visible + .cc-toggle-track { outline: 2px solid var(--cc-accent); outline-offset: 2px; }

.cc-required-badge {
  font-size: 10px; opacity: 0.5;
  background: rgba(128,128,128,0.08);
  padding: 3px 8px; border-radius: 4px;
  letter-spacing: 0.3px; text-transform: uppercase; flex-shrink: 0;
}

/* ════════ CATEGORY DETAIL ════════ */
.cc-category-detail { display: none; }
.cc-category.cc-expanded .cc-category-detail { display: block; }
.cc-category-detail-inner { padding: 0 16px 14px; border-top: 1px solid rgba(128,128,128,0.1); }
.cc-category-purpose { font-size: 13px; color: inherit; opacity: 0.75; line-height: 1.65; padding: 12px 0; }

/* ════════ COOKIE TABLE ════════ */
.cc-cookie-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.cc-cookie-table th {
  text-align: left; opacity: 0.45; font-weight: 500;
  padding: 7px 8px; border-bottom: 1px solid rgba(128,128,128,0.15);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}
.cc-cookie-table td {
  padding: 8px; opacity: 0.7;
  border-bottom: 1px solid rgba(128,128,128,0.06);
  vertical-align: top; line-height: 1.5;
}
.cc-cookie-table tr:last-child td { border-bottom: none; }
.cc-cookie-name { font-weight: 600; opacity: 1; word-break: break-all; font-family: monospace; font-size: 11px; }

/* ════════ FOOTER ════════ */
.cc-footer {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid rgba(128,128,128,0.12);
  align-items: center;
}
.cc-footer-link { font-size: 11px; opacity: 0.45; color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
.cc-footer-link:hover { opacity: 0.8; }

/* ════════ CCPA ════════ */
.cc-ccpa-notice {
  font-size: 11.5px; opacity: 0.6;
  margin-top: 12px; padding: 10px 12px;
  background: rgba(128,128,128,0.04);
  border-radius: var(--cc-radius-sm);
  border: 1px dashed rgba(128,128,128,0.15);
  line-height: 1.6;
}
.cc-ccpa-notice a { color: var(--cc-accent); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }

/* ════════ RE-OPEN BUTTON ════════ */
.cc-reopen-btn svg {
  width: 22px !important;
  height: 22px !important;
  display: block !important;
  flex-shrink: 0 !important;
}
.cc-reopen-btn.cc-show { opacity: 1 !important; visibility: visible !important; transform: scale(1) !important; }
.cc-reopen-btn:hover {
  border-color: var(--cc-accent) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
  transform: scale(1.05) !important;
}

/* ════════ RESPONSIVE ════════ */
@media (max-width: 640px) {
  .cc-overlay { padding: 0 !important; }
  .cc-banner {
    max-width: 100%;
    max-height: 90vh; max-height: 90dvh;
    border-radius: var(--cc-radius-sm) var(--cc-radius-sm) 0 0;
  }
  .cc-banner-topbar { border-radius: var(--cc-radius-sm) var(--cc-radius-sm) 0 0; }
  .cc-banner-inner { padding: 20px 16px; border-radius: 0; }
  .cc-title { font-size: 14px; }
  .cc-description { font-size: 13px; }
  .cc-actions { flex-direction: column; align-items: stretch; }
  .cc-btn { text-align: center; padding: 12px 18px; }
  .cc-cookie-table { font-size: 10.5px; }
  .cc-cookie-table th:nth-child(3), .cc-cookie-table td:nth-child(3) { display: none; }
  .cc-footer { flex-direction: column; align-items: flex-start; }
}
