/*
 * Cookie Consent Banner — standalone styles
 * All rules are namespaced under .cc-* / #cc-* to avoid colliding with host page styles.
 * Override look and feel by redefining the --cc-* custom properties on :root or #cc-root.
 */

#cc-root {
  --cc-bg: #1f2430;
  --cc-fg: #f4f5f7;
  --cc-muted: #b7bccb;
  --cc-border: rgba(255, 255, 255, 0.12);
  --cc-accent: #4f7cff;
  --cc-accent-fg: #ffffff;
  --cc-btn-secondary-bg: rgba(255, 255, 255, 0.08);
  --cc-btn-secondary-fg: #f4f5f7;
  --cc-overlay: rgba(10, 12, 18, 0.55);
  --cc-radius: 10px;
  --cc-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --cc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --cc-z: 2147483000;

  font-family: var(--cc-font);
  color: var(--cc-fg);
}

#cc-root * {
  box-sizing: border-box;
}

#cc-root button {
  font-family: inherit;
  cursor: pointer;
}

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

.cc-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--cc-z);
  background: var(--cc-bg);
  color: var(--cc-fg);
  border-top: 1px solid var(--cc-border);
  box-shadow: var(--cc-shadow);
  padding: 20px 24px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.cc-banner.cc-top {
  top: 0;
  bottom: auto;
  border-top: none;
  border-bottom: 1px solid var(--cc-border);
  transform: translateY(-100%);
}

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

.cc-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.cc-banner-text {
  flex: 1 1 420px;
  min-width: 240px;
}

.cc-banner-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.cc-banner-description {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--cc-muted);
}

.cc-banner-description a {
  color: var(--cc-accent);
  text-decoration: underline;
}

.cc-banner-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

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

.cc-btn {
  border: 1px solid transparent;
  border-radius: var(--cc-radius);
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: filter 0.15s ease, background 0.15s ease;
}

.cc-btn:hover {
  filter: brightness(1.08);
}

.cc-btn:focus-visible {
  outline: 2px solid var(--cc-accent);
  outline-offset: 2px;
}

.cc-btn-primary {
  background: var(--cc-accent);
  color: var(--cc-accent-fg);
}

.cc-btn-secondary {
  background: var(--cc-btn-secondary-bg);
  color: var(--cc-btn-secondary-fg);
  border-color: var(--cc-border);
}

.cc-btn-text {
  background: transparent;
  color: var(--cc-fg);
  border-color: var(--cc-border);
}

/* ---------- Floating "Cookie Settings" button ---------- */

.cc-floating-btn {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: calc(var(--cc-z) - 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  border-radius: 999px;
  background: var(--cc-bg);
  color: var(--cc-fg);
  border: 1px solid var(--cc-border);
  box-shadow: var(--cc-shadow);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, filter 0.15s ease;
}

.cc-floating-btn.cc-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cc-floating-btn:hover {
  filter: brightness(1.08);
}

.cc-floating-btn:focus-visible {
  outline: 2px solid var(--cc-accent);
  outline-offset: 2px;
}

.cc-floating-btn-icon {
  font-size: 16px;
  line-height: 1;
}

@media (max-width: 480px) {
  .cc-floating-btn-label {
    display: none;
  }

  .cc-floating-btn {
    padding: 10px;
  }
}

/* ---------- Preferences dialog ---------- */

.cc-overlay {
  position: fixed;
  inset: 0;
  background: var(--cc-overlay);
  z-index: calc(var(--cc-z) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.cc-overlay.cc-visible {
  opacity: 1;
  pointer-events: auto;
}

.cc-dialog {
  background: var(--cc-bg);
  color: var(--cc-fg);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  width: 100%;
  max-width: 560px;
  max-height: min(640px, 90vh);
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}

.cc-overlay.cc-visible .cc-dialog {
  transform: translateY(0) scale(1);
}

.cc-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--cc-border);
}

.cc-dialog-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.cc-dialog-description {
  margin: 0;
  font-size: 13px;
  color: var(--cc-muted);
  line-height: 1.5;
}

.cc-dialog-close {
  background: transparent;
  border: none;
  color: var(--cc-muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
}

.cc-dialog-close:hover {
  background: var(--cc-btn-secondary-bg);
  color: var(--cc-fg);
}

.cc-dialog-body {
  padding: 8px 24px;
  overflow-y: auto;
  flex: 1;
}

.cc-category {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--cc-border);
}

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

.cc-category-text {
  flex: 1;
}

.cc-category-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.cc-category-description {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--cc-muted);
}

.cc-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--cc-border);
  flex-wrap: wrap;
}

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

.cc-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
}

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

.cc-switch-track {
  position: absolute;
  inset: 0;
  background: var(--cc-btn-secondary-bg);
  border: 1px solid var(--cc-border);
  border-radius: 999px;
  transition: background 0.15s ease;
}

.cc-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.cc-switch input:checked ~ .cc-switch-track {
  background: var(--cc-accent);
  border-color: var(--cc-accent);
}

.cc-switch input:checked ~ .cc-switch-thumb {
  transform: translateX(20px);
}

.cc-switch input:disabled {
  cursor: not-allowed;
}

.cc-switch input:disabled ~ .cc-switch-track {
  opacity: 0.6;
}

.cc-switch input:focus-visible ~ .cc-switch-track {
  outline: 2px solid var(--cc-accent);
  outline-offset: 2px;
}

.cc-category-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cc-always-on {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--cc-muted);
  white-space: nowrap;
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .cc-banner {
    padding: 16px;
  }

  .cc-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .cc-banner-actions {
    justify-content: stretch;
  }

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

  .cc-dialog-header,
  .cc-dialog-body,
  .cc-dialog-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .cc-dialog-footer {
    flex-direction: column-reverse;
  }

  .cc-dialog-footer .cc-btn {
    width: 100%;
    text-align: center;
  }
}
