/**
 * Cookie Consent Styles - Vanilla JavaScript Implementation
 * EU-compliant cookie consent for static HTML sites
 *
 * Part of the GetMy Suite - uses brand assets and design tokens
 */

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 2px solid var(--color-brand-primary, #5B5FFF);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
  z-index: 9999;
}

.cookie-banner--visible {
  transform: translateY(0);
}

.cookie-banner__content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.cookie-banner__text {
  flex: 1;
}

.cookie-banner__text h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1a1a1a;
}

.cookie-banner__text p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #4a4a4a;
}

.cookie-banner__text a {
  color: var(--color-brand-primary, #5B5FFF);
  text-decoration: underline;
}

.cookie-banner__text a:hover {
  text-decoration: none;
}

.cookie-banner__actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Cookie Modal */
.cookie-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.cookie-modal--visible {
  display: flex;
}

.cookie-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.cookie-modal__content {
  position: relative;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cookie-modal__header {
  padding: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cookie-modal__header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a1a1a;
}

.cookie-modal__close {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
}

.cookie-modal__close:hover {
  background-color: #f0f0f0;
  color: #1a1a1a;
}

.cookie-modal__body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.cookie-modal__body > p {
  margin: 0 0 1.5rem 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #4a4a4a;
}

.cookie-modal__footer {
  padding: 1.5rem;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Cookie Category */
.cookie-category {
  margin-bottom: 1.25rem;
}

.cookie-category:last-child {
  margin-bottom: 0;
}

.cookie-category__header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.cookie-category__desc {
  display: block;
  font-size: 0.85rem;
  color: #666;
  font-weight: 400;
  margin-top: 0.25rem;
}

/* Cookie Toggle */
.cookie-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  width: 100%;
}

.cookie-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-toggle__slider {
  position: relative;
  width: 48px;
  height: 24px;
  background-color: #ccc;
  border-radius: 24px;
  transition: background-color 0.3s;
  flex-shrink: 0;
}

.cookie-toggle__slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.cookie-toggle input:checked + .cookie-toggle__slider {
  background-color: var(--color-brand-primary, #5B5FFF);
}

.cookie-toggle input:checked + .cookie-toggle__slider::before {
  transform: translateX(24px);
}

.cookie-toggle input:disabled + .cookie-toggle__slider {
  background-color: #4CAF50;
  opacity: 0.6;
  cursor: not-allowed;
}

.cookie-toggle input:focus + .cookie-toggle__slider {
  box-shadow: 0 0 0 3px rgba(91, 95, 255, 0.2);
}

.cookie-toggle__label {
  flex: 1;
  padding-top: 0.1rem;
}

.cookie-toggle__label strong {
  display: block;
  font-size: 1rem;
  color: #1a1a1a;
  margin-bottom: 0.25rem;
}

/* Cookie Button */
.cookie-button {
  padding: 0.625rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.cookie-button--primary {
  background-color: var(--color-brand-primary, #5B5FFF);
  color: #ffffff;
}

.cookie-button--primary:hover {
  background-color: var(--color-brand-primary-dark, #4a4ccc);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 95, 255, 0.3);
}

.cookie-button--secondary {
  background-color: #f0f0f0;
  color: #1a1a1a;
}

.cookie-button--secondary:hover {
  background-color: #e0e0e0;
}

.cookie-button--tertiary {
  background-color: transparent;
  color: var(--color-brand-primary, #5B5FFF);
  border: 2px solid var(--color-brand-primary, #5B5FFF);
}

.cookie-button--tertiary:hover {
  background-color: var(--color-brand-primary, #5B5FFF);
  color: #ffffff;
}

.cookie-button:focus {
  outline: 2px solid var(--color-brand-primary, #5B5FFF);
  outline-offset: 2px;
}

/* Cookie Settings Button */
.cookie-settings-button {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  background-color: var(--color-brand-primary, #5B5FFF);
  color: #ffffff;
  border: none;
  border-radius: 24px;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
  z-index: 9998;
  opacity: 0;
  transform: translateY(100px);
  pointer-events: none;
}

.cookie-settings-button--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.cookie-settings-button:hover {
  background-color: var(--color-brand-primary-dark, #4a4ccc);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.cookie-settings-button:focus {
  outline: 2px solid var(--color-brand-primary, #5B5FFF);
  outline-offset: 2px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .cookie-banner {
    background: #1a1a1a;
    border-top-color: var(--color-brand-primary, #5B5FFF);
  }

  .cookie-banner__text h3 {
    color: #ffffff;
  }

  .cookie-banner__text p {
    color: #d0d0d0;
  }

  .cookie-modal__content {
    background: #1a1a1a;
  }

  .cookie-modal__header {
    border-bottom-color: #333;
  }

  .cookie-modal__header h2 {
    color: #ffffff;
  }

  .cookie-modal__close {
    color: #d0d0d0;
  }

  .cookie-modal__close:hover {
    background-color: #333;
    color: #ffffff;
  }

  .cookie-modal__body > p {
    color: #d0d0d0;
  }

  .cookie-modal__footer {
    border-top-color: #333;
  }

  .cookie-category__desc {
    color: #999;
  }

  .cookie-toggle__label strong {
    color: #ffffff;
  }

  .cookie-button--secondary {
    background-color: #333;
    color: #ffffff;
  }

  .cookie-button--secondary:hover {
    background-color: #444;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .cookie-banner__content {
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-banner__actions {
    flex-direction: column;
    width: 100%;
  }

  .cookie-button {
    width: 100%;
  }

  .cookie-modal {
    padding: 0.5rem;
  }

  .cookie-modal__content {
    max-height: 95vh;
  }

  .cookie-modal__header {
    padding: 1rem;
  }

  .cookie-modal__body {
    padding: 1rem;
  }

  .cookie-modal__footer {
    padding: 1rem;
    flex-direction: column;
  }

  .cookie-settings-button {
    bottom: 1rem;
    left: 1rem;
    font-size: 0.85rem;
    padding: 0.625rem 1rem;
  }
}

/* Print - Hide cookie consent */
@media print {
  .cookie-banner,
  .cookie-modal,
  .cookie-settings-button {
    display: none !important;
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .cookie-banner,
  .cookie-modal__content,
  .cookie-toggle__slider,
  .cookie-toggle__slider::before,
  .cookie-button,
  .cookie-settings-button {
    transition: none;
    animation: none;
  }
}
