/* CSS Variables & Design System */
:root {
  /* Common variables */
  --font-brand: 'Outfit', 'Inter', sans-serif;
  --font-main: 'Inter', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  
  /* Light Theme Variables */
  --bg-app: #f8f9fa;
  --bg-sidebar: rgba(255, 255, 255, 0.96);
  --bg-card: #ffffff;
  --bg-input: #edf2f7;
  --border-color: rgba(0, 0, 0, 0.15);
  --text-main: #1a202c;
  --text-muted: #4a5568;
  --shadow-main: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
  --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.15);
  --glass-blur: blur(20px);
  
  /* Primary Accent & States (Vibrant Royal Blue) */
  --primary: #0056b3;
  --primary-hover: #004085;
  --primary-glow: rgba(0, 86, 179, 0.15);
  --secondary: #d9a714;
  --danger: #d9383a;
  --success: #23b25d;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-app: #0a0c10;
  --bg-sidebar: rgba(18, 22, 28, 0.96);
  --bg-card: #1a1f26;
  --bg-input: #2d3540;
  --border-color: rgba(255, 255, 255, 0.15);
  --text-main: #ffffff;
  --text-muted: #cbd5e1;
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
  --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.6);
  
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-glow: rgba(59, 130, 246, 0.3);
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

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

/* Sidebar Styling */
.sidebar {
  width: 380px;
  height: 100vh;
  background: var(--bg-sidebar);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border-color);
  padding: 24px;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-main);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

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

.brand-icon {
  font-size: 24px;
  color: var(--primary);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.brand h1 {
  font-family: var(--font-brand);
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

/* Icon Button */
.btn-icon {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  background: var(--border-color);
  transform: translateY(-2px);
  color: var(--primary);
}

/* Search Box */
.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.input-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  height: 44px;
  padding: 10px 36px 10px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}

.input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: none;
}

.btn-clear:hover {
  color: var(--text-main);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #00d2d3);
  color: white;
  border: none;
  padding: 0 16px;
  height: 44px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--primary-glow);
  opacity: 0.95;
}

.btn-secondary {
  width: 100%;
  height: 44px;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: var(--bg-input);
  border-color: var(--primary);
  color: var(--primary);
}

.quick-actions {
  margin-bottom: 24px;
}

/* Places List */
.places-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--text-main);
}

.section-title i {
  color: var(--primary);
  font-size: 16px;
}

.section-title h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-md);
  margin-bottom: 8px;
}

.empty-state i {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 13px;
  line-height: 1.6;
}

.places-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

/* Custom Scrollbar for Places List */
.places-list::-webkit-scrollbar {
  width: 6px;
}
.places-list::-webkit-scrollbar-track {
  background: transparent;
}
.places-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
.places-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.place-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.place-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-main);
  border-color: var(--primary);
}

.place-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.place-item-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 80%;
}

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

.place-item-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.btn-delete-place {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition-smooth);
  padding: 2px;
}

.btn-delete-place:hover {
  color: var(--danger);
  transform: scale(1.15);
}

.place-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.place-item-coords {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  opacity: 0.8;
  margin-top: 4px;
}

.sidebar-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.8;
}

/* Map Container styling */
.map-container {
  flex: 1;
  position: relative;
}

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

/* Map Floating Elements */
.btn-floating {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-float);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  cursor: pointer;
  z-index: 1000;
  transition: var(--transition-smooth);
}

.btn-floating:hover {
  transform: scale(1.08);
  color: var(--primary);
  border-color: var(--primary);
}

.sidebar-toggle {
  top: 16px;
  left: 16px;
  display: none; /* Mobile Only */
}

/* Map Layer Control */
.map-layers-control {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.map-layers-control .btn-floating {
  position: static;
}

.layer-menu {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 8px;
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 130px;
  animation: slideUp 0.2s ease-out;
}

.layer-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  transition: var(--transition-smooth);
}

.layer-option:hover {
  background: var(--bg-input);
}

.layer-option.active {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
}

.layer-preview {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.street-preview { background-color: #74b9ff; }
.dark-preview { background-color: #2d3436; }
.satellite-preview { background-color: #2ed573; }

.layer-label {
  font-size: 12px;
}

/* Search Results UI */
.search-results-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow-main);
  overflow: hidden;
  max-height: 200px;
  display: flex;
  flex-direction: column;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-text-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-text-close:hover {
  color: var(--text-main);
}

.results-list {
  list-style: none;
  overflow-y: auto;
}

.results-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

.results-item:last-child {
  border-bottom: none;
}

.results-item:hover {
  background: var(--bg-input);
  color: var(--primary);
}

.results-item i {
  color: var(--text-muted);
  font-size: 14px;
}

.results-item:hover i {
  color: var(--primary);
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transition: var(--transition-smooth);
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  width: 400px;
  max-width: 90%;
  box-shadow: var(--shadow-float);
  overflow: hidden;
  animation: scaleIn 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.modal-header h3 i {
  color: var(--primary);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Color Picker in Modal */
.color-picker {
  display: flex;
  gap: 12px;
}

.color-option-label {
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-option-label input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-block;
  transition: var(--transition-smooth);
  border: 2px solid transparent;
}

.color-option-label input:checked + .color-dot {
  transform: scale(1.2);
  border-color: var(--text-main);
  box-shadow: 0 0 8px rgba(0,0,0,0.2);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 24px 24px 24px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 0 12px;
  height: 44px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-smooth);
}

.btn-text:hover {
  background: var(--bg-input);
  color: var(--text-main);
}

.hidden {
  display: none !important;
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Naver Custom InfoWindow Styling */
.naver-custom-popup {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-float);
  padding: 16px;
  min-width: 200px;
  position: relative;
  animation: scaleIn 0.2s ease-out;
}

/* Close button for naver custom popup */
.naver-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
  padding: 4px;
}

.naver-popup-close:hover {
  color: var(--danger);
  transform: scale(1.15);
}

.custom-popup-title {
  font-weight: 700;
  font-family: var(--font-brand);
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.custom-popup-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 6px;
}

.custom-popup-coords {
  font-size: 10px;
  font-family: monospace;
  color: var(--text-muted);
  opacity: 0.8;
}

/* Responsive UI */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    position: absolute;
    top: 0;
    left: -380px;
    width: 320px;
    height: 100%;
    z-index: 2000;
    box-shadow: 10px 0 30px rgba(0,0,0,0.15);
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .sidebar-toggle {
    display: flex;
  }
}

/* Custom Map Markers Styling */
.custom-leaflet-icon {
  background: none !important;
  border: none !important;
}

.custom-marker-pin-wrapper {
  position: relative;
  width: 36px;
  height: 46px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.custom-marker-pulse {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 1.8s infinite ease-out;
  pointer-events: none;
}

.custom-marker-pin {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 14px;
  border: 2px solid white;
}

.custom-marker-pin i {
  transform: rotate(45deg); /* Counter-rotate icon so it stays upright */
}

/* User Location Pin (Geolocation indicator) */
.custom-div-icon-user {
  background: none !important;
  border: none !important;
}

.user-location-marker {
  width: 16px;
  height: 16px;
  background-color: var(--primary);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  position: relative;
}

.user-location-marker .ping {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 26px;
  height: 26px;
  border: 3px solid var(--primary);
  border-radius: 50%;
  animation: ping 1.5s infinite ease-out;
  opacity: 0;
}

@keyframes pulse {
  0% {
    transform: translateX(-50%) scale(0.5);
    opacity: 0.8;
  }
  100% {
    transform: translateX(-50%) scale(2.2);
    opacity: 0;
  }
}

@keyframes ping {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* PC Cafe Search Category Styles */
.results-category-title {
  font-family: var(--font-brand);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.pc-cafe-result {
  border-left: 3px solid transparent;
  transition: var(--transition-smooth);
}

.pc-cafe-result:hover {
  background: rgba(139, 92, 246, 0.08) !important;
  color: #8b5cf6 !important;
  border-left-color: #8b5cf6;
}

[data-theme="dark"] .pc-cafe-result:hover {
  background: rgba(139, 92, 246, 0.15) !important;
}

/* PC Cafe Refresh Button on Map Top Center */
.btn-refresh-pc {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 20px;
  border-radius: 30px;
  font-family: var(--font-brand);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: var(--transition-smooth);
}

.btn-refresh-pc:hover {
  background: #8b5cf6;
  color: #ffffff;
  border-color: #8b5cf6;
  transform: translateX(-50%) translateY(-2px);
}

.btn-refresh-pc.hidden {
  display: none !important;
}
