:root,
[data-theme="light"] {
  --bg: #f8fafc;
  --text: #1f2937;
  --card: #ffffff;
  --border: #e2e8f0;
  --accent: #3b82f6;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --text: #e2e8f0;
  --card: #1e2937;
  --border: #334155;
  --accent: #60a5fa;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

h1 { margin: 0; font-size: 1.5rem; }

.controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

#search {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  width: 280px;
  max-width: 100%;
}

#theme-toggle {
  padding: 0.5rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}

.btn-link {
  padding: 0.6rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.btn-link:hover {
  background: rgba(59, 130, 246, 0.1);
}

input[type="text"],
input[type="file"],
select,
textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.field-row {
  display: flex;
  gap: 0.5rem;
}

.field-row input {
  flex: 1;
}

.btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem;
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary:hover {
  background: #16a34a;
}

.container {
  display: flex;
  flex: 1;
  overflow: hidden;
  flex-direction: row;
}

.sidebar {
  width: 320px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--card);
  padding: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 1;
}

.sidebar-filters select {
  width: 100%;
  margin-bottom: 0;
  padding: 0.5rem;
  font-size: 0.85rem;
}

select option {
  background: var(--card);
  color: var(--text);
}

.map-container {
  flex: 1;
  position: relative;
}

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

#location-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#location-list li {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

#location-list li:hover,
#location-list li.active {
  background: rgba(59, 130, 246, 0.1);
}

.location-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.location-info {
  flex: 1;
  min-width: 0;
}

.location-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  cursor: pointer;
}

.share-btn {
  background: var(--card);
  color: var(--text);
}

.share-btn:hover,
.share-btn.share-btn-copied {
  background: rgba(59, 130, 246, 0.1);
}

.share-btn.share-btn-copied {
  color: var(--accent);
}

.nav-btn {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.icon-btn:hover {
  filter: brightness(1.05);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .map-container {
    flex: 1;
    min-height: 60vh;
  }
  
  #search {
    width: 100%;
  }
  
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }
}