/*
 * LBConsent — Cookie/Privacy Consent Banner Styles
 * La Boutique Bootstrap 3 — Firebase Staging Site
 *
 * Self-contained. No Bootstrap dependency. All classes use .lb-consent- prefix.
 * Tested across: Chrome, Firefox, Safari, Edge, iOS Safari, Android Chrome.
 *
 * Color palette:
 *   Banner bg  : #1c2230  (deep navy-slate)
 *   Text       : #e8eaf0  (off-white)
 *   Accent     : #27ae60  (emerald — matches Bootstrap theme accent)
 *   Accent alt : #2ecc71  (lighter emerald for hover)
 *   Secondary  : #34495e  (muted blue-grey for reject button)
 *   Ghost      : transparent / outlined
 *   Overlay bg : rgba(0,0,0,0.45) for preferences backdrop
 */

/* ── Reset: scoped to our elements only ──────────────────────────────── */
.lb-consent-banner *,
.lb-consent-banner *::before,
.lb-consent-banner *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   BANNER WRAPPER
   Fixed to bottom of viewport; hidden by default (toggled via .hidden attr)
   ═══════════════════════════════════════════════════════════════════════ */
.lb-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background-color: #1c2230;
  color: #e8eaf0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
  max-height: 90vh;
  overflow-y: auto;

  /* Smooth slide-in from bottom */
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: translateY(0);
  opacity: 1;
}

/* When hidden via the [hidden] attribute */
.lb-consent-banner[hidden] {
  display: none !important;
}

/* ── Bottom bar (always-visible part of the banner) ─────────────────── */
.lb-consent-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  flex-wrap: wrap;
}

/* Privacy text */
.lb-consent-text {
  flex: 1 1 280px;
  color: #c8cdd8;
  font-size: 13px;
  min-width: 0;
}

.lb-consent-link {
  color: #2ecc71;
  text-decoration: underline;
}

.lb-consent-link:hover,
.lb-consent-link:focus {
  color: #58d68d;
  outline: none;
}

/* ── Button group ────────────────────────────────────────────────────── */
.lb-consent-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Buttons (base) ──────────────────────────────────────────────────── */
.lb-consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.lb-consent-btn:focus-visible {
  outline: 3px solid #2ecc71;
  outline-offset: 2px;
}

.lb-consent-btn:active {
  transform: scale(0.97);
}

/* Primary — Accept all */
.lb-consent-btn--primary {
  background-color: #27ae60;
  color: #ffffff;
  border-color: #27ae60;
}

.lb-consent-btn--primary:hover {
  background-color: #2ecc71;
  border-color: #2ecc71;
  color: #ffffff;
}

/* Secondary — Reject non-essential */
.lb-consent-btn--secondary {
  background-color: #34495e;
  color: #e8eaf0;
  border-color: #34495e;
}

.lb-consent-btn--secondary:hover {
  background-color: #3d566e;
  border-color: #3d566e;
  color: #ffffff;
}

/* Ghost — Manage preferences */
.lb-consent-btn--ghost {
  background-color: transparent;
  color: #c8cdd8;
  border-color: #4a5568;
}

.lb-consent-btn--ghost:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: #6b7a8d;
  color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════════════
   PREFERENCES PANEL
   Expanded panel shown above the bottom bar when Manage is clicked.
   ═══════════════════════════════════════════════════════════════════════ */
.lb-consent-prefs {
  padding: 20px 20px 0 20px;
  border-top: 1px solid #2a3347;
  background-color: #1c2230;
}

.lb-consent-prefs[hidden] {
  display: none !important;
}

.lb-consent-prefs-title {
  font-size: 16px;
  font-weight: 700;
  color: #e8eaf0;
  margin-bottom: 8px;
}

.lb-consent-prefs-intro {
  font-size: 13px;
  color: #9aa3b0;
  margin-bottom: 16px;
}

/* ── Individual preference row ───────────────────────────────────────── */
.lb-consent-pref-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #252e40;
}

.lb-consent-pref-row:last-of-type {
  border-bottom: none;
}

.lb-consent-pref-row--necessary {
  opacity: 0.75;
}

.lb-consent-pref-info {
  flex: 1 1 0;
  min-width: 0;
}

.lb-consent-pref-info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #e8eaf0;
  margin-bottom: 3px;
}

.lb-consent-pref-info p {
  font-size: 12px;
  color: #8892a0;
  line-height: 1.45;
}

/* "Always on" badge for necessary cookies */
.lb-consent-always-on {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  background-color: #27ae60;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}

/* ── Save button (inside prefs panel) ───────────────────────────────── */
.lb-consent-prefs .lb-consent-btn--primary {
  margin: 16px 0 20px 0;
  width: 100%;
  max-width: 260px;
  padding: 10px 20px;
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════
   TOGGLE SWITCH
   Custom CSS toggle — hides the checkbox, shows a styled slider.
   ═══════════════════════════════════════════════════════════════════════ */
.lb-consent-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  align-self: center;
  cursor: pointer;
}

/* Hide native checkbox visually but keep it accessible */
.lb-consent-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* The track */
.lb-consent-toggle-slider {
  position: absolute;
  inset: 0;
  background-color: #3a4557;
  border-radius: 24px;
  transition: background-color 0.2s ease;
}

/* The knob */
.lb-consent-toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background-color: #6b7a8d;
  border-radius: 50%;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

/* Checked state: move knob right, go green */
.lb-consent-toggle input[type="checkbox"]:checked + .lb-consent-toggle-slider {
  background-color: #27ae60;
}

.lb-consent-toggle input[type="checkbox"]:checked + .lb-consent-toggle-slider::before {
  transform: translateX(20px);
  background-color: #ffffff;
}

/* Unchecked knob color */
.lb-consent-toggle input[type="checkbox"]:not(:checked) + .lb-consent-toggle-slider::before {
  background-color: #8892a0;
}

/* Focus ring on keyboard navigation */
.lb-consent-toggle input[type="checkbox"]:focus-visible + .lb-consent-toggle-slider {
  outline: 3px solid #2ecc71;
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — stack buttons below 600px
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .lb-consent-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
  }

  .lb-consent-btn-group {
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }

  .lb-consent-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
  }

  .lb-consent-text {
    font-size: 12px;
  }

  .lb-consent-prefs {
    padding: 16px 14px 0 14px;
  }

  .lb-consent-prefs .lb-consent-btn--primary {
    max-width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   PREFERS-REDUCED-MOTION
   Disable all transitions and animations for users who prefer it.
   ═══════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .lb-consent-banner,
  .lb-consent-btn,
  .lb-consent-toggle-slider,
  .lb-consent-toggle-slider::before {
    transition: none !important;
    animation: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   PREFERS-COLOR-SCHEME: LIGHT
   Provide a readable light-mode variant if the OS/browser prefers it.
   The dark banner is intentional for the dark-themed site, but this
   softens it if the user has an explicit light preference.
   ═══════════════════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: light) {
  .lb-consent-banner {
    background-color: #f4f6f9;
    color: #1c2230;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  }

  .lb-consent-text {
    color: #3d4b5e;
  }

  .lb-consent-prefs {
    background-color: #f4f6f9;
    border-top-color: #dce2eb;
  }

  .lb-consent-prefs-title {
    color: #1c2230;
  }

  .lb-consent-prefs-intro {
    color: #5a6880;
  }

  .lb-consent-pref-row {
    border-bottom-color: #dce2eb;
  }

  .lb-consent-pref-info strong {
    color: #1c2230;
  }

  .lb-consent-pref-info p {
    color: #5a6880;
  }

  .lb-consent-btn--ghost {
    color: #3d4b5e;
    border-color: #9aa3b0;
  }

  .lb-consent-btn--ghost:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: #1c2230;
  }

  .lb-consent-btn--secondary {
    background-color: #dce2eb;
    border-color: #c0cad8;
    color: #1c2230;
  }

  .lb-consent-btn--secondary:hover {
    background-color: #c8d2e0;
  }

  .lb-consent-toggle-slider {
    background-color: #c0cad8;
  }

  .lb-consent-toggle input[type="checkbox"]:not(:checked) + .lb-consent-toggle-slider::before {
    background-color: #ffffff;
  }
}
