:root {
  --primary-red: #D32323;
  --primary-red-hover: #b31b1b;
  --primary-dark: #1e293b;
  --accent-gold: #f59e0b;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --sidebar-width: 440px;
}

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

body, html {
  height: 100%;
  width: 100%;
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--bg-main);
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  position: relative;
  transition: transform 0.3s ease;
}

.header {
  padding: 18px 20px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.michelin-badge {
  background: linear-gradient(135deg, #d32323, #991b1b);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(211, 35, 35, 0.35);
  flex-shrink: 0;
}

.brand h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary-dark);
  line-height: 1.2;
}

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

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  font-size: 14px;
}

.search-box input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  background-color: #f8fafc;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--primary-red);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(211, 35, 35, 0.12);
}

.clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-pill {
  background: #f1f5f9;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 20px;
}

.stat-pill span {
  color: var(--primary-red);
  font-weight: 700;
}

.gmaps-batch-btn {
  margin-left: auto;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.gmaps-batch-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: var(--primary-red);
}

/* Category Filters */
.categories-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.categories-scroll::-webkit-scrollbar {
  height: 4px;
}
.categories-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.cat-btn {
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cat-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.cat-btn.active {
  background: var(--primary-red);
  color: #ffffff;
  border-color: var(--primary-red);
}

/* Eateries / Locations List */
.list-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.location-group-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.location-group-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.location-group-card.active-selected {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 2px rgba(211, 35, 35, 0.2);
  background: #fffafa;
}

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

.loc-title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
}

.loc-icon {
  color: var(--primary-red);
  font-size: 15px;
}

.loc-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.loc-count-badge {
  background: #fee2e2;
  color: var(--primary-red);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.loc-address {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
}

.eateries-sublist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px dashed var(--border-color);
  padding-top: 8px;
}

.eatery-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f8fafc;
  transition: background 0.15s ease;
}

.eatery-row:hover {
  background: #f1f5f9;
}

.eatery-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.eatery-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eatery-cat {
  font-size: 0.72rem;
  color: #64748b;
}

.eatery-gmaps-link {
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.eatery-gmaps-link:hover {
  background: #2563eb;
  color: #ffffff;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.5rem;
  color: #cbd5e1;
  margin-bottom: 12px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.export-btn {
  background: none;
  border: none;
  color: var(--primary-red);
  font-weight: 600;
  font-size: 0.74rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.export-btn:hover {
  text-decoration: underline;
}

/* Map Area */
.map-area {
  flex: 1;
  height: 100%;
  position: relative;
}

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

/* Floating Controls */
.floating-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-ctrl-btn {
  width: 40px;
  height: 40px;
  background: #ffffff;
  border: none;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  color: #334155;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.map-ctrl-btn:hover {
  background: #f8fafc;
  color: var(--primary-red);
  transform: scale(1.05);
}

.toggle-sidebar-btn {
  display: none;
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: var(--primary-dark);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  cursor: pointer;
}

/* Leaflet Custom Marker & Popup Styles */
.custom-pin {
  background: var(--primary-red);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  position: relative;
}

.custom-pin i {
  transform: rotate(45deg);
  font-size: 13px;
}

.custom-pin-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--accent-gold);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(45deg);
}

/* Cluster Customization */
.marker-cluster-small {
  background-color: rgba(211, 35, 35, 0.3) !important;
}
.marker-cluster-small div {
  background-color: rgba(211, 35, 35, 0.85) !important;
  color: #fff !important;
  font-weight: 700;
}
.marker-cluster-medium {
  background-color: rgba(211, 35, 35, 0.4) !important;
}
.marker-cluster-medium div {
  background-color: rgba(211, 35, 35, 0.95) !important;
  color: #fff !important;
  font-weight: 700;
}

/* Popup styling */
.leaflet-popup-content-wrapper {
  border-radius: 14px !important;
  padding: 0 !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: 290px !important;
  line-height: 1.4 !important;
}

.popup-container {
  padding: 14px 16px;
}

.popup-header {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.popup-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.popup-address {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.popup-eatery-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.popup-eatery-item {
  background: #f8fafc;
  padding: 6px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popup-eatery-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
}

.popup-eatery-tag {
  font-size: 0.7rem;
  color: #64748b;
}

.popup-gmaps-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  text-align: center;
  background: #2563eb;
  color: #ffffff;
  padding: 7px 0;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.popup-gmaps-btn:hover {
  background: #1d4ed8;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #ffffff;
  border-radius: 16px;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

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

.modal-header {
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-red {
  color: var(--primary-red);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: #94a3b8;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #334155;
}

.modal-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #f8fafc;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-red);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.badge-gmaps {
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.btn-primary {
  background: var(--primary-red);
  color: #ffffff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: var(--primary-red-hover);
}

.btn-secondary {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: #0369a1;
}

.btn-outline {
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-outline:hover {
  background: #f1f5f9;
}

.mobile-close-sidebar-btn {
  display: none;
  background: var(--primary-dark);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  align-items: center;
  gap: 5px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    transform: translateY(100%);
  }

  .sidebar.open {
    transform: translateY(0);
  }

  .toggle-sidebar-btn {
    display: block;
  }

  .mobile-close-sidebar-btn {
    display: flex;
  }
}
