/* ════════════════════════════════════════════════════════
   SIDEBAR ACCORDION STYLES — with intro-active hiding
   ════════════════════════════════════════════════════════ */

/* ── HIDE burger + sidebar during intro ─────────────────────────────────── */
/* (Also enforced by intro.css, but belt-and-suspenders here) */
body.intro-active .burger-toggle,
body.intro-active #sceneList {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── SCENE LIST PANEL ────────────────────────────────────────────────────── */
#sceneList {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 300px;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(15px);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  margin: 0 !important;
  padding: 0 !important;
}

.mobile #sceneList {
  width: 100%;
}

#sceneList.enabled {
  transform: translateX(0) !important;
}

/* ── SIDEBAR LOGO HEADER ─────────────────────────────────────────────────── */
.sidebar-logo-container {
  width: 100%;
  padding: 5px 5px;
  background: linear-gradient(
    135deg,
    rgba(255, 107, 0, 0.8) 0%,
    rgba(230, 81, 0, 0.8) 100%
  );
  border-bottom: 2px solid rgba(255, 107, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  position: relative;
  box-sizing: border-box;
}

.sidebar-logo {
  max-width: 190px;
  max-height: 250px;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
  display: block;
}

.mobile .sidebar-logo-container {
  padding: 10px 12px;
  min-height: 80px;
}
.mobile .sidebar-logo {
  max-width: 230px;
  max-height: 60px;
}

/* ── CLOSE BUTTON ────────────────────────────────────────────────────────── */
.sidebar-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.25);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  color: #fff;
  font-size: 16px;
  padding: 0;
}

.sidebar-close-btn i {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.7);
  transform: rotate(90deg);
}

.mobile .sidebar-close-btn {
  width: 42px;
  height: 42px;
  top: 12px;
  right: 12px;
  font-size: 18px;
}

/* ── BURGER TOGGLE ───────────────────────────────────────────────────────── */
.burger-toggle {
  position: fixed;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 55px;
  height: 55px;
  background: linear-gradient(
    135deg,
    rgba(255, 107, 0, 1) 0%,
    rgba(230, 81, 0, 1) 100%
  );
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
}

.burger-toggle:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 133, 51, 0.85) 0%,
    rgba(255, 107, 0, 0.85) 100%
  );
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 6px 16px rgba(255, 107, 0, 0.4);
}

/* Pulling animation */
.burger-toggle.pulling {
  animation: pullBurgerIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pullBurgerIn {
  0% {
    transform: translateY(-50%) translateX(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-50%) translateX(-100px) scale(0.8);
    opacity: 0;
  }
}

/* Hide burger when sidebar is open */
.burger-toggle.active {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

/* Burger icon lines */
.burger-icon {
  width: 26px;
  height: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.burger-line {
  width: 100%;
  height: 3px;
  background-color: #fff;
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.burger-toggle.active .burger-line:nth-child(1) {
  transform: translateY(8.5px) rotate(45deg);
}
.burger-toggle.active .burger-line:nth-child(2) {
  opacity: 0;
}
.burger-toggle.active .burger-line:nth-child(3) {
  transform: translateY(-8.5px) rotate(-45deg);
}

/* ── SCENES LIST CONTAINER ───────────────────────────────────────────────── */
#sceneList .scenes {
  width: 100%;
  background-color: transparent;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 20px;
}

.mobile #sceneList .scenes {
  height: 100%;
}

/* ── ACCORDION CATEGORY ──────────────────────────────────────────────────── */
.accordion-category {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 54px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  color: #333;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.accordion-header::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(255, 107, 0, 0.8) 0%,
    rgba(230, 81, 0, 0.8) 100%
  );
  transform: scaleY(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-header.active::before,
.accordion-header:hover::before {
  transform: scaleY(1);
}

.mobile .accordion-header {
  height: 58px;
  font-size: 16px;
}

.accordion-header:hover {
  background: rgba(255, 107, 0, 0.1);
}
.accordion-header.active {
  background: rgba(255, 107, 0, 0.15);
  color: rgba(255, 107, 0, 0.9);
}

.accordion-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.accordion-icon {
  font-size: 18px;
  color: rgba(255, 107, 0, 0.8);
  filter: drop-shadow(0 1px 2px rgba(255, 107, 0, 0.2));
  transition: all 0.3s ease;
}

.accordion-header:hover .accordion-icon,
.accordion-header.active .accordion-icon {
  color: rgba(255, 133, 51, 0.9);
  transform: scale(1.1);
}

.accordion-arrow {
  font-size: 16px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: rgba(0, 0, 0, 0.4);
}

.accordion-header.active .accordion-arrow {
  transform: rotate(180deg);
  color: rgba(255, 107, 0, 0.8);
}

/* ── ACCORDION CONTENT ───────────────────────────────────────────────────── */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: rgba(255, 255, 255, 0.5);
}

.accordion-content.active {
  max-height: 2000px;
}

/* ── NESTED ACCORDION ────────────────────────────────────────────────────── */
.nested-accordion-parent {
  background-color: rgba(245, 245, 245, 0.6);
  padding: 0;
}

.nested-accordion-parent.active {
  max-height: 3000px;
}

.nested-accordion {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.nested-accordion:last-child {
  border-bottom: none;
}

.child-accordion {
  background: rgba(255, 255, 255, 0.4);
  padding-left: 35px;
  height: 48px;
  font-size: 14px;
}

.mobile .child-accordion {
  height: 52px;
  font-size: 15px;
  padding-left: 40px;
}

.child-accordion:hover {
  background: rgba(255, 107, 0, 0.08);
}
.child-accordion.active {
  background: rgba(255, 107, 0, 0.12);
}

.child-accordion .accordion-icon {
  font-size: 16px;
}
.child-accordion::before {
  width: 3px;
}

.parent-accordion {
  font-weight: 700;
}

/* Nested scene text indent */
.nested-accordion .accordion-content .scene {
  padding-left: 10px;
}
.nested-accordion .accordion-content .scene .text {
  padding-left: 55px;
  font-size: 13px;
}

.mobile .nested-accordion .accordion-content .scene .text {
  padding-left: 60px;
  font-size: 13.5px;
}

/* ── SCENE ITEMS ─────────────────────────────────────────────────────────── */
.accordion-content .scene {
  display: block;
  width: 100%;
  height: 44px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.mobile .accordion-content .scene {
  height: 50px;
}

.accordion-content .scene .text {
  width: 100%;
  height: 100%;
  padding: 0 20px 0 45px;
  line-height: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  color: rgba(0, 0, 0, 0.75);
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.mobile .accordion-content .scene .text {
  line-height: 50px;
  font-size: 14.5px;
}

.no-touch .accordion-content .scene:hover {
  background: linear-gradient(
    90deg,
    rgba(255, 107, 0, 0.15) 0%,
    rgba(230, 81, 0, 0.08) 100%
  );
}

.no-touch .accordion-content .scene:hover .text {
  padding-left: 45px;
  color: #333;
}

.accordion-content .scene.current {
  background: linear-gradient(
    90deg,
    rgba(255, 107, 0, 0.25) 0%,
    rgba(230, 81, 0, 0.15) 100%
  );
  border-left: 4px solid rgba(255, 107, 0, 0.8);
}

.accordion-content .scene.current .text {
  font-weight: 600;
  color: rgba(255, 107, 0, 0.9);
  padding-left: 41px;
}

.accordion-content .scene.current .text:before {
  content: "●";
  position: absolute;
  left: 25px;
  opacity: 1;
  color: rgba(255, 107, 0, 0.9);
  font-size: 12px;
}

/* ── SCROLLBAR ───────────────────────────────────────────────────────────── */
#sceneList::-webkit-scrollbar {
  width: 8px;
}
#sceneList::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}
#sceneList::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(255, 107, 0, 0.5) 0%,
    rgba(230, 81, 0, 0.5) 100%
  );
  border-radius: 4px;
}
#sceneList::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 107, 0, 0.7) 0%,
    rgba(230, 81, 0, 0.7) 100%
  );
}

/* ── MOBILE ADJUSTMENTS ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .burger-toggle {
    width: 52px;
    height: 52px;
    left: 12px;
  }
  .burger-icon {
    width: 24px;
    height: 18px;
  }
  .burger-line {
    height: 2.5px;
  }
}

/* No overlay — sidebar allows scene interaction */
.sidebar-overlay {
  display: none !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   SIDEBAR RESPONSIVE ADDITIONS — appended, no original lines changed
   ════════════════════════════════════════════════════════════════════════════ */

/* ── SMARTPHONE: full-width sidebar logo much bigger, accordion taller ─────
   The .mobile class (body.mobile) is set by JS at <=500px viewport.
   We also target @media <=600px so landscape phones and wider phones
   without the .mobile class also benefit.                                   */
@media (max-width: 600px) {
  /* Logo header — give it real estate on full-width mobile sidebar */
  .sidebar-logo-container {
    min-height: 130px;
    padding: 18px 52px 16px; /* horizontal padding reserves room for ✕ button */
    justify-content: center;
  }
  .sidebar-logo {
    max-width: 78%;
    max-height: none;
    width: 78%;
    height: auto;
  }

  /* Close button — bigger, clearly tappable */
  .sidebar-close-btn {
    width: 42px;
    height: 42px;
    top: 14px;
    right: 14px;
    font-size: 17px;
  }

  /* Parent accordion rows */
  .accordion-header {
    height: 60px;
    font-size: 16px;
    padding: 0 16px;
  }
  .accordion-icon {
    font-size: 20px;
  }
  .accordion-arrow {
    font-size: 17px;
  }

  /* Child accordion rows (nested streets) */
  .child-accordion {
    height: 54px;
    font-size: 15px;
    padding-left: 36px;
  }
  .child-accordion .accordion-icon {
    font-size: 16px;
  }

  /* Scene list items */
  .accordion-content .scene {
    height: 52px;
  }
  .accordion-content .scene .text {
    line-height: 52px;
    font-size: 14.5px;
    padding: 0 14px 0 46px;
  }
  .nested-accordion .accordion-content .scene .text {
    padding-left: 54px;
    font-size: 13.5px;
  }

  /* Thin scrollbar on phones */
  #sceneList::-webkit-scrollbar {
    width: 4px;
  }
}

/* ── Very small phones (<=375px) — tighten further ─── */
@media (max-width: 375px) {
  .sidebar-logo-container {
    min-height: 110px;
    padding: 14px 48px 12px;
  }
  .sidebar-logo {
    max-width: 72%;
    width: 72%;
  }
  .accordion-header {
    height: 56px;
    font-size: 15px;
  }
  .child-accordion {
    height: 50px;
    font-size: 14px;
  }
  .accordion-content .scene {
    height: 48px;
  }
  .accordion-content .scene .text {
    line-height: 48px;
    font-size: 13.5px;
  }
}

/* ── Tablet / iPad (601–1024px) sidebar — 300px wide, moderate sizing ─── */
@media (min-width: 601px) and (max-width: 1024px) {
  .sidebar-logo-container {
    min-height: 110px;
    padding: 14px 50px 12px;
  }
  .sidebar-logo {
    max-width: 200px;
    max-height: 260px;
  }
  .accordion-header {
    height: 56px;
    font-size: 15.5px;
  }
}
