/* =============================================
   COOKIE CONSENT BANNER
   GDPR/CCPA Compliant - Follows site theming
   ============================================= */

/* Banner Container - Fixed bottom */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  background: var(--card-bg, #ffffff);
  border-top: 1px solid var(--border, #e5e7eb);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  padding: 12px 20px;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
  font-family: 'Poppins', sans-serif;
}

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

.cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* Main content layout */
.cookie-banner-main {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cookie-banner-text {
  flex: 1;
  min-width: 280px;
}

.cookie-banner-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text, #333);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cookie-banner-title svg {
  flex-shrink: 0;
}

.cookie-banner-description {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text, #666);
  margin: 0 0 6px 0;
}

.cookie-banner-links {
  font-size: 13px;
}

.cookie-banner-links a {
  color: var(--primary, #5c67f2);
  text-decoration: underline;
  margin-right: 16px;
}

.cookie-banner-links a:hover {
  text-decoration: none;
}

/* Button group */
.cookie-banner-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.cookie-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: inherit;
  white-space: nowrap;
}

.cookie-btn-accept-all {
  background: var(--primary, #5c67f2);
  color: var(--button-text, #fff);
}

.cookie-btn-accept-all:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.cookie-btn-reject-all {
  background: transparent;
  border: 1px solid var(--border, #ccc);
  color: var(--text, #333);
}

.cookie-btn-reject-all:hover {
  background: var(--bg, #f6f7fb);
}

.cookie-btn-customize {
  background: transparent;
  color: var(--primary, #5c67f2);
  padding: 10px 12px;
  text-decoration: underline;
}

.cookie-btn-customize:hover {
  text-decoration: none;
}

/* =============================================
   EXPANDABLE PREFERENCES PANEL
   ============================================= */
.cookie-preferences {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 0;
}

.cookie-preferences.expanded {
  max-height: 600px;
  margin-top: 20px;
}

.cookie-preferences-inner {
  border-top: 1px solid var(--border, #e5e7eb);
  padding-top: 20px;
}

.cookie-category {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg, #f6f7fb);
  border-radius: 8px;
  margin-bottom: 12px;
  gap: 16px;
}

.cookie-category:last-child {
  margin-bottom: 0;
}

.cookie-category-info {
  flex: 1;
  min-width: 0;
}

.cookie-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.cookie-category-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #333);
  margin: 0;
}

.cookie-category-required {
  font-size: 11px;
  background: var(--primary, #5c67f2);
  color: var(--button-text, #fff);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.cookie-category-description {
  font-size: 13px;
  color: var(--text, #666);
  line-height: 1.5;
  margin: 0;
}

.cookie-category-items {
  font-size: 12px;
  color: var(--text, #888);
  margin-top: 6px;
  font-style: italic;
}

/* Toggle switch for categories */
.cookie-toggle {
  position: relative;
  flex-shrink: 0;
}

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

.cookie-toggle-slider {
  display: block;
  width: 50px;
  height: 28px;
  background: var(--border, #ccc);
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.3s ease;
  position: relative;
}

.cookie-toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
  background: var(--primary, #5c67f2);
}

.cookie-toggle input:checked + .cookie-toggle-slider::before {
  transform: translateX(22px);
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Save preferences button */
.cookie-save-preferences {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

/* =============================================
   DARK MODE STYLES
   ============================================= */
html.dark-mode .cookie-banner {
  background: var(--card-bg, #1e1e1e);
  border-top-color: var(--border, #333);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

html.dark-mode .cookie-banner-title {
  color: var(--text, #e0e0e0);
}

html.dark-mode .cookie-banner-description {
  color: var(--text, #b0b0b0);
}

html.dark-mode .cookie-btn-reject-all {
  border-color: var(--border, #444);
  color: var(--text, #e0e0e0);
}

html.dark-mode .cookie-btn-reject-all:hover {
  background: var(--bg, #2a2a2a);
}

html.dark-mode .cookie-preferences-inner {
  border-top-color: var(--border, #333);
}

html.dark-mode .cookie-category {
  background: var(--bg, #121212);
}

html.dark-mode .cookie-category-name {
  color: var(--text, #e0e0e0);
}

html.dark-mode .cookie-category-description {
  color: var(--text, #b0b0b0);
}

html.dark-mode .cookie-category-items {
  color: var(--text, #888);
}

html.dark-mode .cookie-toggle-slider {
  background: var(--border, #444);
}

/* =============================================
   RESPONSIVE DESIGN
   ============================================= */
@media (max-width: 768px) {
  .cookie-banner {
    padding: 14px 16px;
  }

  .cookie-banner-inner {
    max-width: 100%;
  }

  .cookie-banner-main {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .cookie-banner-text {
    min-width: 100%;
    text-align: center;
  }

  .cookie-banner-title {
    justify-content: center;
    font-size: 15px;
    margin-bottom: 6px;
  }

  .cookie-banner-title svg {
    width: 20px;
    height: 20px;
  }

  .cookie-banner-description {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 8px;
  }

  .cookie-banner-links {
    justify-content: center;
    font-size: 12px;
  }

  .cookie-banner-buttons {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .cookie-btn {
    flex: 1 1 auto;
    min-width: 100px;
    text-align: center;
    padding: 12px 16px;
    font-size: 14px; /* Prevent iOS zoom */
  }

  .cookie-btn-accept-all {
    flex: 1 1 45%;
  }

  .cookie-btn-reject-all {
    flex: 1 1 45%;
  }

  .cookie-btn-customize {
    flex: 1 1 100%;
    order: 3;
    padding: 8px 16px;
  }

  .cookie-category {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px;
  }

  .cookie-category-info {
    flex: 1;
  }

  .cookie-category-name {
    font-size: 14px;
  }

  .cookie-category-description {
    font-size: 12px;
    display: none; /* Hide on mobile to save space */
  }

  .cookie-category-items {
    font-size: 11px;
    margin-top: 4px;
  }

  .cookie-toggle {
    align-self: center;
  }

  .cookie-toggle-slider {
    width: 44px;
    height: 24px;
  }

  .cookie-toggle-slider::before {
    width: 18px;
    height: 18px;
  }

  .cookie-toggle input:checked + .cookie-toggle-slider::before {
    transform: translateX(20px);
  }

  .cookie-preferences.expanded {
    max-height: 70vh;
    overflow-y: auto;
  }

  .cookie-preferences-inner {
    padding-top: 16px;
  }

  .cookie-save-preferences {
    margin-top: 12px;
    justify-content: center;
  }

  .cookie-save-preferences .cookie-btn {
    width: 100%;
    max-width: 300px;
  }
}

/* Small screens */
@media (max-width: 480px) {
  .cookie-banner {
    padding: 12px;
  }

  .cookie-banner-title {
    font-size: 14px;
  }

  .cookie-banner-description {
    font-size: 11px;
  }

  .cookie-banner-links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 12px;
  }

  .cookie-banner-links a {
    margin-right: 0;
    font-size: 11px;
  }

  .cookie-btn {
    padding: 10px 12px;
    font-size: 13px;
  }

  .cookie-btn-customize {
    padding: 6px 12px;
    font-size: 12px;
  }

  .cookie-category {
    padding: 10px;
  }

  .cookie-category-name {
    font-size: 13px;
  }

  .cookie-category-items {
    font-size: 10px;
  }
}

/* =============================================
   ACCESSIBILITY
   ============================================= */
.cookie-btn:focus-visible,
.cookie-toggle-slider:focus-visible {
  outline: 2px solid var(--primary, #5c67f2);
  outline-offset: 2px;
}

/* Screen reader only text */
.cookie-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .cookie-banner,
  .cookie-preferences,
  .cookie-toggle-slider,
  .cookie-toggle-slider::before,
  .cookie-btn {
    transition: none;
  }
}
