/**
 * PARVALY Cookie Consent Banner & Settings Modal
 * Matches site design system from styles.css
 */

/* ============================================
   COOKIE CONSENT BANNER
   ============================================ */

#cookie-consent-banner {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 580px;
  width: calc(100% - 32px);
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow-lg, 0 10px 40px rgba(0, 0, 0, 0.12));
  padding: 24px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#cookie-consent-banner.show {
  opacity: 1;
}

.cookie-banner-content {
  margin-bottom: 20px;
}

.cookie-banner-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text, #1a1a2e);
  margin-bottom: 8px;
  font-weight: 500;
}

.cookie-banner-link {
  color: var(--accent, #2563eb);
  text-decoration: underline;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.cookie-banner-link:hover {
  color: var(--accent-hover, #1d4ed8);
}

.cookie-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* Button styles matching site design */
.cookie-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  line-height: 1;
}

.cookie-btn:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

.cookie-btn-primary {
  background: var(--accent, #2563eb);
  color: #ffffff;
}

.cookie-btn-primary:hover {
  background: var(--accent-hover, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.cookie-btn-secondary {
  background: transparent;
  color: var(--text-secondary, #64748b);
  border: 1px solid var(--border, #e2e8f0);
}

.cookie-btn-secondary:hover {
  background: var(--bg-secondary, #f8fafc);
  color: var(--text, #1a1a2e);
}

.cookie-btn-link {
  background: transparent;
  color: var(--accent, #2563eb);
  padding: 12px 16px;
  text-decoration: underline;
}

.cookie-btn-link:hover {
  color: var(--accent-hover, #1d4ed8);
}

/* Responsive banner */
@media (max-width: 640px) {
  #cookie-consent-banner {
    bottom: 16px;
    width: calc(100% - 24px);
    padding: 20px;
  }

  .cookie-banner-actions {
    flex-direction: column;
    width: 100%;
  }

  .cookie-btn {
    width: 100%;
    padding: 14px 24px;
  }
}

/* ============================================
   COOKIE SETTINGS MODAL
   ============================================ */

#cookie-settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#cookie-settings-modal.show {
  opacity: 1;
}

.cookie-modal-content {
  background: var(--card, #ffffff);
  border-radius: var(--radius-lg, 20px);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

#cookie-settings-modal.show .cookie-modal-content {
  transform: scale(1);
}

.cookie-modal-header {
  padding: 32px 32px 24px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.cookie-modal-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text, #1a1a2e);
  margin: 0 0 12px;
}

.cookie-modal-description {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary, #64748b);
  margin: 0;
}

.cookie-modal-body {
  padding: 24px 32px;
}

.cookie-category {
  padding: 20px 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.cookie-category:last-child {
  border-bottom: none;
}

.cookie-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cookie-category-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text, #1a1a2e);
  margin: 0;
}

.cookie-category-description {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary, #64748b);
  margin: 0;
}

/* Toggle switch */
.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

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

.cookie-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  border-radius: 50px;
  transition: 0.3s;
}

.cookie-toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
  background-color: var(--accent, #2563eb);
}

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

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

.cookie-toggle input:focus-visible + .cookie-toggle-slider {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

/* Always enabled indicator */
.cookie-always-enabled {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
  padding: 4px 12px;
  background: var(--bg-secondary, #f8fafc);
  border-radius: 50px;
  border: 1px solid var(--border, #e2e8f0);
}

.cookie-always-enabled::before {
  content: "✓";
  color: var(--accent, #2563eb);
}

/* Modal footer */
.cookie-modal-footer {
  padding: 24px 32px;
  border-top: 1px solid var(--border, #e2e8f0);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.cookie-footer-note {
  font-size: 0.8125rem;
  color: var(--text-secondary, #64748b);
  font-style: italic;
  flex: 1 1 100%;
  margin-bottom: 8px;
}

.cookie-modal-footer .cookie-btn {
  flex: 1;
  min-width: 140px;
}

/* Responsive modal */
@media (max-width: 640px) {
  .cookie-modal-content {
    border-radius: var(--radius, 12px);
    max-height: 95vh;
  }

  .cookie-modal-header {
    padding: 24px 20px 20px;
  }

  .cookie-modal-title {
    font-size: 1.5rem;
  }

  .cookie-modal-body {
    padding: 20px;
  }

  .cookie-modal-footer {
    padding: 20px;
    flex-direction: column;
  }

  .cookie-modal-footer .cookie-btn {
    width: 100%;
  }

  .cookie-category-header {
    align-items: flex-start;
    gap: 12px;
  }

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

/* ============================================
   FOOTER COOKIE SETTINGS LINK
   ============================================ */

.footer-cookie-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
  cursor: pointer;
}

.footer-cookie-link:hover {
  color: rgba(255, 255, 255, 1);
  text-decoration: underline;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Keyboard navigation focus states */
.cookie-btn:focus,
.cookie-toggle input:focus + .cookie-toggle-slider {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

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

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  #cookie-consent-banner,
  #cookie-settings-modal,
  .cookie-modal-content,
  .cookie-btn,
  .cookie-toggle-slider,
  .cookie-toggle-slider:before {
    transition: none;
  }
}
