* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
}

/* ── Nav ── */
.nav-primary {
  background: linear-gradient(to right, #7a1a1a, #c85a00, #e08000);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
}

.nav-logo {
  height: 36px;
  width: auto;
  display: block;
}


.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
  padding-left: 100px;
}

.nav-links a {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a:hover { text-decoration: underline; }

.btn-admin {
  background: transparent;
  border: 1px solid rgba(180,180,180,0.4);
  color: #fff;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}

.nav-secondary {
  background: #1a1a1a;
  color: #ccc;
  font-size: 0.85rem;
  padding: 8px 24px;
}

/* ── Layout ── */
.page-body {
  display: flex;
  min-height: calc(100vh - 84px);
  padding-top: 10px;
}

/* ── Sidebar ── */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  padding: 16px;
  position: relative;
  transition: width 0.22s ease;
  overflow: hidden;
}
.sidebar-collapsed .sidebar {
  width: 0;
  padding: 0;
  border-right: none;
}
.sidebar-toggle {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  left: 250px;
  z-index: 500;
  width: 20px;
  height: 48px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-left: none;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #888;
  transition: left 0.22s ease;
  box-shadow: 2px 0 6px rgba(0,0,0,0.06);
  padding: 0;
  line-height: 1;
}
.sidebar-toggle:hover { color: #333; background: #f9f9f9; }
.sidebar-collapsed .sidebar-toggle { left: 0; }

.sidebar-logo-wrap {
  margin: -16px -16px 16px -16px;
  padding: 14px 15px;
  border-bottom: 1px solid #e8e8e4;
}

/* Logo-only bar on toolkit, knowledge hub, and map sidebar */
.page-logo-bar {
  background: #fff;
  padding: 14px 15px;
  border-bottom: 1px solid #eeede9;
}
.page-logo {
  height: 98px;
  width: auto;
  display: block;
  margin: 0 15px;
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 20px;
  outline: none;
}

.search-input:focus { border-color: #aaa; }

.filter-group {
  border-bottom: 1px solid #eee;
  padding: 12px 0;
}

.filter-group:last-child { border-bottom: none; }

.filter-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.filter-arrow {
  font-size: 0.7rem;
  color: #888;
  transition: transform 0.2s;
}
.filter-group.open > .filter-label .filter-arrow { transform: rotate(180deg); }
.filter-group.has-active > .filter-label { color: #c85a00; }

.filter-options {
  display: none;
  padding: 4px 0 6px;
}
.filter-group.open .filter-options { display: block; }

.filter-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 2px;
  font-size: 0.82rem;
  color: #444;
  cursor: pointer;
  user-select: none;
}
.filter-options label:hover { color: #111; }
.filter-options input[type="checkbox"] {
  cursor: pointer;
  accent-color: #c85a00;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Main content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#map {
  width: 100%;
  height: 500px;
  flex-shrink: 0;
}

.map-reset-btn {
  background: #fff;
  border: 2px solid rgba(0,0,0,0.25);
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
  display: block;
}
.map-reset-btn:hover { background: #f4f4f4; }

/* ── Map toggle ── */
#map {
  transition: height 0.3s ease;
}

/* ── Projects ── */
.projects-section {
  padding: 24px;
}

.projects-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.projects-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
}

.projects-title span {
  color: #888;
  font-weight: 400;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-btn {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.view-btn:hover { border-color: #aaa; color: #222; }
.view-btn.active { background: #1a1a1a; border-color: #1a1a1a; color: #fff; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ── List view ── */
.projects-grid.list-view {
  grid-template-columns: 1fr;
  gap: 8px;
}
.projects-grid.list-view .project-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}
.projects-grid.list-view .card-image {
  width: 90px;
  height: auto;
  min-height: 70px;
  flex-shrink: 0;
  border-radius: 0;
}
.projects-grid.list-view .card-body {
  padding: 10px 12px;
}
.projects-grid.list-view .card-desc {
  display: none;
}

/* ── Project card ── */
.project-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.card-image {
  width: 100%;
  height: 140px;
  background: #ccc;
  object-fit: cover;
}

.card-body {
  padding: 12px 14px 16px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid;
}

.tag-solar      { color: #b07506; border-color: #b07506; }
.tag-wind       { color: #3b68a8; border-color: #3b68a8; }
.tag-hydro      { color: #068088; border-color: #068088; }
.tag-biomass    { color: #597c39; border-color: #597c39; }
.tag-geothermal { color: #9c4420; border-color: #9c4420; }
.tag-storage    { color: #5e3da8; border-color: #5e3da8; }
.tag-mixed      { color: #444;    border-color: #888; }

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.card-nation {
  font-size: 0.8rem;
  color: #555;
  margin-bottom: 6px;
}

.card-meta {
  font-size: 0.78rem;
  color: #777;
  margin-bottom: 4px;
}

.card-desc {
  font-size: 0.78rem;
  color: #555;
  margin-bottom: 10px;
}

.card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-size: 0.7rem;
  background: #f0f0f0;
  color: #444;
  padding: 2px 10px;
  border-radius: 20px;
}


/* ── Cluster icon ── */
.cluster-icon {
  width: 36px;
  height: 36px;
  background: #1a1a1a;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.35);
}

/* ── Pin tooltip ── */
.pin-tooltip {
  background: rgba(26,26,26,0.82);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 9px;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.pin-tooltip::before { display: none; }

/* ── Leaflet popup card override ── */
.leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: 8px !important;
  overflow: hidden;
}
.leaflet-popup-content {
  margin: 0 !important;
  width: 260px !important;
}
.popup-card {
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.popup-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.popup-view-link {
  margin-top: 10px;
  font-size: 0.75rem;
  color: #b85c00;
  font-weight: 600;
}

/* ── Case study iframe modal ── */
.cs-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cs-modal.open { display: flex; }

.cs-modal-inner {
  position: relative;
  width: min(1300px, calc(100vw - 32px));
  height: min(94vh, 1000px);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.cs-modal-inner iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #FAFAF7;
  -webkit-overflow-scrolling: touch;
}
.cs-modal-top-btns {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cs-modal-edit-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(30,30,28,0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 7px 14px;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s;
}
.cs-modal-edit-btn:hover { background: rgba(30,30,28,0.95); }
.cs-modal-map-btn {
  position: static;
  z-index: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(30,30,28,0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 7px 14px 7px 10px;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s;
}
.cs-modal-map-btn:hover { background: rgba(30,30,28,0.95); }
.cs-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 10;
  background: rgba(30,30,28,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 0.95rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.cs-modal-close:hover { background: rgba(30,30,28,0.95); color: #fff; }
@media (max-width: 640px) {
  .cs-modal { padding: 0; }
  .cs-modal-inner {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}
.modal-case-study-btn:hover { color: #7A2E2C; background: rgba(122,46,44,0.04); border-left-color: rgba(122,46,44,0.3); }
