/* ============================================================
   PrivacyKit — Privacy Policy Plugin Stylesheet
   Drop this into any site. All styles are scoped to .pk-* 
   so there are no conflicts with your existing CSS.
   ============================================================ */

/* ── Variables ──────────────────────────────────────────── */
:root {
  --pk-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --pk-font-mono: 'Courier New', monospace;

  --pk-bg: #ffffff;
  --pk-surface: #f8f9fa;
  --pk-border: #e2e8f0;
  --pk-text: #1a202c;
  --pk-muted: #64748b;
  --pk-accent: #2563eb;
  --pk-accent-hover: #1d4ed8;
  --pk-accent-light: #eff6ff;
  --pk-success: #059669;
  --pk-radius: 10px;
  --pk-radius-sm: 6px;
  --pk-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --pk-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.14);
  --pk-transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Policy Page Layout ────────────────────────────────── */
.pk-policy-page {
  font-family: var(--pk-font);
  color: var(--pk-text);
  max-width: 740px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  line-height: 1.7;
}

.pk-policy-header {
  padding: 3rem 0 2.5rem;
  border-bottom: 2px solid var(--pk-border);
  margin-bottom: 2.5rem;
  text-align: center;
}

.pk-policy-icon {
  display: block;
  font-size: 3rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.pk-policy-title {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
  color: var(--pk-text);
}

.pk-policy-meta {
  font-size: 0.875rem;
  color: var(--pk-muted);
  margin: 0;
}

/* ── Policy Sections ───────────────────────────────────── */
.pk-section {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--pk-border);
  animation: pk-fade-in 0.4s ease both;
  animation-delay: calc(var(--pk-i, 0) * 0.05s);
}

.pk-section:last-of-type {
  border-bottom: none;
}

@keyframes pk-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pk-section-heading {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--pk-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pk-section-heading::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.1em;
  background: var(--pk-accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.pk-section-body p {
  margin: 0 0 0.75rem;
  color: var(--pk-text);
}

.pk-section-body p:last-child { margin-bottom: 0; }

.pk-section-body ul {
  margin: 0.5rem 0 0.75rem 0;
  padding-left: 1.5rem;
}

.pk-section-body li {
  margin-bottom: 0.35rem;
}

.pk-section-body strong {
  font-weight: 600;
  color: var(--pk-text);
}

/* Custom pasted content */
.pk-custom-content p { margin: 0 0 1rem; }
.pk-custom-content h2 { font-size: 1.15rem; font-weight: 600; margin: 2rem 0 0.5rem; }
.pk-custom-content h3 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.35rem; }
.pk-custom-content ul { margin: 0.5rem 0 1rem 1.5rem; }
.pk-custom-content li { margin-bottom: 0.3rem; }

/* ── Policy Footer ─────────────────────────────────────── */
.pk-policy-footer {
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--pk-surface);
  border-radius: var(--pk-radius);
  text-align: center;
  font-size: 0.9rem;
  color: var(--pk-muted);
}

.pk-policy-footer a {
  color: var(--pk-accent);
  text-decoration: none;
  font-weight: 500;
}

.pk-policy-footer a:hover { text-decoration: underline; }

/* ── PDF Embed ─────────────────────────────────────────── */
.pk-pdf-wrapper {
  width: 100%;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  overflow: hidden;
  margin: 1.5rem 0;
}

.pk-pdf-embed {
  width: 100%;
  height: 80vh;
  min-height: 500px;
  border: none;
  display: block;
}

.pk-pdf-download {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--pk-accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.pk-pdf-download:hover { text-decoration: underline; }

/* ── Cookie Banner ─────────────────────────────────────── */
.pk-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99990;
  padding: 0 1rem 1rem;
  font-family: var(--pk-font);
  transform: translateY(100%);
  transition: transform var(--pk-transition);
}

.pk-cookie-banner.pk-banner-visible {
  transform: translateY(0);
}

.pk-cookie-banner.pk-banner-exit {
  transform: translateY(110%);
  transition: transform 0.35s ease-in;
}

.pk-banner-inner {
  background: #fff;
  border: 1px solid var(--pk-border);
  border-radius: var(--pk-radius);
  box-shadow: var(--pk-shadow-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.pk-banner-text {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  flex: 1;
  min-width: 260px;
}

.pk-banner-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.pk-banner-heading {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--pk-text);
}

.pk-banner-sub {
  font-size: 0.825rem;
  color: var(--pk-muted);
  margin: 0;
  line-height: 1.55;
}

.pk-banner-sub a {
  color: var(--pk-accent);
  text-decoration: none;
}

.pk-banner-sub a:hover { text-decoration: underline; }

.pk-banner-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ── Buttons ───────────────────────────────────────────── */
.pk-btn {
  font-family: var(--pk-font);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: var(--pk-radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--pk-transition);
  white-space: nowrap;
  line-height: 1;
}

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

.pk-btn-primary {
  background: var(--pk-accent);
  color: #fff;
  border-color: var(--pk-accent);
}
.pk-btn-primary:hover {
  background: var(--pk-accent-hover);
  border-color: var(--pk-accent-hover);
}

.pk-btn-outline {
  background: transparent;
  color: var(--pk-text);
  border-color: var(--pk-border);
}
.pk-btn-outline:hover {
  background: var(--pk-surface);
  border-color: #cbd5e1;
}

.pk-btn-secondary {
  background: var(--pk-surface);
  color: var(--pk-muted);
  border-color: var(--pk-border);
}
.pk-btn-secondary:hover {
  background: #edf2f7;
  color: var(--pk-text);
}

/* ── Preferences Modal ────────────────────────────────── */
.pk-prefs-modal,
#pk-prefs-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  font-family: var(--pk-font);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--pk-transition);
}

#pk-prefs-modal.pk-modal-visible {
  opacity: 1;
  pointer-events: all;
}

.pk-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}

.pk-modal-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -52%);
  transition: transform var(--pk-transition);
  background: #fff;
  border-radius: var(--pk-radius);
  box-shadow: var(--pk-shadow-lg);
  width: min(500px, calc(100vw - 2rem));
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#pk-prefs-modal.pk-modal-visible .pk-modal-box {
  transform: translate(-50%, -50%);
}

.pk-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--pk-border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.pk-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--pk-text);
}

.pk-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--pk-muted);
  padding: 0.25rem;
  line-height: 1;
  border-radius: 4px;
  transition: color var(--pk-transition);
}

.pk-modal-close:hover { color: var(--pk-text); }

.pk-modal-body {
  padding: 1.25rem 1.5rem;
  flex: 1;
}

.pk-modal-body > p {
  font-size: 0.875rem;
  color: var(--pk-muted);
  margin: 0 0 1.25rem;
}

.pk-categories {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pk-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: var(--pk-surface);
  border-radius: var(--pk-radius-sm);
  border: 1px solid var(--pk-border);
}

.pk-category-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pk-category-info strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--pk-text);
}

.pk-category-info span {
  font-size: 0.775rem;
  color: var(--pk-muted);
}

/* Toggle switch */
.pk-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
}

.pk-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.pk-toggle-slider {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  background: #cbd5e1;
  border-radius: 99px;
  transition: background var(--pk-transition);
  flex-shrink: 0;
}

.pk-toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--pk-transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.pk-toggle input:checked + .pk-toggle-slider {
  background: var(--pk-accent);
}

.pk-toggle input:checked + .pk-toggle-slider::after {
  transform: translateX(18px);
}

.pk-toggle-locked .pk-toggle-slider {
  background: var(--pk-success);
  opacity: 0.8;
  cursor: not-allowed;
}

.pk-locked-label {
  font-size: 0.7rem;
  color: var(--pk-success);
  font-weight: 600;
}

.pk-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--pk-border);
  background: var(--pk-surface);
  border-radius: 0 0 var(--pk-radius) var(--pk-radius);
}

/* ── Nav Links ─────────────────────────────────────────── */
.pk-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--pk-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-family: var(--pk-font);
  padding: 0.3rem 0;
  transition: color var(--pk-transition);
}

.pk-nav-link:hover { color: var(--pk-accent); }

/* ── Dark Mode ─────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --pk-bg: #0f172a;
    --pk-surface: #1e293b;
    --pk-border: #334155;
    --pk-text: #f1f5f9;
    --pk-muted: #94a3b8;
    --pk-accent: #60a5fa;
    --pk-accent-hover: #93c5fd;
    --pk-accent-light: #1e3a5f;
    --pk-shadow: 0 4px 24px rgba(0,0,0,0.4);
    --pk-shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  }

  .pk-banner-inner,
  .pk-modal-box {
    background: #1e293b;
  }

  .pk-modal-header {
    background: #1e293b;
  }

  .pk-btn-outline {
    color: var(--pk-text);
  }
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .pk-policy-title { font-size: 1.6rem; }

  .pk-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .pk-banner-actions {
    flex-direction: column;
    gap: 0.4rem;
  }

  .pk-btn {
    width: 100%;
    justify-content: center;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
  }
}

/* ── Accessibility ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pk-cookie-banner,
  .pk-modal-box,
  .pk-section,
  .pk-btn,
  .pk-toggle-slider,
  .pk-toggle-slider::after {
    transition: none;
    animation: none;
  }
}
