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

:root {
  --route-color: #fbbf24;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #13141a;
  color: #f1f2f6;
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ---- Night (default) — dark amber ---- */
body, body[data-palette="night"] {
  background: #13141a;
  --bg-main: #13141a;
  --bg-sidebar: #1c1f2a;
  --bg-input: #252833;
  --bg-card: rgba(251, 191, 36, 0.07);
  --text-primary: #f1f2f6;
  --text-secondary: #9ba3af;
  --text-muted: #5c6370;
  --accent: #fbbf24;
  --accent-hover: #f59e0b;
  --route-color: #fbbf24;
  --border: rgba(255, 255, 255, 0.07);
}

/* ---- Sienna ---- */
body[data-palette="sienna"] {
  background: #f5d5c8;
  --bg-main: #f5d5c8;
  --bg-sidebar: #fce8de;
  --bg-input: #fff;
  --bg-card: rgba(181, 131, 141, 0.12);
  --text-primary: #2d1f22;
  --text-secondary: #6b4a51;
  --text-muted: #9a7a82;
  --accent: #b5596a;
  --accent-hover: #9e4a5b;
  --route-color: #c73e3a;
  --border: rgba(0, 0, 0, 0.08);
}

/* ---- Midnight ---- */
body[data-palette="midnight"] {
  background: #1e2028;
  --bg-main: #1e2028;
  --bg-sidebar: #272b36;
  --bg-input: #2f3342;
  --bg-card: rgba(202, 191, 171, 0.08);
  --text-primary: #dfd8c8;
  --text-secondary: #a89e8a;
  --text-muted: #6e6556;
  --accent: #cabfab;
  --accent-hover: #dfd4c4;
  --route-color: #cabfab;
  --border: rgba(223, 216, 200, 0.12);
}

body[data-palette="midnight"] .header-logo { color: #dfd8c8; }
body[data-palette="midnight"] .secondary-btn { color: #a89e8a; border-color: rgba(223, 216, 200, 0.2); background: rgba(223, 216, 200, 0.06); }
body[data-palette="midnight"] .secondary-btn:hover { background: rgba(223, 216, 200, 0.12); }

/* ---- Tropical ---- */
body[data-palette="sunset"] {
  background: #f0f7ef;
  --bg-main: #f0f7ef;
  --bg-sidebar: #e8f5e8;
  --bg-input: #fff;
  --bg-card: rgba(126, 172, 181, 0.15);
  --text-primary: #1c3535;
  --text-secondary: #3d6464;
  --text-muted: #7a9a9a;
  --accent: #2fa39a;
  --accent-hover: #268880;
  --route-color: #e05c2e;
  --border: rgba(0, 0, 0, 0.08);
}

/* ---- Sunset ---- */
body[data-palette="dusk"] {
  background: #fff0e8;
  --bg-main: #fff0e8;
  --bg-sidebar: #ffe4d6;
  --bg-input: #fff;
  --bg-card: rgba(247, 165, 100, 0.12);
  --text-primary: #2e1a10;
  --text-secondary: #7a4028;
  --text-muted: #b0856a;
  --accent: #e8692a;
  --accent-hover: #d45820;
  --route-color: #5d688a;
  --border: rgba(0, 0, 0, 0.08);
}

/* ---- Nomad ---- */
body[data-palette="mint"] {
  background: #ede5d4;
  --bg-main: #ede5d4;
  --bg-sidebar: #e4d9c4;
  --bg-input: #fff;
  --bg-card: rgba(205, 194, 174, 0.3);
  --text-primary: #2a2218;
  --text-secondary: #5a4e38;
  --text-muted: #8a7e68;
  --accent: #c06040;
  --accent-hover: #aa5030;
  --route-color: #c06040;
  --border: rgba(0, 0, 0, 0.08);
}

/* ---- Coastal ---- */
body[data-palette="coastal"] {
  background: #e8f4f6;
  --bg-main: #e8f4f6;
  --bg-sidebar: #d4ecf0;
  --bg-input: #fff;
  --bg-card: rgba(17, 106, 123, 0.08);
  --text-primary: #0d3d47;
  --text-secondary: #1e6878;
  --text-muted: #5a9aaa;
  --accent: #116a7b;
  --accent-hover: #0d5563;
  --route-color: #116a7b;
  --border: rgba(17, 106, 123, 0.12);
}

/* ---- Layout ---- */
.app-container {
  display: flex;
  height: 100vh;
  height: 100svh;
  justify-content: center;
  align-items: center;
  padding: 20px;
  padding-bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 12px));
  background: var(--bg-main);
}

.sidebar {
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 95vh;
  max-height: 95svh;
  background: var(--bg-sidebar);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,0.35);
  overflow: hidden;
}

/* ---- Header ---- */
.header {
  background: var(--bg-sidebar);
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.header-logo {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  margin: 0;
  letter-spacing: -0.5px;
}

/* ---- Content area ---- */
.content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.section {
  margin-bottom: 20px;
}

.section-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ---- Search ---- */
.search-box {
  position: relative;
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-box input {
  flex: 1;
  padding: 13px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.search-box input:focus {
  border-color: var(--accent);
}

.search-box input::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

.search-icon-btn {
  width: 46px;
  height: 46px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #1a1a1a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.search-icon-btn:hover { background: var(--accent-hover); }

.location-buttons {
  display: flex;
  width: 100%;
}

.secondary-btn {
  width: 100%;
  padding: 13px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.secondary-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Autocomplete */
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 54px;
  background: var(--bg-input);
  border: 1.5px solid var(--accent);
  border-top: none;
  border-radius: 0 0 10px 10px;
  z-index: 200;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.suggestion-item {
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1.4;
}

.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--bg-card); color: var(--text-primary); }

/* ---- Primary Button ---- */
.primary-btn {
  width: 100%;
  padding: 15px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  font-family: inherit;
}

.primary-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.primary-btn:disabled {
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ---- Loading ---- */
.loading-container {
  margin-bottom: 16px;
}

.loading-progress {
  height: 3px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.loading-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 10px;
  transition: width 0.3s ease-out;
}

.loading-text {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ---- Map ---- */
.map-preview-section {
  margin-bottom: 16px;
}

.map-preview-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.map-box {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  overflow: hidden;
}

.location-status-under-map {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 9px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.clear-btn-small {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}
.clear-btn-small:hover { color: var(--text-primary); }

/* ---- Page views ---- */
.page-section { padding: 0; }
.page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.about-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.about-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.about-version {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.setting-section { margin-bottom: 24px; }
.setting-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* Mobile */
@media (max-width: 600px) {
  .app-container { padding: 0; }
  .sidebar { border-radius: 0; max-height: 100vh; max-height: 100svh; }
  .map-box { height: 180px; }
}
