/* ============================================================
   Dofus Retro - Carte Interactive
   Palette: bg #000000, fg #212529, primary #d8d8d8
   Surfaces: #202028, #b88878, #f8f8f8, #3088d0, #684030, #98a0a8
   ============================================================ */

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

:root {
  --bg: #000000;
  --fg: #212529;
  --primary: #d8d8d8;
  --surface-dark: #202028;
  --surface-brown: #b88878;
  --surface-light: #f8f8f8;
  --surface-blue: #3088d0;
  --surface-brown-dark: #684030;
  --surface-gray: #98a0a8;
  --header-bg: #b88878;
  --header-fg: #ffffff;
  --map-height: 480px;
  --sidebar-w: 280px;
  font-size: 16px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  line-height: 1.5;
}

/* ─── HEADER ─── */
#site-header {
  background: var(--header-bg);
  color: var(--header-fg);
  padding: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  min-height: 60px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.header-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  flex-shrink: 0;
}

.header-title-main {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Language selector */
.lang-selector {
  position: relative;
}

.lang-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  color: #fff;
  padding: 5px 10px;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.lang-btn:hover {
  background: rgba(255,255,255,0.25);
}

.chevron {
  font-size: 0.6rem;
  opacity: 0.7;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface-light);
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
  z-index: 1000;
  min-width: 130px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.lang-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
  color: #333;
  transition: background 0.1s;
}

.lang-option:hover, .lang-option.active {
  background: var(--surface-brown);
  color: #fff;
}

.header-subtitle {
  background: var(--surface-light);
  color: var(--fg);
  text-align: center;
  padding: 6px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid #ddd;
}

/* ─── MAP WRAPPER ─── */
#map-wrapper {
  position: relative;
  width: 100%;
  height: var(--map-height);
  background: var(--bg);
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  background: #2a2a1a;
}

/* Remove default Leaflet zoom control */
.leaflet-control-zoom {
  display: none !important;
}

/* ─── ZOOM CONTROLS ─── */
.map-zoom-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zoom-btn {
  width: 30px;
  height: 30px;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.2);
  border-radius: 4px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  box-shadow: 0 1px 5px rgba(0,0,0,0.4);
  transition: background 0.1s;
}

.zoom-btn:hover {
  background: #f4f4f4;
}

/* ─── FILTRES BUTTON ─── */
.filtres-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 800;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.3);
  transition: background 0.15s;
}

.filtres-btn:hover {
  background: rgba(255,255,255,1);
}

/* ─── FILTER PANEL ─── */
.filter-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: var(--sidebar-w);
  background: rgba(32, 32, 40, 0.97);
  z-index: 900;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0,0,0,0.6);
  border-left: 1px solid #404050;
}

.filter-panel[hidden] {
  display: none;
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: var(--surface-brown-dark);
  border-bottom: 1px solid #505060;
  flex-shrink: 0;
}

.filter-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-close-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.8;
  padding: 2px 6px;
  border-radius: 3px;
  transition: opacity 0.15s, background 0.15s;
}

.filter-close-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.1);
}

.filter-section {
  padding: 12px 16px;
  border-bottom: 1px solid #353545;
}

.filter-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--surface-brown);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.filter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--primary);
  cursor: pointer;
  padding: 3px 0;
  transition: color 0.1s;
}

.filter-item:hover {
  color: #fff;
}

.filter-item input[type="checkbox"] {
  accent-color: var(--surface-blue);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.job-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 3px;
}

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

.filter-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  flex-shrink: 0;
}

.filter-apply-btn,
.filter-reset-btn {
  flex: 1;
  padding: 7px 8px;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.filter-apply-btn {
  background: var(--surface-blue);
  color: #fff;
}

.filter-reset-btn {
  background: var(--surface-gray);
  color: #fff;
}

.filter-apply-btn:hover, .filter-reset-btn:hover {
  opacity: 0.85;
}

/* ─── REGION TOOLTIP ─── */
.region-tooltip {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,40,0.92);
  color: var(--primary);
  border: 1px solid #505060;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 0.82rem;
  z-index: 850;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.region-tooltip[hidden] { display: none; }

/* ─── REGION POPUP ─── */
.region-popup {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
}

.region-popup[hidden] { display: none; }

.region-popup-inner {
  background: var(--surface-dark);
  border: 1px solid var(--surface-brown);
  border-radius: 8px;
  padding: 24px 28px;
  max-width: 400px;
  width: 90%;
  position: relative;
  color: var(--primary);
  box-shadow: 0 8px 40px rgba(0,0,0,0.7);
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--surface-gray);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.15s;
}

.popup-close:hover { color: #fff; }

.popup-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.popup-level {
  font-size: 0.82rem;
  color: var(--surface-blue);
  margin-bottom: 14px;
}

.popup-resources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.popup-resource-tag {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 0.78rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.popup-resource-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ─── BOTTOM NAV ─── */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 12px 16px;
  background: var(--surface-light);
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
}

.bottom-nav-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: underline;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}

.bottom-nav-link:hover {
  color: var(--surface-blue);
}

/* ─── INFO SECTION ─── */
.info-section {
  background: var(--surface-light);
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

.info-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--fg);
  text-align: center;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-text {
  font-size: 0.85rem;
  color: var(--fg);
  margin-bottom: 14px;
  text-align: justify;
  line-height: 1.6;
}

.info-link {
  color: var(--surface-brown-dark);
  text-decoration: underline;
}

.info-link:hover {
  color: var(--surface-blue);
}

.roadmap-section {
  margin-top: 20px;
}

.roadmap-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 8px;
}

.roadmap-list {
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--fg);
  line-height: 1.8;
}

/* ─── FOOTER ─── */
.site-footer {
  background: var(--surface-light);
  border-top: 1px solid #d0d0d0;
  padding: 12px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: #555;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  color: var(--surface-brown-dark);
  text-decoration: underline;
}

.footer-link:hover { color: var(--surface-blue); }

.footer-sep { color: #999; }

.privacy-btn {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  color: #555;
  transition: background 0.15s;
}

.privacy-btn:hover { background: rgba(0,0,0,0.1); }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--surface-light);
  border-radius: 8px;
  padding: 28px 32px;
  max-width: 380px;
  width: 90%;
  position: relative;
  color: var(--fg);
}

.modal-box h3 {
  margin-bottom: 12px;
  font-size: 1rem;
  font-weight: 700;
}

.modal-box p {
  font-size: 0.875rem;
  line-height: 1.6;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #888;
}

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

/* ─── LEAFLET CUSTOM STYLES ─── */
.leaflet-container {
  background: #2a2a1a !important;
  cursor: grab;
}

.leaflet-container:active {
  cursor: grabbing;
}

/* Region polygon labels */
.region-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.9), -1px -1px 3px rgba(0,0,0,0.9), 1px -1px 3px rgba(0,0,0,0.9), -1px 1px 3px rgba(0,0,0,0.9);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
}

/* Resource tooltip (Leaflet) */
.resource-tt {
  background: rgba(20,20,30,0.92);
  color: #d8d8d8;
  border: 1px solid #505060;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.78rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.resource-tt::before {
  border-top-color: rgba(20,20,30,0.92) !important;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {
  :root {
    --map-height: 420px;
    --sidebar-w: 260px;
  }

  .header-title-main {
    font-size: 0.95rem;
  }

  .header-logo {
    width: 40px;
    height: 40px;
  }

  .bottom-nav {
    gap: 20px;
  }

  .info-section {
    padding: 16px 14px 24px;
  }

  .filter-panel {
    width: 100%;
    max-width: 100%;
  }

  .region-popup-inner {
    padding: 18px 16px;
  }
}

@media (max-width: 375px) {
  .header-inner {
    padding: 6px 10px;
  }

  .bottom-nav {
    gap: 12px;
    flex-wrap: wrap;
  }
}
