:root {
    --bg: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #242836;
    --text: #e4e6eb;
    --text-muted: #8b8fa3;
    --primary: #f97316;
    --primary-hover: #fb923c;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #2d3148;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    position: relative;
}

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

.nav-icon { font-size: 24px; }
.nav-logo { width: 36px; height: 36px; border-radius: 8px; background: #fff; padding: 2px; }
.nav-title { font-size: 18px; font-weight: 700; }

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

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}

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

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--text-muted); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Hero */
.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 57px);
    padding: 40px;
    background: #ffffff;
}

.hero-content {
    text-align: center;
    max-width: 600px;
}

.hero-logo {
    width: 320px;
    height: 320px;
    margin-bottom: 24px;
    border-radius: 24px;
}

.hero-content h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.2;
    color: #1a1a1a;
}

.hero-content p {
    font-size: 18px;
    color: #666;
    margin-bottom: 32px;
    line-height: 1.6;
}

/* App Layout */
.app-container {
    display: flex;
    height: calc(100vh - 57px);
}

/* Sidebar */
.sidebar {
    width: 380px;
    min-width: 380px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 20px;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

/* File Drop */
.file-drop {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.file-drop:hover, .file-drop.dragover {
    border-color: var(--primary);
    background: rgba(249, 115, 22, 0.05);
}

.file-drop p {
    font-size: 14px;
    color: var(--text-muted);
}

.file-drop .link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

.file-name {
    margin-top: 8px;
    color: var(--success);
    font-weight: 500;
}

/* Source switch link (file ↔ Garmin) */
.source-switch-link {
    display: block;
    text-align: center;
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    padding: 8px 0;
    margin-bottom: 12px;
    border-top: 1px solid var(--border);
}
.source-switch-link:hover {
    text-decoration: underline;
}
    font-size: 13px;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

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

.range-group input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}

.range-group span {
    font-size: 14px;
    font-weight: 600;
    min-width: 60px;
    text-align: right;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* Results */
.results-summary {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.results-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.filter-btn.active, .filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.poi-card {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.poi-card:hover {
    border-color: var(--primary);
}

.poi-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.poi-card-icon { font-size: 18px; }

.poi-card-name {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.poi-card-distance {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
}

.poi-card-type {
    font-size: 11px;
    color: var(--text-muted);
}

.poi-card-hours {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.poi-card-phone {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Google Places badges */
.poi-card-google {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.google-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}
.google-badge-verified {
    background: #166534;
    color: #86efac;
}
.google-badge-closed {
    background: #991b1b;
    color: #fca5a5;
}
.google-badge-unverified {
    background: #44403c;
    color: #d6d3d1;
}
.google-rating {
    font-size: 11px;
    color: #fbbf24;
}
.google-hours summary {
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
}
.google-hours div {
    font-size: 10px;
    color: var(--text-muted);
    padding: 4px 0;
}
.google-website {
    font-size: 11px;
    color: #f97316;
    text-decoration: none;
}
.google-website:hover {
    text-decoration: underline;
}
.google-phone {
    font-size: 11px;
    color: var(--text-muted);
}

/* Weather markers */
.weather-datetime-row {
    display: flex;
    gap: 8px;
}

.weather-datetime-row input {
    flex: 1;
}

.weather-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}

.weather-arrow {
    font-size: 18px;
    color: #f97316;
    line-height: 1;
    text-shadow: 0 0 3px rgba(255,255,255,0.8);
}

.weather-icon {
    font-size: 16px;
    line-height: 1;
}

/* Wind arrow markers on track */
.wind-arrow-marker {
    pointer-events: auto;
}

.wind-arrow-svg {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Weather trend panel */
.weather-panel {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    padding: 12px 14px;
    max-width: 420px;
    max-height: 320px;
    overflow-y: auto;
    font-family: 'Inter', sans-serif;
}

.weather-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.weather-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #999;
    padding: 0 4px;
    line-height: 1;
}

.weather-panel-close:hover {
    color: #333;
}

.wt-legend {
    display: flex;
    justify-content: space-around;
    font-size: 10px;
    color: #888;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}

.wt-chart {
    display: flex;
    gap: 4px;
    align-items: flex-end;
}

.wt-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 42px;
    font-size: 10px;
    text-align: center;
}

.wt-km {
    font-size: 9px;
    color: #888;
    margin-bottom: 2px;
}

.wt-icon {
    font-size: 16px;
    line-height: 1;
}

.wt-temp {
    font-size: 13px;
    font-weight: 700;
    margin: 2px 0;
}

.wt-bar-container {
    width: 14px;
    height: 40px;
    background: #f0f0f0;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.wt-bar-precip {
    width: 100%;
    background: linear-gradient(to top, #3b82f6, #60a5fa);
    border-radius: 3px;
    transition: height 0.3s;
}

.wt-precip {
    font-size: 9px;
    color: #3b82f6;
    margin: 1px 0;
    min-height: 11px;
}

.wt-wind {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 2px;
}

.wt-wind-arrow {
    font-size: 14px;
    color: #333;
    line-height: 1;
}

.wt-wind-speed {
    font-size: 10px;
    font-weight: 600;
    color: #555;
}

.wt-compass {
    font-size: 9px;
    color: #888;
    margin-top: 1px;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0 6px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-msg {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* History header row */
.sidebar-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.sidebar-header-row h3 {
    margin-bottom: 0;
}

/* History delete button */
.history-item-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.5;
    transition: all 0.2s;
}

.history-item-delete:hover {
    opacity: 1;
    background: var(--danger);
    border-radius: 4px;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.history-item:hover {
    background: var(--bg);
}

.history-item-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.history-item-distance {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 8px;
}

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

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

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

.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    padding: 24px 32px;
    border-radius: var(--radius);
    text-align: center;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Leaflet custom markers */
.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    font-family: 'Inter', sans-serif !important;
}

.poi-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 2px solid white;
}

.poi-marker-water { background: #3b82f6; }
.poi-marker-supermarket { background: #22c55e; }
.poi-marker-hotel { background: #f59e0b; }

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        min-width: unset;
        max-height: 40vh;
    }
    .map-container {
        height: 60vh;
    }
}
