/* 
  Cookie Consent Manager - Styles
  Updated to match new JavaScript implementation
*/

/* --------------------------------
  CSS Variables & Global Wrapper
-------------------------------- */
#cookie-consent-wrapper {
  --focus: 0 0 0 2px #ffffff, 0 0 0 4px #000000, 0 0 0 6px #ffffff;
  --boxShadow: -5px 5px 10px 0px #00000012, 0px 0px 50px 0px #0000001a;
  --fontFamily: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --primaryColor: #533BE2;
  --backgroundColor: #FFFFFF;
  --textColor: #4B494B;
  --backdropBackgroundColor: #00000033;
  --backdropBackgroundBlur: 0px;
  --cookieIconColor: #533BE2;
  --cookieIconBackgroundColor: #FFFFFF;
  
  position: fixed;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  pointer-events: none;
  border: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --------------------------------
  Links
-------------------------------- */
#cookie-consent-wrapper a {
  all: unset;
  display: inline-block;
  color: var(--primaryColor);
  text-decoration: underline;
  cursor: pointer;
}

#cookie-consent-wrapper a:hover {
  color: var(--textColor);
}

/* --------------------------------
  Focus Styles
-------------------------------- */
#cookie-consent-wrapper a:focus,
#cookie-consent-wrapper #cookie-consent-banner button:focus,
#cookie-consent-wrapper #cookie-consent-modal button:focus,
#cookie-consent-wrapper #cookie-consent-icon:focus {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 5px;
}

#cookie-consent-wrapper #cookie-consent-icon:focus {
  border-radius: 50%;
}

/* --------------------------------
  Buttons
-------------------------------- */
#cookie-consent-wrapper .btn {
  color: var(--backgroundColor);
  background-color: var(--primaryColor);
  border: 2px solid var(--primaryColor);
  padding: 10px 20px;
  text-decoration: none;
  text-align: center;
  display: inline-block;
  font-size: 16px;
  line-height: 24px;
  cursor: pointer;
  border-radius: 5px;
  font-family: var(--fontFamily);
  transition: background-color 0.2s ease, color 0.2s ease;
}

#cookie-consent-wrapper .btn-primary:hover {
  background-color: var(--backgroundColor);
  color: var(--primaryColor);
}

#cookie-consent-wrapper .btn-secondary {
  background-color: var(--backgroundColor);
  color: var(--primaryColor);
}

#cookie-consent-wrapper .btn-secondary:hover {
  background-color: var(--primaryColor);
  color: var(--backgroundColor);
}

/* --------------------------------
  Banner
-------------------------------- */
#cookie-consent-banner {
  font-family: var(--fontFamily);
  color: var(--textColor);
  background-color: var(--backgroundColor);
  box-sizing: border-box;
  padding: 32px;
  border-radius: 5px;
  pointer-events: auto;
  border: 0;
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 600px;
  overflow: auto;
  max-width: calc(100% - 32px);
  max-height: calc(100vh - 32px);
  transform: translate(0, -20px);
  opacity: 0;
  animation: slideInDown 350ms ease-out forwards;
  animation-delay: 0.3s;
  box-shadow: var(--boxShadow);
}

#cookie-consent-banner.center {
  top: 50%;
  left: 50%;
  bottom: auto;
  right: auto;
  transform: translate(-50%, calc(-50% - 20px));
  animation: slideInDown-center 350ms ease-out forwards;
  animation-delay: 0.3s;
}

#cookie-consent-banner.bottomLeft {
  bottom: 16px;
  left: 16px;
  right: auto;
}

#cookie-consent-banner.bottomCenter {
  bottom: 16px;
  left: 50%;
  right: auto;
  transform: translate(-50%, -20px);
  animation: slideInDown-bottomCenter 350ms ease-out forwards;
  animation-delay: 0.3s;
}

#cookie-consent-banner .preferences {
  display: flex;
  gap: 5px;
  border: none;
  padding: 15px 0;
  background-color: transparent;
  color: var(--primaryColor);
  cursor: pointer;
  font-size: 16px;
  font-family: var(--fontFamily);
  align-items: center;
}

#cookie-consent-banner .preferences span {
  display: block;
  white-space: nowrap;
  text-decoration: underline;
}

#cookie-consent-banner .preferences:hover span {
  color: var(--textColor);
}

#cookie-consent-banner .preferences::after {
  display: block;
  content: '>';
  text-decoration: none;
}

#cookie-consent-banner p {
  font-size: 16px;
  line-height: 24px;
  margin: 0 0 15px;
}

#cookie-consent-banner a {
  display: inline-block;
  color: var(--primaryColor);
  text-decoration: underline;
  background-color: var(--backgroundColor);
}

#cookie-consent-banner a:hover {
  color: var(--textColor);
}

#cookie-consent-banner .actions {
  display: flex;
  gap: 16px;
  flex-direction: column;
  margin-top: 24px;
}

@media (min-width: 600px) {
  #cookie-consent-banner .actions {
    flex-direction: row;
    align-items: center;
  }
}

#cookie-consent-banner .actions-row {
  display: flex;
  gap: 16px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-grow: 1;
}

/* --------------------------------
  Modal
-------------------------------- */
#cookie-consent-modal {
  display: none;
  pointer-events: auto;
  overflow: auto;
  width: 800px;
  max-width: calc(100% - 32px);
  max-height: calc(100vh - 32px);
  border: 0;
  transform: translate(0, -20px);
  opacity: 0;
  animation: slideInUp-center 350ms ease-out forwards;
  box-shadow: var(--boxShadow);
  font-family: var(--fontFamily);
  color: var(--textColor);
  flex-direction: column;
  padding: 30px;
  background-color: var(--backgroundColor);
  border-radius: 5px;
  box-sizing: border-box;
}

/* --------------------------------
  Modal - Header
-------------------------------- */
#cookie-consent-modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
}

#cookie-consent-modal h1 {
  font-family: var(--fontFamily);
  color: var(--textColor);
  font-size: 24px;
  font-weight: 500;
  margin: 0;
  line-height: 1.3;
}

#cookie-consent-modal .modal-close {
  display: inline-flex;
  border: none;
  padding: 13px;
  cursor: pointer;
  background: var(--backgroundColor);
  color: var(--primaryColor);
  border-radius: 5px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

#cookie-consent-modal .modal-close:hover {
  background-color: #f5f5f5;
}

#cookie-consent-modal .modal-close svg {
  fill: var(--primaryColor);
  display: block;
}

/* --------------------------------
  Modal - Content
-------------------------------- */
#cookie-consent-modal section {
  flex: 1;
  margin-top: 32px;
}

#cookie-consent-modal section::-webkit-scrollbar {
  width: 8px;
}

#cookie-consent-modal section::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

#cookie-consent-modal section::-webkit-scrollbar-thumb {
  background-color: var(--textColor);
  border-radius: 10px;
  opacity: 0.5;
}

#cookie-consent-modal section::-webkit-scrollbar-thumb:hover {
  background-color: var(--primaryColor);
}

#cookie-consent-modal p {
  font-size: 16px;
  line-height: 24px;
  color: var(--textColor);
  margin: 0 0 15px;
}

#cookie-consent-modal p:last-of-type {
  margin: 0;
}

#cookie-consent-modal fieldset {
  padding: 0;
  border: none;
  margin: 0 0 32px;
}

#cookie-consent-modal fieldset:last-of-type {
  margin: 0;
}

#cookie-consent-modal legend {
  padding: 0;
  margin: 0 0 10px;
  font-weight: 700;
  color: var(--textColor);
  font-size: 16px;
}

#cookie-consent-modal .cookie-type-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

#cookie-consent-modal .cookie-type-description {
  flex: 1;
  font-size: 14px;
  line-height: 20px;
  color: var(--textColor);
}

/* --------------------------------
  Modal - Toggle Switches
-------------------------------- */
#cookie-consent-modal .switch {
  flex-shrink: 0;
  position: relative;
  display: inline-block;
  height: 34px;
  width: 74px;
  cursor: pointer;
}

#cookie-consent-modal .switch:focus-within {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 25px;
}

#cookie-consent-modal .switch input {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
}

/* Unchecked Switch Styles */
#cookie-consent-modal .switch__pill {
  position: relative;
  display: block;
  height: 34px;
  width: 74px;
  background: var(--textColor);
  border-radius: 25px;
  transition: background-color 0.15s ease-out;
}

#cookie-consent-modal .switch__dot {
  position: absolute;
  top: 2px;
  left: 2px;
  display: block;
  height: 30px;
  width: 30px;
  background: var(--backgroundColor);
  border-radius: 50%;
  transition: left 0.15s ease-out;
}

#cookie-consent-modal .switch__off,
#cookie-consent-modal .switch__on {
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 600;
  color: var(--backgroundColor);
  position: absolute;
  top: 8px;
  right: 8px;
  transition: right 0.15s ease-out, opacity 0.15s ease-out;
  pointer-events: none;
}

#cookie-consent-modal .switch__off {
  opacity: 1;
}

#cookie-consent-modal .switch__on {
  opacity: 0;
  right: auto;
  left: 8px;
}

/* Checked Switch Styles */
#cookie-consent-modal .switch input:checked + .switch__pill {
  background: var(--primaryColor);
}

#cookie-consent-modal .switch input:checked ~ .switch__dot {
  left: calc(100% - 32px);
}

#cookie-consent-modal .switch input:checked ~ .switch__off {
  opacity: 0;
}

#cookie-consent-modal .switch input:checked ~ .switch__on {
  opacity: 1;
}

/* Disabled Switch Styles */
#cookie-consent-modal .switch input:disabled {
  cursor: not-allowed;
}

#cookie-consent-modal .switch input:disabled + .switch__pill {
  opacity: 0.65;
  cursor: not-allowed;
}

#cookie-consent-modal .switch:has(input:disabled) {
  cursor: not-allowed;
}

/* --------------------------------
  Modal - Footer
-------------------------------- */
#cookie-consent-modal footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

@media (min-width: 600px) {
  #cookie-consent-modal footer {
    flex-direction: row;
    align-items: center;
  }
}

/* --------------------------------
  Cookie Icon
-------------------------------- */
#cookie-consent-icon {
  display: none;
  position: fixed;
  bottom: 16px;
  left: 16px;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  color: var(--cookieIconBackgroundColor);
  padding: 0;
  border: none;
  background-color: var(--cookieIconColor);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  opacity: 0;
  animation: fadeIn 0.3s ease-in-out forwards;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#cookie-consent-icon:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#cookie-consent-icon:active {
  transform: scale(0.95);
}

#cookie-consent-icon.bottomRight {
  left: auto;
  right: 16px;
}

#cookie-consent-icon.topLeft {
  bottom: auto;
  top: 16px;
  left: 16px;
}

#cookie-consent-icon.topRight {
  bottom: auto;
  top: 16px;
  left: auto;
  right: 16px;
}

#cookie-consent-icon svg {
  fill: var(--cookieIconBackgroundColor);
}

/* Light color scheme */
#cookie-consent-icon.light {
  --cookieIconColor: #FFFFFF;
  --cookieIconBackgroundColor: #533BE2;
}

/* Dark color scheme */
#cookie-consent-icon.dark {
  --cookieIconColor: #1a1a1a;
  --cookieIconBackgroundColor: #FFFFFF;
}

/* --------------------------------
  Backdrop
-------------------------------- */
#cookie-consent-backdrop {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--backdropBackgroundColor);
  backdrop-filter: blur(var(--backdropBackgroundBlur));
  pointer-events: all;
  animation: fadeIn 0.3s ease-in-out;
}

/* --------------------------------
  Animations
-------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown-center {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 20px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes slideInDown-bottomCenter {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes slideInUp-center {
  from {
    opacity: 0;
    transform: translate(0, 20px);
  }
  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

/* --------------------------------
  Responsive Design
-------------------------------- */
@media (max-width: 600px) {
  #cookie-consent-banner {
    padding: 24px;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 5px 5px 0 0;
  }

  #cookie-consent-banner.center {
    transform: translate(0, 0);
    top: auto;
    left: 0;
    bottom: 0;
    animation: slideInDown 350ms ease-out forwards;
  }

  #cookie-consent-banner.bottomLeft,
  #cookie-consent-banner.bottomCenter {
    left: 0;
    transform: translateY(-20px);
    animation: slideInDown 350ms ease-out forwards;
  }

  #cookie-consent-modal {
    padding: 20px;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  #cookie-consent-modal h1 {
    font-size: 20px;
  }

  #cookie-consent-modal .cookie-type-content {
    flex-direction: column;
    gap: 16px;
  }
}

/* --------------------------------
  Accessibility Enhancements
-------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #cookie-consent-banner,
  #cookie-consent-modal,
  #cookie-consent-icon,
  #cookie-consent-backdrop {
    animation: none;
    transition: none;
  }

  #cookie-consent-banner {
    opacity: 1;
    transform: none;
  }

  #cookie-consent-modal {
    opacity: 1;
    transform: none;
  }

  #cookie-consent-icon {
    opacity: 1;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  #cookie-consent-wrapper {
    --primaryColor: #0000FF;
    --textColor: #000000;
    --backgroundColor: #FFFFFF;
  }

  #cookie-consent-wrapper .btn {
    border-width: 3px;
  }
}

/* Print styles */
@media print {
  #cookie-consent-wrapper {
    display: none !important;
  }
}
