/* ========================================
   ÖZBEKISTAN EVLİYALARI - MAIN STYLESHEET
   ======================================== */

:root {
  /* Project-specific accent colors (dark mode defaults) */
  --primary: #1a4a5e;
  --primary-light: #2a6a82;
  --gold: #c8963e;
  --gold-light: #ddb76a;
  --cream: #18181f;
  --cream-dark: #222230;
  --green: #2d6b4f;
  --green-light: #3d8b6f;
  --red: #8b2500;
  --text-light: #9999b0;
  --shadow: var(--shadow-md);
  --radius: 12px;
  --font-serif: 'Amiri', serif;
  --font-sans: 'Noto Sans', sans-serif;
  --header-h: 64px;
  --header-bg: rgba(10,10,15,0.95);
}

html.light {
  --primary: #1a4a5e;
  --primary-light: #2a6a82;
  --gold: #c8963e;
  --gold-light: #ddb76a;
  --cream: #f5f0e8;
  --cream-dark: #e8e0d0;
  --green: #2d6b4f;
  --green-light: #3d8b6f;
  --red: #8b2500;
  --text-light: #5a4d3a;
  --shadow: 0 4px 20px rgba(0,0,0,0.12);
  --header-bg: rgba(26,74,94,0.95);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

/* ========== HEADER ========== */
#main-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  height: var(--header-h);
  transition: background 0.3s;
}

.header-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; padding: 0 24px;
}

.logo-area {
  display: flex; align-items: center; gap: 12px;
}

.logo-icon {
  font-size: 28px; color: var(--gold);
}

.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-title { color: var(--gold); font-family: var(--font-serif); font-size: 16px; font-weight: 700; }
.logo-subtitle { color: rgba(255,255,255,0.7); font-size: 11px; }

nav { display: flex; gap: 4px; }
nav a {
  color: rgba(255,255,255,0.8); text-decoration: none;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  transition: all 0.2s;
}
nav a:hover { color: #fff; background: rgba(255,255,255,0.1); }

.header-controls { display: flex; align-items: center; gap: 12px; }

.search-box { position: relative; }
.search-box input {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff; padding: 8px 16px;
  border-radius: 20px; font-size: 13px; width: 200px;
  outline: none; transition: all 0.3s;
}
.search-box input::placeholder { color: rgba(255,255,255,0.5); }
.search-box input:focus {
  background: rgba(255,255,255,0.2);
  border-color: var(--gold);
  width: 260px;
}

.search-results {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 300px; overflow-y: auto;
  display: none; z-index: 100;
}
.search-results.active { display: block; }
.search-result-item {
  padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text);
}
.search-result-item:hover { background: var(--surface-hover); }
.search-result-item .result-city { font-size: 11px; color: var(--text-light); }

.lang-btn {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.3);
  color: var(--gold); padding: 6px 14px; border-radius: 20px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all 0.2s;
}
.lang-btn:hover { background: var(--gold); color: var(--primary); }

.mobile-menu-btn {
  display: none; background: none; border: none;
  color: #fff; font-size: 24px; cursor: pointer;
}

/* ========== HERO ========== */
#hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0f2b3d 0%, #1a4a5e 30%, #2d6b4f 70%, #1a4a5e 100%);
}

.hero-overlay {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(200,150,62,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 30%, rgba(45,107,79,0.2) 0%, transparent 50%);
}

.hero-pattern {
  position: absolute; inset: 0; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 0L80 40L40 80L0 40Z' fill='none' stroke='%23fff' stroke-width='0.5'/%3E%3Ccircle cx='40' cy='40' r='15' fill='none' stroke='%23fff' stroke-width='0.5'/%3E%3C/svg%3E");
}

.hero-content {
  position: relative; z-index: 2;
  text-align: center; padding: 0 24px;
  max-width: 800px;
}

.hero-badge {
  display: inline-block;
  background: rgba(200,150,62,0.2); border: 1px solid rgba(200,150,62,0.4);
  padding: 6px 20px; border-radius: 20px;
  color: var(--gold-light); font-size: 13px; font-weight: 500;
  margin-bottom: 24px; letter-spacing: 0.5px;
}

#hero h1 { margin-bottom: 24px; }

.hero-line1 {
  display: block; font-family: var(--font-sans);
  font-size: 20px; font-weight: 300; color: rgba(255,255,255,0.8);
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 8px;
}

.hero-line2 {
  display: block; font-family: var(--font-serif);
  font-size: clamp(36px, 6vw, 64px); font-weight: 700;
  color: #fff; line-height: 1.1;
  background: linear-gradient(135deg, #fff 0%, var(--gold-light) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 16px; color: rgba(255,255,255,0.7);
  max-width: 600px; margin: 0 auto 40px; line-height: 1.8;
}

.hero-stats {
  display: flex; justify-content: center; gap: 48px;
  margin-bottom: 48px;
}

.stat { text-align: center; }
.stat-num {
  display: block; font-family: var(--font-serif);
  font-size: 42px; font-weight: 700; color: var(--gold);
  line-height: 1;
}
.stat-label { font-size: 13px; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 1px; }

.hero-cta {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--primary); padding: 14px 40px;
  border-radius: 30px; font-size: 16px; font-weight: 700;
  text-decoration: none; text-transform: uppercase; letter-spacing: 1px;
  transition: all 0.3s; box-shadow: 0 4px 20px rgba(200,150,62,0.4);
}
.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(200,150,62,0.5);
}

.scroll-indicator {
  position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
}
.scroll-arrow {
  width: 24px; height: 24px; border-right: 2px solid rgba(255,255,255,0.4);
  border-bottom: 2px solid rgba(255,255,255,0.4);
  transform: rotate(45deg);
  animation: scrollBounce 2s infinite;
}
@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.4; }
  50% { transform: rotate(45deg) translateY(8px); opacity: 1; }
}

/* ========== SECTIONS COMMON ========== */
section { padding: 80px 24px; }

.section-header {
  text-align: center; margin-bottom: 48px;
}
.section-header h2 {
  font-family: var(--font-serif); font-size: clamp(28px, 4vw, 40px);
  color: var(--primary); margin-bottom: 12px;
}
.section-header p {
  font-size: 15px; color: var(--text-light); max-width: 600px; margin: 0 auto;
}

/* ========== MAP SECTION ========== */
#map-section {
  background: var(--surface);
  padding-bottom: 40px;
}

.map-container {
  max-width: 1400px; margin: 0 auto;
  display: flex; gap: 0;
  height: 600px; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  position: relative;
}

#map {
  flex: 1; min-height: 600px; height: 600px;
  z-index: 1;
}

.city-panel {
  width: 380px; background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto; padding: 24px;
  transition: transform 0.4s ease;
  z-index: 2;
}
.city-panel.hidden {
  transform: translateX(100%);
  position: absolute; right: 0; top: 0; bottom: 0;
}

.panel-close {
  float: right; background: none; border: none;
  font-size: 28px; color: var(--text-light); cursor: pointer;
  line-height: 1;
}
.panel-close:hover { color: var(--text); }

#panel-city-name {
  font-family: var(--font-serif); font-size: 24px;
  color: var(--primary); margin-bottom: 4px;
}
#panel-city-count {
  font-size: 13px; color: var(--text-light); margin-bottom: 16px;
}

.filter-chips { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.chip {
  padding: 5px 14px; border-radius: 16px; font-size: 12px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-light); cursor: pointer; transition: all 0.2s;
}
.chip.active, .chip:hover {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

.panel-scholars { display: flex; flex-direction: column; gap: 8px; }

.scholar-card {
  padding: 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2);
}
.scholar-card:hover {
  border-color: var(--gold); background: rgba(200,150,62,0.05);
  transform: translateX(4px);
}

.scholar-card .card-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--green));
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-family: var(--font-serif);
  font-size: 18px; font-weight: 700; flex-shrink: 0;
}

.scholar-card .card-info { flex: 1; min-width: 0; }
.scholar-card .card-name {
  font-size: 14px; font-weight: 600; color: var(--primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scholar-card .card-meta {
  font-size: 11px; color: var(--text-light);
}
.scholar-card .card-cats {
  display: flex; gap: 4px; margin-top: 4px;
}
.scholar-card .cat-tag {
  font-size: 10px; padding: 1px 8px; border-radius: 10px;
  background: var(--surface2); color: var(--text-light);
}

/* ========== TIMELINE ========== */
#timeline-section {
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 100%);
}

.timeline-filters {
  display: flex; justify-content: center; gap: 8px; margin-bottom: 32px;
}
.era-btn {
  padding: 8px 20px; border-radius: 20px; font-size: 13px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-light); cursor: pointer; transition: all 0.2s;
}
.era-btn.active, .era-btn:hover {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

.timeline-wrapper {
  max-width: 900px; margin: 0 auto;
  padding-bottom: 20px;
}

.timeline {
  display: flex; flex-direction: column; align-items: stretch;
  padding: 0 24px;
  position: relative;
}

.timeline::before {
  content: ''; position: absolute;
  top: 0; bottom: 0; left: 48px;
  width: 3px; background: linear-gradient(180deg, var(--gold), var(--primary), var(--gold));
  border-radius: 2px;
}

.century-group {
  display: flex; align-items: flex-start;
  position: relative; padding: 16px 0 16px 80px;
  min-height: 60px;
}

.century-label {
  background: var(--primary); color: var(--gold);
  padding: 4px 14px; border-radius: 12px;
  font-size: 12px; font-weight: 700;
  position: absolute; left: 0; top: 16px;
  z-index: 2; white-space: nowrap;
  width: 64px; text-align: center;
}

.century-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--gold); border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--gold);
  position: absolute; left: 42px; top: 20px;
  z-index: 2;
}

.century-scholars {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: flex-start;
}

.tl-scholar {
  background: var(--surface); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer; text-align: left;
  transition: all 0.2s;
}
.tl-scholar:hover {
  border-color: var(--gold); transform: translateX(4px);
  box-shadow: var(--shadow);
}
.tl-scholar .tl-name { font-weight: 600; color: var(--primary); }
.tl-scholar .tl-date { color: var(--text-light); font-size: 10px; }

/* ========== SILSILE ========== */
#silsile-section {
  background: var(--surface);
}

.silsile-wrapper {
  max-width: 1000px; margin: 0 auto;
  overflow-x: auto; padding-bottom: 20px;
}

.silsile {
  display: flex; flex-direction: column; align-items: center;
  gap: 0; padding: 20px;
}

.silsile-node {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; padding: 12px 28px;
  border-radius: var(--radius); text-align: center;
  cursor: pointer; transition: all 0.3s;
  min-width: 220px; position: relative;
  box-shadow: var(--shadow);
}
.silsile-node:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}
.silsile-node .sn-name {
  font-family: var(--font-serif); font-size: 15px; font-weight: 700;
}
.silsile-node .sn-date {
  font-size: 11px; opacity: 0.7;
}

.silsile-node.golden {
  background: linear-gradient(135deg, var(--gold), #b8862e);
  color: var(--primary);
}

.silsile-connector {
  width: 2px; height: 32px;
  background: var(--gold); margin: 0 auto;
}
.silsile-connector::after {
  content: ''; display: block;
  width: 8px; height: 8px;
  background: var(--gold); border-radius: 50%;
  margin: -4px 0 0 -3px;
}

/* ========== ABOUT ========== */
#about-section {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.about-content {
  max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 320px; gap: 40px;
}

.about-text {
  font-family: var(--font-serif);
  font-size: 15px; line-height: 2;
  color: var(--text); text-align: justify;
  max-height: 400px; overflow-y: auto;
  padding-right: 16px;
}
.about-text p {
  margin-bottom: 0.8em;
  text-indent: 1.5em;
}
.about-text p:first-child {
  text-indent: 0;
}

.about-info { display: flex; flex-direction: column; gap: 16px; }

.info-card {
  padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.info-card h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--gold); margin-bottom: 8px;
}
.info-card p { font-size: 14px; color: var(--text); }
.info-card .info-sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ========== FOOTER ========== */
footer {
  background: var(--primary); padding: 32px 24px; text-align: center;
}
.footer-inner p { color: var(--gold); font-family: var(--font-serif); font-size: 16px; }
.footer-inner .footer-sub { color: rgba(255,255,255,0.5); font-size: 12px; margin-top: 4px; font-family: var(--font-sans); }

/* ========== MODAL ========== */
.modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative; z-index: 1;
  background: var(--surface); border-radius: var(--radius);
  max-width: 700px; width: 100%; max-height: 85vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 28px;
  color: var(--text-light); cursor: pointer; z-index: 10;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-header {
  padding: 32px 32px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(26,74,94,0.08), rgba(200,150,62,0.08));
}

.modal-city-badge {
  display: inline-block; padding: 3px 12px;
  background: var(--primary); color: var(--gold);
  border-radius: 12px; font-size: 11px; font-weight: 600;
  margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}

.modal-header h2 {
  font-family: var(--font-serif); font-size: 28px;
  color: var(--primary); margin-bottom: 8px; line-height: 1.3;
}

.modal-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.meta-death {
  font-size: 13px; color: var(--text-light);
  background: var(--surface2); padding: 2px 10px; border-radius: 10px;
}
.meta-cats { display: flex; gap: 6px; }
.meta-cats .cat-badge {
  font-size: 11px; padding: 2px 10px; border-radius: 10px;
  background: rgba(45,107,79,0.1); color: var(--green);
}

.modal-body { padding: 24px 32px 32px; }

.modal-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.tab {
  padding: 10px 20px; border: none; background: none;
  font-size: 14px; font-weight: 600; color: var(--text-light);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.2s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--gold); }
.tab:hover { color: var(--primary); }

.tab-content {
  display: none;
  font-family: var(--font-serif); font-size: 15px;
  line-height: 2; color: var(--text);
  text-align: justify;
}
.tab-content p {
  margin-bottom: 0.8em;
  text-indent: 1.5em;
}
.tab-content p:first-child {
  text-indent: 0;
}
.tab-content.active { display: block; }

.no-content {
  text-align: center; padding: 40px;
  color: var(--text-light); font-style: italic;
}

/* ========== LEAFLET CUSTOM ========== */
.city-marker {
  background: none; border: none;
}
.marker-inner {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--green));
  border: 3px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-family: var(--font-serif);
  font-size: 18px; font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: all 0.3s; cursor: pointer;
  position: relative;
}
.marker-inner:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 24px rgba(200,150,62,0.5);
}
.marker-inner::after {
  content: ''; position: absolute;
  inset: -6px; border-radius: 50%;
  border: 2px solid rgba(200,150,62,0.3);
  animation: markerPulse 2s infinite;
}
@keyframes markerPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 0; }
}

.marker-label {
  position: absolute; top: -28px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: var(--gold);
  padding: 2px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  font-family: var(--font-sans);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow) !important;
}
.leaflet-popup-content {
  font-family: var(--font-sans) !important;
  font-size: 13px !important;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .map-container { flex-direction: column; height: auto; }
  #map { height: 400px; }
  .city-panel {
    width: 100%; position: relative; transform: none;
    max-height: 400px;
  }
  .city-panel.hidden { display: none; }
}

@media (max-width: 768px) {
  nav { display: none; }
  .mobile-menu-btn { display: block; }

  nav.open {
    display: flex; flex-direction: column;
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--header-bg); padding: 16px;
    box-shadow: var(--shadow);
  }

  .search-box input { width: 140px; }
  .search-box input:focus { width: 180px; }

  .hero-stats { gap: 24px; }
  .stat-num { font-size: 32px; }

  section { padding: 48px 16px; }

  .about-content { grid-template-columns: 1fr; }

  .modal-header { padding: 24px 20px 16px; }
  .modal-header h2 { font-size: 22px; }
  .modal-body { padding: 16px 20px 24px; }

  .timeline-wrapper { margin: 0 -16px; padding: 0 16px 20px; }
}

@media (max-width: 480px) {
  .hero-line2 { font-size: 28px; }
  .hero-desc { font-size: 14px; }
  .hero-stats { flex-direction: column; gap: 16px; }
}

/* ========== ANIMATIONS ========== */
.fade-in {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
