/**
 * Cookie Consent Component Styles
 * GDPR/CCPA compliant consent management UI
 */

:root {
  --bg-deep: hsl(248, 44%, 7%);
  --bg-card: hsl(248, 38%, 12%);
  --bg-overlay: hsl(248, 44%, 7%, 0.85);
  --border-subtle: hsl(0, 0%, 100%, 0.08);
  --border-focus: hsl(258, 100%, 75%, 0.5);
  --text-primary: hsl(258, 52%, 95%);
  --text-secondary: hsl(258, 52%, 95%, 0.6);
  --text-muted: hsl(258, 52%, 95%, 0.4);
  --accent-purple: hsl(258, 100%, 75%);
  --accent-purple-dim: hsl(258, 100%, 75%, 0.15);
  --accent-green: hsl(158, 64%, 52%);
  --accent-green-dim: hsl(158, 64%, 52%, 0.15);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-banner: 0 -4px 32px hsl(0, 0%, 0%, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'SF Pro Text', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Demo page content */
.demo-page {
  padding: 60px 24px 200px;
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}
.demo-page h1 {
  font-size: 24px;
  margin-bottom: 16px;
}
.demo-page p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.demo-reset {
  padding: 12px 24px;
  background: var(--accent-purple-dim);
  border: 1px solid hsl(258, 100%, 75%, 0.3);
  border-radius: var(--radius-md);
  color: var(--accent-purple);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.demo-reset:hover {
  background: hsl(258, 100%, 75%, 0.25);
}
.consent-status {
  margin-top: 32px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: left;
}
.consent-status h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.consent-status pre {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  font-family: 'SF Mono', Monaco, monospace;
}

/* ═══════════════════════════════════════════════
   COOKIE CONSENT BANNER
   ═══════════════════════════════════════════════ */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-banner);
  padding: 20px 24px;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.cookie-banner.visible {
  transform: translateY(0);
}

.cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.cookie-text {
  flex: 1;
  min-width: 280px;
}
.cookie-text p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.cookie-text a {
  color: var(--accent-purple);
  text-decoration: none;
}
.cookie-text a:hover {
  text-decoration: underline;
}

.cookie-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cookie-btn {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cookie-btn-primary {
  background: var(--accent-purple);
  border: none;
  color: hsl(248, 44%, 7%);
}
.cookie-btn-primary:hover {
  background: hsl(260, 100%, 79%);
}

.cookie-btn-secondary {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.cookie-btn-secondary:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.cookie-btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 500;
}
.cookie-btn-link:hover {
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════
   PREFERENCES MODAL
   ═══════════════════════════════════════════════ */
.cookie-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.cookie-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.cookie-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: calc(100% - 48px);
  max-width: 520px;
  max-height: calc(100vh - 48px);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cookie-modal-overlay.visible + .cookie-modal,
.cookie-modal.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.cookie-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cookie-modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}
.cookie-modal-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.cookie-modal-close:hover {
  background: hsl(0, 0%, 100%, 0.05);
  color: var(--text-primary);
}

.cookie-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.cookie-category {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.cookie-category:last-child {
  border-bottom: none;
}

.cookie-category-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cookie-category-info {
  flex: 1;
}
.cookie-category-info h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cookie-category-info p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.badge-required {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  background: var(--accent-green-dim);
  color: var(--accent-green);
  border-radius: 4px;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: hsl(0, 0%, 100%, 0.1);
  border-radius: 12px;
  transition: background 0.2s ease;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-purple-dim);
}
.toggle-switch input:checked + .toggle-slider::before {
  background: var(--accent-purple);
  transform: translateX(20px);
}
.toggle-switch input:disabled + .toggle-slider {
  cursor: not-allowed;
  opacity: 0.6;
}
.toggle-switch input:disabled:checked + .toggle-slider::before {
  background: var(--accent-green);
}

.cookie-scripts {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.cookie-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════
   CCPA FOOTER LINK (always visible)
   ═══════════════════════════════════════════════ */
.privacy-footer-link {
  position: fixed;
  bottom: 16px;
  right: 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  z-index: 100;
  transition: all 0.2s ease;
}
.privacy-footer-link:hover {
  color: var(--text-secondary);
  border-color: var(--border-focus);
}
.cookie-banner.visible ~ .privacy-footer-link {
  opacity: 0;
  pointer-events: none;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .cookie-actions {
    flex-direction: column;
  }
  .cookie-btn {
    width: 100%;
    text-align: center;
  }
}
