/**
 * Consent Banner and Modal Styles
 * @countermeasure/web-components
 */

/* Banner Container */
.cmm-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--cmm-consent-bg, #0f172a);
  border-top: 1px solid var(--cmm-consent-border, #334155);
  padding: 1rem;
  box-shadow: 0 -4px 6px -1px rgb(0 0 0 / 0.1);
  transform: translateY(0);
  transition: transform 0.3s ease-in-out;
}

.cmm-consent-banner--hidden {
  transform: translateY(100%);
}

.cmm-consent-banner__content {
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 640px) {
  .cmm-consent-banner__content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.cmm-consent-banner__text {
  flex: 1;
  font-size: 0.875rem;
  color: var(--cmm-consent-text, #cbd5e1);
}

.cmm-consent-banner__title {
  font-weight: 500;
  color: var(--cmm-consent-title, #ffffff);
  margin-bottom: 0.25rem;
}

.cmm-consent-banner__link {
  color: var(--cmm-consent-link, #60a5fa);
  text-decoration: underline;
}

.cmm-consent-banner__link:hover {
  color: var(--cmm-consent-link-hover, #93c5fd);
}

.cmm-consent-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Buttons */
.cmm-consent-btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.cmm-consent-btn--secondary {
  background: var(--cmm-consent-btn-secondary-bg, #1e293b);
  color: var(--cmm-consent-btn-secondary-text, #cbd5e1);
  border: 1px solid var(--cmm-consent-btn-secondary-border, #475569);
}

.cmm-consent-btn--secondary:hover {
  background: var(--cmm-consent-btn-secondary-hover, #334155);
}

.cmm-consent-btn--primary {
  background: var(--cmm-consent-btn-primary-bg, #2563eb);
  color: var(--cmm-consent-btn-primary-text, #ffffff);
  border: 1px solid transparent;
}

.cmm-consent-btn--primary:hover {
  background: var(--cmm-consent-btn-primary-hover, #3b82f6);
}

/* Modal */
.cmm-consent-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.cmm-consent-modal--open {
  display: flex;
}

.cmm-consent-modal__dialog {
  background: var(--cmm-consent-modal-bg, #0f172a);
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  max-width: 32rem;
  width: calc(100% - 2rem);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cmm-consent-modal__header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--cmm-consent-border, #334155);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cmm-consent-modal__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--cmm-consent-title, #ffffff);
}

.cmm-consent-modal__close {
  background: transparent;
  border: none;
  color: var(--cmm-consent-text-muted, #94a3b8);
  cursor: pointer;
  padding: 0.25rem;
}

.cmm-consent-modal__close:hover {
  color: var(--cmm-consent-title, #ffffff);
}

.cmm-consent-modal__body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.cmm-consent-modal__footer {
  padding: 1.5rem;
  border-top: 1px solid var(--cmm-consent-border, #334155);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Category List */
.cmm-consent-category {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--cmm-consent-border, #334155);
  margin-bottom: 1rem;
}

.cmm-consent-category:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.cmm-consent-category__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.cmm-consent-category__name {
  font-weight: 500;
  color: var(--cmm-consent-title, #ffffff);
}

.cmm-consent-category__description {
  font-size: 0.875rem;
  color: var(--cmm-consent-text-muted, #94a3b8);
}

/* Toggle Switch */
.cmm-consent-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.cmm-consent-toggle--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cmm-consent-toggle__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cmm-consent-toggle__slider {
  width: 2.75rem;
  height: 1.5rem;
  background: var(--cmm-consent-toggle-off, #475569);
  border-radius: 9999px;
  position: relative;
  transition: background-color 0.2s;
}

.cmm-consent-toggle__input:checked + .cmm-consent-toggle__slider {
  background: var(--cmm-consent-toggle-on, #2563eb);
}

.cmm-consent-toggle__slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.25rem;
  height: 1.25rem;
  background: white;
  border-radius: 9999px;
  transition: transform 0.2s;
}

.cmm-consent-toggle__input:checked + .cmm-consent-toggle__slider::after {
  transform: translateX(1.25rem);
}

.cmm-consent-toggle__input:focus + .cmm-consent-toggle__slider {
  outline: 2px solid var(--cmm-consent-focus-ring, #3b82f6);
  outline-offset: 2px;
}

/* Cookie Details */
.cmm-consent-cookies {
  margin-top: 0.5rem;
}

.cmm-consent-cookies__summary {
  font-size: 0.75rem;
  color: var(--cmm-consent-text-muted, #94a3b8);
  cursor: pointer;
}

.cmm-consent-cookies__summary:hover {
  color: var(--cmm-consent-text, #cbd5e1);
}

.cmm-consent-cookies__list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cmm-consent-cookie {
  font-size: 0.75rem;
  color: var(--cmm-consent-text-muted, #94a3b8);
  display: flex;
  justify-content: space-between;
}
