/* Shared "sidebar widget" used by the Tədbirlər (Activities) and Maddələr
 * (Charter) navigation panels. Values mirror the Tədbirlər widget on
 * az/activities.html so the two panels are visually identical.
 *
 * Markup contract:
 *
 *   <aside class="sidebar">
 *     <div class="sidebar-widget">
 *       <div class="widget-head">
 *         <span>📅 Tədbirlər</span>
 *         <button class="events-menu-toggle" type="button"
 *                 aria-controls="widgetMenuId" aria-expanded="false"
 *                 aria-label="Menyunu aç">
 *           <span></span><span></span><span></span>
 *         </button>
 *       </div>
 *       <div class="widget-body">
 *         <ul class="timeline-list" id="widgetMenuId">
 *           <li><span class="tl-date">04.2026</span><a href="#anchor">Item</a></li>
 *           ...
 *         </ul>
 *       </div>
 *     </div>
 *   </aside>
 */

/* Neutralise the legacy chrome on the charter's `.toc-card` wrapper so the
 * inner `.sidebar-widget` provides the entire visible surface. */
.charter-sidebar.toc-card {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
  max-height: none !important;
}

.charter-sidebar > .sidebar-widget {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--daab-nav-height, 86px) - 120px);
}

.charter-sidebar > .sidebar-widget > .widget-body {
  flex: 1 1 auto;
  min-height: 0;
}

/* Card */
.sidebar-widget {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--color-border-blue-faint);
  border-radius: 14px;
  box-shadow: 0 14px 28px rgba(0, 45, 82, .10);
  overflow: hidden;
}

/* Header — matches Tədbirlər exactly */
.widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--ink) 0%, var(--blue-dark) 58%, #2e9fd4 100%);
  border-bottom: 2px solid #f0c75e;
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .01em;
}

.widget-head > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Body + scrollbar */
.widget-body {
  padding: 16px 20px;
  max-height: calc(15 * 41px + 32px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2e9fd4 #e8eef5;
}

.widget-body::-webkit-scrollbar { width: 6px; }
.widget-body::-webkit-scrollbar-track { background: #e8eef5; border-radius: 3px; }
.widget-body::-webkit-scrollbar-thumb { background: #2e9fd4; border-radius: 3px; }
.widget-body::-webkit-scrollbar-thumb:hover { background: #1a6fa8; }

/* List rows */
.timeline-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-list li {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 45, 82, .08);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.3;
  color: var(--muted-hero);
  transition: color .18s;
}

.timeline-list li:last-child {
  border-bottom: none;
}

.timeline-list li:hover {
  color: var(--blue-700, var(--blue-700));
}

.timeline-list .tl-date {
  flex-shrink: 0;
  padding-top: 2px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

/* Links — no underline anywhere */
.timeline-list a,
.timeline-list a:link,
.timeline-list a:visited {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  margin: -2px -6px;
  padding: 2px 6px;
  color: inherit;
  background: transparent;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none !important;
  text-decoration-thickness: 0 !important;
  transition: background-color .15s ease, color .15s ease;
}

.timeline-list a:hover,
.timeline-list a:focus-visible,
.timeline-list a.tl-active {
  color: var(--blue-700, var(--blue-700)) !important;
  background: var(--soft) !important;
  text-decoration: none !important;
}

.timeline-list a.tl-active {
  font-weight: 700;
}

.timeline-list li:has(a.tl-active) .tl-date {
  color: var(--blue-700, var(--blue-700));
}

/* Mobile-collapse toggle — visible only at narrow widths. */
.events-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 32px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 8px;
  cursor: pointer;
}

.events-menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--white);
  border-radius: var(--radius-pill);
}

@media (max-width: 1060px) {
  .events-menu-toggle {
    display: inline-flex;
  }

  .sidebar-widget .widget-body {
    max-height: 0;
    padding: 0 20px;
    overflow: hidden;
    transition: max-height .28s ease, padding .28s ease;
  }

  .sidebar-widget.events-open .widget-body {
    max-height: min(70vh, 560px);
    padding: 16px 20px;
    overflow: auto;
  }
}

@media (max-width: 720px) {
  .widget-head {
    padding: 12px 16px;
    font-size: 16px;
  }

  .timeline-list li {
    gap: 10px;
    font-size: 14px;
  }

  .timeline-list a {
    min-height: 36px;
    line-height: 1.35;
    padding: 6px 8px;
    margin: -6px -8px;
  }
}
