/*
 * SmartMart Consent – styles for #sm-consent-banner and #sm-consent-dialog
 * (see js/sm-consent.js)
 */
:root {
  --smc-primary: #3d80e4;
  --smc-primary-hover: #2f6cc9;
  /* "Accept all": same green as the "Demo-Termin vereinbaren" button (.sm-green-button) */
  --smc-accept: #28a745;
  --smc-accept-hover: #218838;
  --smc-text: #1f2937;
  --smc-muted: #5b6472;
  --smc-border: #e5e7eb;
  --smc-bg: #ffffff;
  --smc-soft: #f4f6f9;
  --smc-radius: 14px;
  --smc-shadow: 0 12px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
  --smc-font: "Source Sans Pro", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Banner (bottom) ---------- */

.smc-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 10050;
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--smc-bg);
  color: var(--smc-text);
  border: 1px solid var(--smc-border);
  border-radius: var(--smc-radius);
  box-shadow: var(--smc-shadow);
  font-family: var(--smc-font);
  font-size: 15px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.smc-banner[hidden] {
  display: none;
}
.smc-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.smc-banner__text {
  flex: 1 1 auto;
  min-width: 0;
}
.smc-title {
  margin: 0 0 4px;
  font-family: var(--smc-font);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--smc-text);
  letter-spacing: normal;
  text-transform: none;
}
.smc-banner p,
.smc-dialog p {
  margin: 0;
  color: var(--smc-muted);
}
.smc-links {
  margin-top: 6px !important;
  font-size: 13px;
}
.smc-links a {
  color: var(--smc-muted);
  text-decoration: underline;
}
.smc-links a + a {
  margin-left: 12px;
}
.smc-banner__actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

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

.smc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: var(--smc-font);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.smc-btn:focus-visible,
.smc-switch input:focus-visible + .smc-switch__track,
.smc-close:focus-visible {
  outline: 3px solid rgba(61, 128, 228, 0.45);
  outline-offset: 2px;
}
.smc-btn--primary {
  background: var(--smc-accept);
  color: #fff;
}
.smc-btn--primary:hover {
  background: var(--smc-accept-hover);
}
/* "Only necessary" is deliberately as prominent as "Accept all" */
.smc-btn--secondary {
  background: var(--smc-bg);
  color: var(--smc-primary);
  border-color: var(--smc-primary);
}
.smc-btn--secondary:hover {
  background: var(--smc-soft);
}
/* "Nur notwendige": light grey text and border (text still meets 4.5:1 contrast on white) */
.smc-btn[data-sm-consent="reject-all"] {
  color: #6f7a87;
  border-color: #b9c0c9;
}
.smc-btn[data-sm-consent="reject-all"]:hover {
  color: #55606c;
  border-color: #9aa3ae;
}
.smc-btn--link {
  background: transparent;
  color: var(--smc-text);
  padding: 0 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.smc-btn--link:hover {
  color: var(--smc-primary);
}

/* ---------- Settings dialog ---------- */

.smc-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: none;
  border-radius: var(--smc-radius);
  box-shadow: var(--smc-shadow);
  background: var(--smc-bg);
  color: var(--smc-text);
  font-family: var(--smc-font);
  font-size: 15px;
  line-height: 1.5;
}
.smc-dialog[open] {
  display: flex;
  flex-direction: column;
}
/* Fallback for browsers without <dialog> support */
.smc-dialog:not([open]) {
  display: none;
}
.smc-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.smc-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 8px;
}
.smc-dialog__body {
  padding: 4px 24px 8px;
  overflow-y: auto;
}
.smc-dialog__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--smc-border);
}
.smc-close {
  appearance: none;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--smc-soft);
  color: var(--smc-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.smc-close:hover {
  background: var(--smc-border);
}
.smc-category {
  padding: 16px 0;
  border-bottom: 1px solid var(--smc-border);
}
.smc-category:last-child {
  border-bottom: none;
}
.smc-category__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}
.smc-category__name {
  margin: 0 !important;
  font-family: var(--smc-font) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  color: var(--smc-text) !important;
  cursor: pointer;
}
.smc-category p {
  font-size: 14px;
}
.smc-always {
  font-size: 13px;
  font-weight: 600;
  color: #15803d;
  white-space: nowrap;
}

/* Toggle switch */
.smc-switch {
  position: relative;
  flex: 0 0 auto;
  display: inline-block;
  width: 46px;
  height: 26px;
  margin: 0;
  cursor: pointer;
}
.smc-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.smc-switch__track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd2dc;
  transition: background-color 0.2s ease;
  pointer-events: none;
}
.smc-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}
.smc-switch input:checked + .smc-switch__track {
  background: var(--smc-primary);
}
.smc-switch input:checked + .smc-switch__track::after {
  transform: translateX(20px);
}

html.sm-consent-dialog-open {
  overflow: hidden;
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
  .smc-banner {
    left: 8px;
    right: 8px;
    bottom: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 18px;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
  }
  .smc-banner__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .smc-banner__actions .smc-btn--link {
    grid-column: 1 / -1;
    order: 3;
  }
  .smc-btn {
    padding: 0 12px;
    white-space: normal;
    text-align: center;
  }
  .smc-dialog__foot {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .smc-dialog__foot .smc-btn--primary {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .smc-banner,
  .smc-switch__track,
  .smc-switch__track::after {
    transition: none;
  }
}
