/* ========================================
   Sidebar Navigation for Anglican Heritage
   Add this file to your child theme folder
   ======================================== */

/* Toggle Button (appears in header) */
.sidebar-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10000;
  background: #2c3e50;
  color: #fff;
  border: none;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-toggle:hover {
  background: #1a252f;
}

.sidebar-toggle .icon-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
}

.sidebar-toggle .icon-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Sidebar Panel */
.sidebar-nav-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: #faf9f7;
  border-left: 1px solid #ddd;
  z-index: 9999;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  padding: 60px 0 30px 0;
  box-shadow: -2px 0 12px rgba(0,0,0,0.1);
}

.sidebar-nav-panel.open {
  transform: translateX(0);
}

/* Overlay behind sidebar */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Close button inside sidebar */
.sidebar-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 4px 10px;
  line-height: 1;
}

.sidebar-close:hover {
  color: #333;
}

/* Menu Items */
.sidebar-nav-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Top-level items (39 Articles, Homilies, Creeds) */
.sidebar-nav-panel > ul > li > a,
.sidebar-nav-panel > ul > li > .submenu-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  text-decoration: none;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.sidebar-nav-panel > ul > li > a:hover,
.sidebar-nav-panel > ul > li > .submenu-toggle:hover {
  background: #f0eeeb;
}

/* Arrow indicator for expandable items */
.submenu-toggle .arrow {
  font-size: 12px;
  transition: transform 0.2s ease;
  color: #999;
}

.submenu-toggle.expanded .arrow {
  transform: rotate(90deg);
}

/* Second-level sub-menu (e.g. Book 1, Book 2) */
.sidebar-nav-panel .sub-menu {
  display: none;
  background: #f5f4f1;
  border-bottom: 1px solid #eee;
}

.sidebar-nav-panel .sub-menu.open {
  display: block;
}

.sidebar-nav-panel .sub-menu > li > a,
.sidebar-nav-panel .sub-menu > li > .submenu-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 10px 32px;
  font-size: 16px;
  font-weight: 500;
  color: #444;
  text-decoration: none;
  border-bottom: 1px solid #ebe9e6;
  cursor: pointer;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  line-height: 1.4;
}

.sidebar-nav-panel .sub-menu > li > a:hover,
.sidebar-nav-panel .sub-menu > li > .submenu-toggle:hover {
  background: #ebe9e6;
  color: #2c3e50;
}

.sidebar-nav-panel .sub-menu > li:last-child > a {
  border-bottom: none;
}

/* Third-level sub-menu (e.g. individual homilies under Book 1) */
.sidebar-nav-panel .sub-menu-deep {
  background: #f0eeeb;
}

.sidebar-nav-panel .sub-menu-deep > li > a {
  display: block;
  padding: 8px 20px 8px 48px;
  font-size: 14px;
  font-weight: 400;
  color: #555;
  text-decoration: none;
  border-bottom: 1px solid #e5e3e0;
  line-height: 1.4;
}

.sidebar-nav-panel .sub-menu-deep > li > a:hover {
  background: #e5e3e0;
  color: #2c3e50;
}

.sidebar-nav-panel .sub-menu-deep > li:last-child > a {
  border-bottom: none;
}

/* --- Current/active page highlight --- */
.sidebar-nav-panel a.active,
.sidebar-nav-panel .sub-menu > li > a.active,
.sidebar-nav-panel .sub-menu-deep > li > a.active {
  background: #d4cec6 !important;
  color: #1a1a1a !important;
  font-weight: 700 !important;
  border-left: 4px solid #2c3e50 !important;
}

.sidebar-nav-panel .sub-menu > li > a.active {
  padding-left: 28px;
}

.sidebar-nav-panel .sub-menu-deep > li > a.active {
  padding-left: 44px;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .sidebar-nav-panel {
    width: 280px;
  }

  .sidebar-toggle {
    padding: 8px 12px;
    font-size: 14px;
  }
}

/* Hide Astra's default primary navigation if desired */
/* Uncomment these lines once you're happy with the sidebar: */
/*
.main-header-menu {
  display: none !important;
}
*/
