/**
 * GDPR Cookie Consent Banner & Preferences Panel Styles
 */

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

.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.98) 0%, rgba(118, 75, 162, 0.98) 100%);
  -webkit-backdrop-filter: blur(10px); /* Safari */
  backdrop-filter: blur(10px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 999999;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  padding: 1.5rem;
  border-top: 2px solid rgba(255, 255, 255, 0.1);
}

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

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

.cookie-consent-content {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex: 1;
  min-width: 300px;
}

.cookie-consent-icon {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.cookie-consent-text {
  flex: 1;
}

.cookie-consent-text h3 {
  margin: 0 0 0.5rem;
  color: white;
  font-size: 1.25rem;
  font-weight: 600;
}

.cookie-consent-text p {
  margin: 0;
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.95rem;
  line-height: 1.5;
}

.cookie-consent-text a {
  color: white;
  text-decoration: underline;
  font-weight: 500;
  transition: opacity 0.2s;
}

.cookie-consent-text a:hover {
  opacity: 0.8;
}

.cookie-consent-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

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

.cookie-btn-accept {
  background: white;
  color: #667eea;
}

.cookie-btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cookie-btn-reject {
  background: transparent;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.cookie-btn-reject:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: white;
}

/* Manage button on banner — styled between reject and accept */
.cookie-consent-actions .cookie-btn-manage {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.cookie-consent-actions .cookie-btn-manage:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: white;
}

.cookie-btn:focus {
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* =============================================
   Cookie Preferences Overlay & Panel
   ============================================= */

.cookie-preferences-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 1rem;
}

.cookie-preferences-overlay.show {
  opacity: 1;
}

.cookie-preferences-panel {
  background: #ffffff;
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.cookie-preferences-overlay.show .cookie-preferences-panel {
  transform: translateY(0);
}

.cookie-preferences-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a2e;
}

.cookie-preferences-description {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #555;
}

/* Preference rows */
.cookie-preferences-rows {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cookie-preference-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #e8e8f0;
  border-radius: 10px;
  background: #fafaff;
}

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

.cookie-preference-label-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.cookie-preference-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1a1a2e;
}

.cookie-preference-tag {
  display: inline-block;
  background: #667eea;
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cookie-preference-desc {
  margin: 0;
  font-size: 0.82rem;
  color: #666;
  line-height: 1.4;
}

/* =============================================
   CSS-Only Toggle Switch
   ============================================= */

.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

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

.cookie-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ccc;
  border-radius: 26px;
  transition: background 0.25s ease;
}

.cookie-toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
  background: #667eea;
}

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

.cookie-toggle input:focus-visible + .cookie-toggle-slider {
  outline: 3px solid rgba(102, 126, 234, 0.4);
  outline-offset: 2px;
}

/* Disabled toggle (for functional/required) */
.cookie-toggle-disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.cookie-toggle-disabled .cookie-toggle-slider {
  background: #667eea;
}

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

/* Panel action buttons */
.cookie-preferences-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.cookie-btn-save {
  background: #667eea;
  color: white;
  border: none;
}

.cookie-btn-save:hover {
  background: #5a6fd6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.cookie-preferences-actions .cookie-btn-accept {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
}

.cookie-preferences-actions .cookie-btn-accept:hover {
  background: #f0f2ff;
  transform: translateY(-1px);
}

.cookie-preferences-actions .cookie-btn:focus {
  outline: 3px solid rgba(102, 126, 234, 0.4);
  outline-offset: 2px;
}

/* =============================================
   Dark Mode
   ============================================= */

body.dark-mode .cookie-preferences-panel {
  background: #1e1e2e;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark-mode .cookie-preferences-title {
  color: #e0e0e0;
}

body.dark-mode .cookie-preferences-description {
  color: #aaa;
}

body.dark-mode .cookie-preference-row {
  background: #282840;
  border-color: #3a3a5c;
}

body.dark-mode .cookie-preference-label {
  color: #e0e0e0;
}

body.dark-mode .cookie-preference-desc {
  color: #999;
}

body.dark-mode .cookie-toggle-slider {
  background: #555;
}

body.dark-mode .cookie-btn-save {
  background: #667eea;
  color: white;
}

body.dark-mode .cookie-preferences-actions .cookie-btn-accept {
  background: transparent;
  color: #667eea;
  border-color: #667eea;
}

body.dark-mode .cookie-preferences-actions .cookie-btn-accept:hover {
  background: rgba(102, 126, 234, 0.1);
}

/* =============================================
   Mobile Responsiveness
   ============================================= */

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

  .cookie-consent-container {
    flex-direction: column;
    gap: 1rem;
  }

  .cookie-consent-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .cookie-consent-icon {
    font-size: 2rem;
  }

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

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

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

  .cookie-btn {
    width: 100%;
    padding: 1rem;
  }

  /* Preferences panel: full-width on mobile */
  .cookie-preferences-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .cookie-preferences-panel {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    padding: 1.5rem;
  }

  .cookie-preferences-actions {
    flex-direction: column-reverse;
  }

  .cookie-preferences-actions .cookie-btn {
    width: 100%;
    padding: 1rem;
  }
}

/* Phone responsive */
@media (max-width: 480px) {
  .cookie-preferences-panel {
    padding: 1rem;
  }

  .cookie-preferences-header h2 {
    font-size: 1.1rem;
  }

  .cookie-btn {
    min-height: 44px;
    font-size: 0.95rem;
  }

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

/* =============================================
   Reduced Motion
   ============================================= */

@media (prefers-reduced-motion: reduce) {
  .cookie-consent-banner {
    transition: none;
  }

  .cookie-preferences-overlay {
    transition: none;
  }

  .cookie-preferences-panel {
    transition: none;
  }

  .cookie-toggle-slider,
  .cookie-toggle-slider::before {
    transition: none;
  }
}

/* =============================================
   High Contrast
   ============================================= */

@media (prefers-contrast: high) {
  .cookie-consent-banner {
    border-top: 3px solid white;
  }

  .cookie-btn {
    border: 2px solid white;
  }

  .cookie-preference-row {
    border-width: 2px;
  }

  .cookie-toggle-slider {
    border: 2px solid #333;
  }
}
