:root {
  --bg-main: #060a17;
  --bg-card: rgba(15, 23, 42, 0.85);
  --bg-card-hover: rgba(30, 41, 59, 0.95);
  --bg-header: rgba(10, 16, 31, 0.92);
  --bg-panel: rgba(11, 18, 36, 0.96);
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.3);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #38bdf8;
  --accent-blue: #0284c7;
  --accent-glow: #38bdf840;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-hand: 'Caveat', cursive;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

/* App Shell Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  position: relative;
  background: radial-gradient(circle at 50% 30%, #0d1933 0%, #060a17 70%);
}

/* Header */
.app-header {
  height: 68px;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  gap: 16px;
}

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

.brand-badge {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

.brand-text p {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Header Center: Search & City Filter */
.header-center {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 620px;
}

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

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 8px 34px 8px 36px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--accent-cyan);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 12px var(--accent-glow);
}

.search-box .clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #0f172a;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

.suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

.suggestion-item:hover {
  background: rgba(56, 189, 248, 0.12);
}

.suggestion-name {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.suggestion-badge {
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
}

/* Styled Select */
.styled-select {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  min-width: 160px;
  transition: all 0.2s ease;
}

.styled-select:focus {
  border-color: var(--accent-cyan);
}

/* Header Right: Modes & Export */
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mode-switcher {
  display: flex;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--accent-cyan);
  color: #030712;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #fff;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #0891b2);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
}

/* Map Canvas Container */
.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: grab;
}

.map-container:active {
  cursor: grabbing;
}

#mapCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Overlays Layer */
.map-overlay-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Sea Labels */
.sea-label {
  position: absolute;
  color: rgba(56, 189, 248, 0.45);
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 6px;
  text-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
  user-select: none;
}

.sea-label.black-sea {
  top: 7%;
  left: 48%;
  transform: translateX(-50%);
}

.sea-label.mediterranean-sea {
  bottom: 12%;
  left: 46%;
  transform: translateX(-50%);
}

.sea-label.aegean-sea {
  top: 42%;
  left: 3%;
  writing-mode: vertical-rl;
  letter-spacing: 8px;
}

.sea-label.marmara-sea {
  top: 24%;
  left: 17%;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(56, 189, 248, 0.35);
  text-align: center;
}

/* Compass Widget */
.compass-widget {
  position: absolute;
  top: 20px;
  right: 24px;
  pointer-events: auto;
}

.compass-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px dashed rgba(56, 189, 248, 0.4);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}

.compass-dir {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
}

.compass-dir.north { top: 2px; color: #ef4444; }
.compass-dir.south { bottom: 2px; }
.compass-dir.east { right: 4px; }
.compass-dir.west { left: 4px; }

.compass-needle {
  width: 2px;
  height: 28px;
  background: linear-gradient(to bottom, #ef4444 50%, #38bdf8 50%);
}

/* Map Navigation Controls */
.map-controls {
  position: absolute;
  top: 95px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}

.control-btn {
  width: 36px;
  height: 36px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: var(--accent-cyan);
  color: #030712;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Scale Bar & Slogan */
.scale-bar-widget {
  position: absolute;
  bottom: 20px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.scale-line {
  position: relative;
  width: 220px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 2px;
}

.scale-tick {
  position: absolute;
  top: 6px;
  font-size: 9px;
  color: var(--text-secondary);
  transform: translateX(-50%);
}

.slogan-badge {
  font-family: var(--font-hand);
  font-size: 26px;
  color: #f472b6;
  text-shadow: 0 0 10px rgba(244, 114, 182, 0.4);
}

/* Status Badge */
.status-badge {
  position: absolute;
  bottom: 20px;
  left: 24px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.pulsing-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* Floating Tooltip Card */
.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(11, 19, 38, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--accent-cyan);
  border-radius: 12px;
  padding: 12px 16px;
  width: 260px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 15px rgba(56, 189, 248, 0.25);
  z-index: 200;
  transition: opacity 0.15s ease;
}

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

.tooltip-cat-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  color: #fff;
}

.tooltip-city-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
}

.tooltip-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.tooltip-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tooltip-coords {
  font-size: 10px;
  color: var(--text-muted);
  font-family: monospace;
}

.tooltip-hint {
  font-size: 9px;
  color: var(--accent-cyan);
  text-align: right;
  margin-top: 4px;
}

/* Bottom Category Grid & Drawer */
.app-footer {
  background: var(--bg-panel);
  border-top: 1px solid var(--border-light);
  padding: 12px 24px 16px;
  z-index: 90;
  max-height: 190px;
  overflow-y: auto;
}

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

.footer-title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.footer-title-group h3 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-primary);
}

.footer-title-group .sub-info {
  font-size: 11px;
  color: var(--text-muted);
}

.footer-actions {
  display: flex;
  gap: 8px;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px 12px;
}

.cat-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.cat-pill:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

.cat-pill.disabled {
  opacity: 0.35;
  filter: grayscale(80%);
}

.cat-pill-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.cat-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.cat-name {
  font-size: 11.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 6px;
}

/* Modal Popup */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: #0f172a;
  border: 1px solid var(--accent-cyan);
  border-radius: 16px;
  width: 90%;
  max-width: 520px;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.25);
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

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

.modal-cat-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 8px;
  color: #fff;
  margin-bottom: 8px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.modal-city {
  font-size: 14px;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  border-radius: 10px;
  border-left: 3px solid var(--accent-cyan);
}

.modal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.info-item {
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 11px;
  color: var(--text-muted);
}

.info-val {
  font-size: 13px;
  font-weight: 600;
  font-family: monospace;
  color: var(--text-primary);
}

.mini-btn {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  margin-top: 4px;
  align-self: flex-start;
}

.mini-btn:hover {
  background: var(--accent-cyan);
  color: #030712;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}
