/**
 * Cookie Consent — מינימלי, RTL, נגיש, תמיכה ב-dark mode
 * תלוי ב-#cookie-consent-root (נוצר אוטומטית אם חסר)
 */

#cookie-consent-root {
  position: relative;
  z-index: 10800;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ----- באנר תחתון ----- */
.cc-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem max(1rem, env(safe-area-inset-right)) calc(0.75rem + env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  background: #fff;
  border-top: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.08);
  transform: translateY(0);
  opacity: 1;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.cc-banner[hidden] {
  display: none !important;
}

.cc-banner__inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

@media (min-width: 768px) {
  .cc-banner__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
  }
}

.cc-banner__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.cc-banner__desc {
  margin: 0;
  font-size: 0.9375rem;
  color: #475569;
  max-width: 52rem;
}

.cc-banner__privacy {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cc-banner__privacy:hover {
  color: #1d4ed8;
}

.cc-banner__privacy:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
  border-radius: 4px;
}

.cc-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .cc-banner__actions {
    justify-content: flex-start;
  }
}

/* ----- כפתורים ----- */
.cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.5rem 1.1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cc-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.cc-btn--primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.cc-btn--primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.cc-btn--secondary {
  background: #f1f5f9;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}

.cc-btn--secondary:hover {
  background: #e2e8f0;
}

.cc-btn--ghost {
  background: transparent;
  color: #475569;
  border-color: transparent;
}

.cc-btn--ghost:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* ----- רקע מודאל ----- */
.cc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10801;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  opacity: 1;
  transition: opacity 0.22s ease;
}

.cc-backdrop[hidden] {
  display: none !important;
}

html.cc-modal-open {
  overflow: hidden;
}

/* ----- מודאל ----- */
.cc-modal {
  width: 100%;
  max-width: 28rem;
  max-height: min(88vh, 36rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(15, 23, 42, 0.08);
  transform: translateY(0);
  opacity: 1;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.cc-modal[hidden] {
  display: none !important;
}

.cc-modal__panel {
  padding: 1.25rem 1.35rem 1.35rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cc-modal__title {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
}

.cc-modal__intro {
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.55;
}

.cc-category {
  padding: 0.85rem 0;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.cc-category:first-of-type {
  border-top: none;
  padding-top: 0;
}

.cc-category__title {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
}

.cc-category__desc {
  margin: 0 0 0.65rem;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.5;
}

.cc-toggle-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.cc-always-on {
  display: inline-flex;
  align-items: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: #f1f5f9;
}

/* ----- מתג (checkbox) ----- */
.cc-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.cc-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.cc-switch__ui {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.2s ease;
}

.cc-switch__ui::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: calc(1.5rem - 6px);
  height: calc(1.5rem - 6px);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform 0.2s ease;
}

.cc-switch input:checked + .cc-switch__ui {
  background: #2563eb;
}

.cc-switch input:checked + .cc-switch__ui::after {
  transform: translateX(-1.25rem);
}

.cc-switch input:focus-visible + .cc-switch__ui {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

.cc-switch__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
}

.cc-modal__privacy {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cc-modal__privacy:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 4px;
}

.cc-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.15rem;
}

@media (min-width: 420px) {
  .cc-modal__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .cc-modal__actions .cc-btn--primary {
    order: -1;
  }
}

/* ----- כפתור צף ----- */
.cc-float-btn {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom));
  inset-inline-start: max(1rem, env(safe-area-inset-inline-start));
  z-index: 10790;
  min-height: 2.35rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  color: #475569;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cc-float-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.cc-float-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.cc-float-btn[hidden] {
  display: none !important;
}

/* ----- Dark mode ----- */
@media (prefers-color-scheme: dark) {
  .cc-banner {
    background: #1e293b;
    border-top-color: rgba(148, 163, 184, 0.2);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  }

  .cc-banner__title,
  .cc-modal__title,
  .cc-category__title {
    color: #f1f5f9;
  }

  .cc-banner__desc,
  .cc-category__desc,
  .cc-modal__intro {
    color: #94a3b8;
  }

  .cc-btn--secondary {
    background: #334155;
    color: #f1f5f9;
    border-color: rgba(148, 163, 184, 0.25);
  }

  .cc-btn--secondary:hover {
    background: #475569;
  }

  .cc-btn--ghost {
    color: #94a3b8;
  }

  .cc-btn--ghost:hover {
    background: #334155;
    color: #f1f5f9;
  }

  .cc-modal {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  }

  .cc-category {
    border-top-color: rgba(148, 163, 184, 0.15);
  }

  .cc-always-on {
    background: #334155;
    color: #cbd5e1;
  }

  .cc-switch__ui {
    background: #475569;
  }

  .cc-switch__label {
    color: #e2e8f0;
  }

  .cc-float-btn {
    background: #1e293b;
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.25);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  }

  .cc-float-btn:hover {
    background: #334155;
    color: #f1f5f9;
  }

  .cc-backdrop {
    background: rgba(0, 0, 0, 0.55);
  }
}

/* פוטר האתר — כפתור "הגדרות עוגיות" */
.footer-cookie-settings {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.footer-cookie-settings:hover {
  opacity: 0.85;
}

.footer-cookie-settings:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}
