/* ========================================================
   MY LOCAL EXPLORER | Travel Journal & Field Notebook
   High-Contrast, Sunlight-Legible Outdoor Aesthetic
   ======================================================== */

:root {
  /* Warm Travel Journal Palette */
  --bg-sand: #F7F5F0;
  --bg-card: #FFFFFF;
  --bg-accent-tint: #FDF6E2;
  
  /* Primary Tones */
  --forest-deep: #1A362B;
  --forest-green: #2D5A43;
  --forest-light: #4E876A;
  --trail-amber: #D97706;
  --trail-gold: #F59E0B;
  --trail-glow: rgba(245, 158, 11, 0.25);
  
  /* Category Badge Colors */
  --badge-food: #F59E0B;
  --badge-lodging: #0284C7;
  --badge-coffee: #8B5CF6;
  --badge-historic: #B45309;
  --badge-photo: #EC4899;
  --badge-outdoors: #10B981;
  
  /* Neutral High-Contrast Typography */
  --text-dark: #1C1917;
  --text-muted: #57534E;
  --text-light: #A8A29E;
  --border-light: rgba(120, 113, 108, 0.18);
  --border-card: rgba(214, 211, 209, 0.7);
  --border-active: #D97706;
  
  /* Shadows */
  --shadow-sm: 0 2px 6px rgba(45, 90, 67, 0.05);
  --shadow-md: 0 8px 20px rgba(45, 90, 67, 0.09), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 16px 36px rgba(45, 90, 67, 0.14), 0 4px 12px rgba(217, 119, 6, 0.08);
  
  /* Fonts */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Layout Dimensions */
  --header-height: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-sand);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ========================================================
   TOP HEADER NAVIGATION
   ======================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1.5px solid var(--border-light);
  padding: calc(var(--safe-top) + 8px) 16px 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-emblem {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--forest-deep), var(--forest-green));
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--shadow-sm);
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--forest-deep);
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.brand-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Header Controls & State Selector */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.state-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.state-select {
  background: #FFF;
  border: 1.5px solid var(--trail-amber);
  color: var(--forest-deep);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 28px 6px 12px;
  border-radius: 20px;
  outline: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  appearance: none;
  -webkit-appearance: none;
}

.state-select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 10px;
  font-size: 0.85rem;
  color: var(--trail-amber);
  pointer-events: none;
}

.btn-header {
  background: #FFF;
  border: 1.5px solid var(--border-light);
  color: var(--forest-deep);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 7px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.btn-header:active { transform: scale(0.96); }

.btn-header.primary {
  background: linear-gradient(135deg, var(--forest-green), var(--forest-deep));
  color: #FFF;
  border: none;
  box-shadow: 0 4px 12px rgba(26, 54, 43, 0.25);
}

.btn-header.discover {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border-color: var(--trail-amber);
  color: #92400E;
}

/* ========================================================
   METRIC STATS STRIP & VIEW TOGGLE
   ======================================================== */
.metric-strip {
  background: #FFF;
  border-bottom: 1px solid var(--border-light);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow-x: auto;
}

.stats-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-sand);
  padding: 4px 10px;
  border-radius: 12px;
}

.stat-pill strong {
  color: var(--forest-deep);
}

/* Mobile View Switcher (List vs Map vs Split) */
.view-mode-toggle {
  display: flex;
  background: var(--bg-sand);
  padding: 3px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

.view-btn {
  background: none;
  border: none;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.view-btn.active {
  background: #FFF;
  color: var(--forest-deep);
  box-shadow: var(--shadow-sm);
}

/* ========================================================
   CATEGORY CHIPS & QUICK SEARCH BAR
   ======================================================== */
.filter-bar {
  padding: 10px 16px;
  background: rgba(247, 245, 240, 0.95);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  background: #FFF;
  border: 1.5px solid var(--border-light);
  border-radius: 20px;
  padding: 10px 16px 10px 38px;
  font-size: 0.9rem;
  outline: none;
  color: var(--text-dark);
}

.search-input:focus {
  border-color: var(--trail-amber);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.95rem;
}

.category-chips-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}

.category-chips-scroll::-webkit-scrollbar { display: none; }

.cat-chip {
  flex-shrink: 0;
  background: #FFF;
  border: 1.5px solid var(--border-light);
  color: var(--text-dark);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  transition: all 0.15s ease;
}

.cat-chip.active {
  border-color: var(--trail-amber);
  background: #FFFBEB;
  color: #92400E;
  box-shadow: 0 2px 8px var(--trail-glow);
}

/* ========================================================
   MAIN WORKSPACE (SPLIT VIEW: CARDS & MAP)
   ======================================================== */
.workspace-container {
  flex: 1;
  display: flex;
  height: calc(100vh - var(--header-height) - 105px);
  position: relative;
}

/* Place List Feed (Left Pane) */
.place-list-pane {
  width: 440px;
  max-width: 100%;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1.5px solid var(--border-light);
  background: var(--bg-sand);
}

/* Place Card */
.place-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.place-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--trail-amber);
}

.place-cover-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #E7E5E4;
}

.place-card-body {
  padding: 14px;
}

.place-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: 6px;
  color: #FFF;
}

.rating-stars {
  color: #F59E0B;
  font-size: 0.85rem;
  font-weight: 800;
}

.place-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--forest-deep);
  margin-bottom: 3px;
  line-height: 1.25;
}

.place-location-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.place-desc-snippet {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Quick Action Links on Cards */
.place-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.card-action-btn {
  background: var(--bg-sand);
  border: 1px solid var(--border-light);
  color: var(--forest-deep);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-action-btn:hover {
  background: var(--trail-amber);
  color: #FFF;
  border-color: var(--trail-amber);
}

/* Map Pane (Right Pane) */
.map-pane {
  flex: 1;
  position: relative;
  background: #E5E7EB;
}

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

/* Custom Marker Pin */
.custom-map-pin {
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  border: 2px solid #FFF;
}

.pin-icon-inner {
  transform: rotate(45deg);
  font-size: 1.1rem;
}

/* ========================================================
   MODALS: PLACE DETAIL, ADD/EDIT & DISCOVERY
   ======================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(28, 25, 23, 0.55);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.active { display: flex; }

.modal-card {
  background: #FFF;
  border-radius: 20px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1.5px solid var(--border-card);
  animation: popModal 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popModal {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header-img-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
}

.modal-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-close-round {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.modal-content-padded {
  padding: 20px;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  background: #FAFAF9;
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
  color: var(--text-dark);
  outline: none;
}

.form-control:focus {
  border-color: var(--trail-amber);
  background: #FFF;
}

/* Responsive Mobile Rules */
@media (max-width: 768px) {
  .workspace-container {
    height: calc(100vh - var(--header-height) - 130px);
  }
  
  .place-list-pane {
    width: 100%;
    border-right: none;
  }
  
  .map-pane {
    display: none;
  }
  
  /* Mode active controls */
  .workspace-container.mode-map .place-list-pane { display: none; }
  .workspace-container.mode-map .map-pane { display: block; }
}
