/**
 * Cookie Consent Banner & Settings Modal Styles
 * GDPR & PIPEDA Compliant Design
 */

/* ========================================
   Cookie Consent Banner
   ======================================== */

.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-background-secondary, #ffffff);
  border-top: 2px solid var(--color-border, #e5e7eb);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  z-index: 999999;
  padding: 1.5rem;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cookie-consent-banner.show {
  transform: translateY(0);
}

.cookie-consent-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.cookie-consent-text {
  flex: 1;
  min-width: 300px;
}

.cookie-consent-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--color-text-primary, #1f2937);
}

.cookie-consent-message {
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
  color: var(--color-text-secondary, #4b5563);
}

.cookie-consent-link {
  color: var(--color-primary, #2563eb);
  text-decoration: underline;
  font-weight: 500;
  transition: color 0.2s;
}

.cookie-consent-link:hover {
  color: var(--color-primary-dark, #1d4ed8);
}

.cookie-consent-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Cookie Buttons */
.cookie-btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

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

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

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

.cookie-btn-reject {
  background: transparent;
  color: var(--color-text-secondary, #6b7280);
  border: 2px solid var(--color-border, #d1d5db);
}

.cookie-btn-reject:hover {
  background: var(--color-background-tertiary, #f3f4f6);
  border-color: var(--color-text-secondary, #9ca3af);
}

.cookie-btn-secondary {
  background: var(--color-background-tertiary, #f3f4f6);
  color: var(--color-text-primary, #1f2937);
}

.cookie-btn-secondary:hover {
  background: var(--color-background-hover, #e5e7eb);
}

/* ========================================
   Cookie Settings Modal
   ======================================== */

.cookie-settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.cookie-settings-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.cookie-settings-content {
  position: relative;
  background: var(--color-background-primary, #ffffff);
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

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

.cookie-settings-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cookie-settings-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary, #1f2937);
}

.cookie-settings-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-secondary, #6b7280);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.cookie-settings-close:hover {
  background: var(--color-background-tertiary, #f3f4f6);
  color: var(--color-text-primary, #1f2937);
}

.cookie-settings-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.cookie-category {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}

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

.cookie-category-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.cookie-category-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary, #1f2937);
}

.cookie-category-info p {
  margin: 0 0 0.25rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-text-secondary, #6b7280);
}

.cookie-category-info small {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--color-background-tertiary, #f3f4f6);
  color: var(--color-text-tertiary, #9ca3af);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Toggle Switch */
.cookie-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
  margin-top: 0.25rem;
}

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

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

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

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

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

.cookie-switch input:disabled + .cookie-slider {
  background-color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

.cookie-switch input:focus + .cookie-slider {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.cookie-settings-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--color-border, #e5e7eb);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.cookie-settings-footer .cookie-btn {
  min-width: 150px;
}

/* ========================================
   Dark Theme Support
   ======================================== */

[data-theme="dark"] .cookie-consent-banner {
  background: #1f2937;
  border-top-color: #374151;
}

[data-theme="dark"] .cookie-consent-title {
  color: #f9fafb;
}

[data-theme="dark"] .cookie-consent-message {
  color: #d1d5db;
}

[data-theme="dark"] .cookie-consent-link {
  color: #60a5fa;
}

[data-theme="dark"] .cookie-consent-link:hover {
  color: #93c5fd;
}

[data-theme="dark"] .cookie-btn-reject {
  color: #d1d5db;
  border-color: #4b5563;
}

[data-theme="dark"] .cookie-btn-reject:hover {
  background: #374151;
  border-color: #6b7280;
}

[data-theme="dark"] .cookie-btn-secondary {
  background: #374151;
  color: #f9fafb;
}

[data-theme="dark"] .cookie-btn-secondary:hover {
  background: #4b5563;
}

[data-theme="dark"] .cookie-settings-overlay {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .cookie-settings-content {
  background: #1f2937;
}

[data-theme="dark"] .cookie-settings-header,
[data-theme="dark"] .cookie-category,
[data-theme="dark"] .cookie-settings-footer {
  border-color: #374151;
}

[data-theme="dark"] .cookie-settings-header h2 {
  color: #f9fafb;
}

[data-theme="dark"] .cookie-settings-close {
  color: #9ca3af;
}

[data-theme="dark"] .cookie-settings-close:hover {
  background: #374151;
  color: #f9fafb;
}

[data-theme="dark"] .cookie-category-info h3 {
  color: #f9fafb;
}

[data-theme="dark"] .cookie-category-info p {
  color: #d1d5db;
}

[data-theme="dark"] .cookie-category-info small {
  background: #374151;
  color: #9ca3af;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .cookie-consent-banner {
    padding: 1rem;
  }

  .cookie-consent-content {
    flex-direction: column;
    gap: 1.5rem;
  }

  .cookie-consent-text {
    min-width: auto;
  }

  .cookie-consent-title {
    font-size: 1.1rem;
  }

  .cookie-consent-message {
    font-size: 0.9rem;
  }

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

  .cookie-btn {
    width: 100%;
    justify-content: center;
  }

  .cookie-settings-content {
    width: 95%;
    max-height: 90vh;
  }

  .cookie-settings-header,
  .cookie-settings-body,
  .cookie-settings-footer {
    padding: 1rem;
  }

  .cookie-category-header {
    flex-direction: row;
    align-items: flex-start;
  }

  .cookie-switch {
    order: -1;
  }
}

@media (max-width: 480px) {
  .cookie-consent-title {
    font-size: 1rem;
  }

  .cookie-consent-message {
    font-size: 0.85rem;
  }

  .cookie-btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
  }

  .cookie-settings-header h2 {
    font-size: 1.25rem;
  }
}

/* ========================================
   Accessibility
   ======================================== */

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  .cookie-consent-banner {
    border-top-width: 3px;
  }

  .cookie-btn {
    border-width: 2px;
  }

  .cookie-btn-accept,
  .cookie-btn-secondary {
    border: 2px solid currentColor;
  }
}

/* Print styles */
@media print {
  .cookie-consent-banner,
  .cookie-settings-modal {
    display: none !important;
  }
}
