/*
 * Cookie consent banner + preferences modal.
 * Colours/fonts copied from static/theme/stylesheet/variables.less to match
 * the Flex theme (orange #D9411E accent, dark-grey #242121 text, the same
 * .btn shape). Mobile-first, matching style.less's own 768px breakpoint.
 */

#cc-banner,
#cc-modal-overlay,
#cc-modal-overlay * {
  box-sizing: border-box;
}

/* ---------- Banner ---------- */

#cc-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background-color: #ffffff;
  color: #242121;
  font-family: 'Source Sans Pro', 'Roboto', 'Open Sans', 'Liberation Sans', 'DejaVu Sans', 'Verdana', 'Helvetica', 'Arial', sans-serif;
  font-size: 1em;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.18);
  border-top: 3px solid #D9411E;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateY(110%);
  transition: transform 0.4s ease;
}

#cc-banner.cc-visible {
  transform: translateY(0);
}

#cc-banner[hidden] {
  display: none;
}

.cc-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cc-banner-text {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-size: .92em;
  line-height: 1.45;
}

.cc-icon {
  color: #D9411E;
  font-size: 1.3em;
  line-height: 1.3;
  flex-shrink: 0;
}

.cc-banner-text p {
  margin: 0;
}

.cc-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cc-banner-actions .cc-btn {
  flex: 1 1 auto;
}

/* ---------- Buttons ---------- */

.cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .6em 1.1em;
  font-family: inherit;
  font-size: .85em;
  font-weight: 600;
  line-height: 1;
  border-radius: .25em;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.cc-btn-primary {
  background-color: #D9411E;
  border-color: #D9411E;
  color: #ffffff;
}

.cc-btn-primary:hover,
.cc-btn-primary:focus {
  background-color: #FF5A09;
  border-color: #FF5A09;
}

.cc-btn-outline {
  background-color: transparent;
  border-color: #999999;
  color: #242121;
}

.cc-btn-outline:hover,
.cc-btn-outline:focus {
  background-color: #eeeeee;
  border-color: #333333;
}

.cc-btn:focus {
  outline: 2px solid #D9411E;
  outline-offset: 2px;
}

/* ---------- Modal (preferences) ---------- */

#cc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background-color: rgba(36, 33, 33, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

#cc-modal-overlay[hidden] {
  display: none;
}

.cc-modal {
  background-color: #ffffff;
  color: #242121;
  font-family: 'Source Sans Pro', 'Roboto', 'Open Sans', 'Liberation Sans', 'DejaVu Sans', 'Verdana', 'Helvetica', 'Arial', sans-serif;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: .5em .5em 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
}

.cc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #eeeeee;
  position: sticky;
  top: 0;
  background-color: #ffffff;
}

.cc-modal-header h2 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 300;
}

.cc-modal-close {
  background: none;
  border: none;
  font-size: 1.6em;
  line-height: 1;
  color: #999999;
  cursor: pointer;
  padding: 4px 8px;
}

.cc-modal-close:hover {
  color: #242121;
}

.cc-modal-body {
  padding: 4px 20px 8px;
}

.cc-modal-intro {
  font-size: .9em;
  color: #333333;
  line-height: 1.5;
}

.cc-category {
  padding: 14px 0;
  border-bottom: 1px solid #eeeeee;
}

.cc-category:last-child {
  border-bottom: none;
}

.cc-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cc-category-title {
  font-weight: 600;
  font-size: .98em;
}

.cc-category-desc {
  margin: 6px 0 0;
  font-size: .84em;
  color: #999999;
  line-height: 1.45;
}

.cc-locked-label {
  font-size: .78em;
  color: #999999;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ---------- Toggle switch ---------- */

.cc-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.cc-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.cc-toggle-slider {
  position: absolute;
  inset: 0;
  background-color: #cccccc;
  border-radius: 24px;
  transition: background-color .2s ease;
}

.cc-toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform .2s ease;
}

.cc-toggle input:checked + .cc-toggle-slider {
  background-color: #D9411E;
}

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

.cc-toggle input:focus + .cc-toggle-slider {
  outline: 2px solid #D9411E;
  outline-offset: 2px;
}

.cc-modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eeeeee;
  position: sticky;
  bottom: 0;
  background-color: #ffffff;
}

.cc-modal-footer .cc-btn {
  flex: 1 1 auto;
}

/* ---------- Desktop (matches style.less's 768px breakpoint) ---------- */

@media screen and (min-width: 768px) {
  .cc-banner-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .cc-banner-text {
    flex: 1 1 auto;
  }

  .cc-banner-actions {
    flex-wrap: nowrap;
    flex-shrink: 0;
  }

  .cc-banner-actions .cc-btn {
    flex: 0 0 auto;
  }

  #cc-modal-overlay {
    align-items: center;
    padding: 20px;
  }

  .cc-modal {
    border-radius: .5em;
    max-height: 80vh;
  }
}
