@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --card-hover-bg: #fafafa;
  --card-active-bg: #f0f9ff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-sub: #64748b;
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --border-light: #e2e8f0;
  --border-hover: #bae6fd;
  --accent-green: #15803d;
  --accent-green-bg: #dcfce7;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

html, body {
  height: 100%;
  background-color: var(--bg-main);
  color: var(--text-main);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* NAVBAR HEADER */
.navbar {
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-light);
  padding: 1.25rem 2rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2000; /* Higher than Leaflet controls */
  box-shadow: var(--shadow-sm);
}

.navbar .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.navbar .logo .icon {
  font-size: 1.5rem;
}

.navbar .logo .brand {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
}

.navbar .subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* MAIN TWO-COLUMN LAYOUT */
.main-layout {
  display: flex;
  flex: 1;
  gap: 1.5rem;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  box-sizing: border-box;
  min-height: 0; /* Crucial for internal flex scrolling */
}

/* SIDEBAR CARDS LIST */
.card-list {
  flex: 1;
  min-width: 320px;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding: 0.25rem;
}

.card-list::-webkit-scrollbar {
  width: 6px;
}

.card-list::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 10px;
}

/* LOCATION CARD STYLING */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.card:hover {
  background-color: var(--card-hover-bg);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card.active {
  border: 2px solid var(--primary);
  background-color: var(--card-active-bg);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

/* BADGES */
.badge {
  background-color: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  white-space: nowrap;
  border: 1px solid var(--border-light);
}

.badge-247 {
  background-color: var(--accent-green-bg);
  color: var(--accent-green);
  border-color: rgba(21, 128, 61, 0.2);
  font-weight: 700;
}

.card .address {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.card .description {
  font-size: 0.875rem;
  color: var(--text-sub);
  line-height: 1.45;
}

/* MAP CONTAINER */
.map-wrapper {
  flex: 2;
  min-width: 300px;
  min-height: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  position: relative;
  z-index: 1;
}

#map {
  height: 100%;
  width: 100%;
  min-height: 100%;
}

/* LEAFLET POPUP OVERRIDES */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  font-family: var(--font-sans) !important;
  box-shadow: var(--shadow-md) !important;
  padding: 4px !important;
}

.leaflet-popup-content {
  font-size: 0.9rem !important;
  line-height: 1.4 !important;
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 850px) {
  body {
    height: auto;
  }

  .main-layout {
    flex-direction: column-reverse;
    height: auto;
    padding: 1rem;
  }

  .card-list {
    max-width: 100%;
    max-height: 450px;
  }

  .map-wrapper {
    height: 380px;
    min-height: 380px;
  }
}
