/* === public_html/css/timeline.css === */
/* History of Kurds — Timeline Page Styles */

/* ─── Timeline Layout ─────────────────────────────────────────────── */
.timeline-page {
  padding-top: var(--navbar-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.timeline-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  min-height: calc(100vh - var(--navbar-height));
}

@media (max-width: 1024px) {
  .timeline-layout { grid-template-columns: 1fr; }
}

/* ─── Filter Sidebar ──────────────────────────────────────────────── */
.timeline-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  padding: var(--space-xl);
  overflow-y: auto;
  position: sticky;
  top: var(--navbar-height);
  height: calc(100vh - var(--navbar-height));
}

[dir="rtl"] .timeline-sidebar {
  border-right: none;
  border-left: 1px solid var(--border-light);
}

@media (max-width: 1024px) {
  .timeline-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }
}

.sidebar-section {
  margin-bottom: var(--space-xl);
}

.sidebar-title {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

/* Period filter buttons */
.period-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-xs);
}

[dir="rtl"] .period-btn { text-align: right; }

.period-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.period-btn.active {
  background: var(--bg-card);
  border-color: var(--border-medium);
  color: var(--text-primary);
  font-weight: 600;
}

/* Category checkboxes */
.category-check {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-secondary);
  user-select: none;
}

.category-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-kurdish-green);
  cursor: pointer;
  flex-shrink: 0;
}

.cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-dot-political  { background: var(--color-kurdish-red); }
.cat-dot-cultural   { background: #6B46C1; }
.cat-dot-religious  { background: var(--color-kurdish-yellow); }
.cat-dot-military   { background: #4B5563; }
.cat-dot-modern     { background: var(--color-kurdish-green); }

/* Importance slider */
.importance-slider {
  width: 100%;
  accent-color: var(--color-kurdish-green);
  margin-top: var(--space-sm);
}

.importance-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-xs);
}

.importance-stars {
  color: var(--color-kurdish-yellow);
  font-size: 0.8rem;
}

/* Compare toggle */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.toggle-label {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-medium);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.toggle-track::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
}

.toggle input:checked + .toggle-track { background: var(--color-kurdish-green); }
.toggle input:checked + .toggle-track::before { transform: translateX(18px); }

/* ─── Timeline Main Area ──────────────────────────────────────────── */
.timeline-main {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.timeline-header {
  padding: var(--space-xl) var(--space-xl) var(--space-md);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
}

.timeline-header h1 {
  font-size: 1.5rem;
}

.timeline-meta {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-sm);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* D3 SVG container */
#timeline-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 500px;
}

#timeline-svg {
  width: 100%;
  height: 100%;
  cursor: grab;
}

#timeline-svg:active { cursor: grabbing; }

/* Zoom controls */
.timeline-zoom-controls {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  z-index: var(--z-raised);
}

[dir="rtl"] .timeline-zoom-controls { right: auto; left: var(--space-md); }

.zoom-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.zoom-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ─── D3 Timeline Elements ────────────────────────────────────────── */
.timeline-axis line,
.timeline-axis path {
  stroke: var(--border-medium);
}

.timeline-axis text {
  fill: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 11px;
}

.timeline-event-dot {
  cursor: pointer;
  transition: r 0.15s ease, opacity 0.15s ease;
}

.timeline-event-dot:hover {
  opacity: 0.85;
}

.timeline-event-label {
  font-family: var(--font-ui);
  font-size: 11px;
  fill: var(--text-secondary);
  pointer-events: none;
}

.timeline-era-label {
  font-family: var(--font-display);
  font-size: 13px;
  fill: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.timeline-era-band {
  opacity: 0.04;
}

/* ─── Tooltip ─────────────────────────────────────────────────────── */
#timeline-tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-md) var(--space-lg);
  max-width: 300px;
  z-index: var(--z-overlay);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

#timeline-tooltip.visible { opacity: 1; }

.tooltip-year {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-kurdish-red);
  margin-bottom: var(--space-xs);
}

.tooltip-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  line-height: 1.3;
}

.tooltip-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
}

.tooltip-category {
  font-size: 0.75rem;
}

.tooltip-importance {
  color: var(--color-kurdish-yellow);
  font-size: 0.75rem;
  margin-top: var(--space-xs);
}

/* ─── Event Detail Panel ──────────────────────────────────────────── */
#event-detail-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 360px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--transition-base);
  z-index: var(--z-raised);
}

[dir="rtl"] #event-detail-panel {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid var(--border-light);
  transform: translateX(-100%);
}

#event-detail-panel.open {
  transform: translateX(0);
}

.event-detail-header {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1;
}

.event-detail-content { padding: var(--space-lg); }

.event-detail-year {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--color-kurdish-red);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.event-detail-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: var(--space-md);
}

.event-detail-image {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  aspect-ratio: 16/9;
  object-fit: cover;
}

.event-detail-desc {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.event-detail-sources h4 {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.source-item {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.4;
}

/* ─── Accessible Table View ───────────────────────────────────────── */
#timeline-table-view {
  display: none;
  padding: var(--space-xl);
}

#timeline-table-view.visible { display: block; }

.timeline-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.timeline-table th {
  text-align: left;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 2px solid var(--border-medium);
}

[dir="rtl"] .timeline-table th { text-align: right; }

.timeline-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: top;
}

.timeline-table tr:hover td { background: var(--bg-secondary); }

/* View toggle */
.view-toggle {
  display: flex;
  gap: var(--space-xs);
  margin-left: auto;
}

[dir="rtl"] .view-toggle { margin-left: 0; margin-right: auto; }

.view-toggle-btn {
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-ui);
  transition: all var(--transition-fast);
}

.view-toggle-btn.active {
  background: var(--color-kurdish-green);
  color: white;
  border-color: var(--color-kurdish-green);
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #event-detail-panel {
    width: 100%;
    top: auto;
    height: 60vh;
    border-left: none;
    border-top: 1px solid var(--border-light);
    transform: translateY(100%);
  }

  [dir="rtl"] #event-detail-panel {
    border-right: none;
    transform: translateY(100%);
  }

  #event-detail-panel.open { transform: translateY(0); }
}
