:root {
    /* Modern Color Palette (Slate & Blue) */
    --primary: #2563eb;
    /* Blue 600 */
    --primary-hover: #1d4ed8;
    /* Blue 700 */
    --secondary: #64748b;
    /* Slate 500 */
    --bg-body: #f8fafc;
    /* Slate 50 */
    --bg-surface: #ffffff;
    /* White */
    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #475569;
    /* Slate 600 */
    --border: #e2e8f0;
    /* Slate 200 */
    --danger: #ef4444;
    /* Red 500 */
    --success: #22c55e;
    /* Green 500 */

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Radius */
    --radius: 0.5rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-body);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

.app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* --- Sidebar --- */
.sidebar {
    width: 400px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.controls {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* --- Form Elements --- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

input[type="text"],
input[type="file"] {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s;
    background: var(--bg-body);
    width: 100%;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--bg-surface);
}

/* Search Suggestions */
.search-container {
    position: relative;
}

.suggestions-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1001;
    list-style: none;
}

.suggestions-list.hidden {
    display: none;
}

.suggestions-list li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-main);
    transition: background 0.15s;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.suggestions-list li:last-child {
    border-bottom: none;
}

.suggestions-list li:hover {
    background: var(--bg-body);
    color: var(--primary);
}

.suggestion-primary {
    font-weight: 600;
    color: var(--text-main);
}

.suggestion-secondary {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Mode Switch --- */
.mode-switch {
    display: flex;
    background: var(--bg-body);
    padding: 0.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.mode-btn {
    flex: 1;
    padding: 0.5rem;
    border: none;
    background: transparent;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.mode-btn:hover {
    color: var(--text-main);
}

.mode-btn.active {
    background: var(--bg-surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* --- Transport Mode --- */
.transport-mode-selector {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-main);
    font-weight: 500;
}

.radio-label input {
    accent-color: var(--primary);
    width: 1.1em;
    height: 1.1em;
}

/* --- Lists --- */
.points-list-container h3 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.points-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.store-list {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.points-list li {
    padding: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.points-list li:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.points-list li.depot-item {
    border-left: 4px solid var(--primary);
    background: #eff6ff;
}

.points-list li.point-item {
    border-left: 4px solid var(--success);
}

.store-info {
    display: flex;
    flex-direction: column;
}

.store-name {
    font-weight: 600;
    color: var(--text-main);
}

.store-coords {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Buttons inside lists */
.add-btn,
.remove-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.add-btn {
    background: var(--success);
    color: white;
}

.add-btn:hover {
    background: #16a34a;
    transform: scale(1.1);
}

.remove-btn {
    background: transparent;
    color: var(--text-muted);
}

.remove-btn:hover {
    background: #fee2e2;
    color: var(--danger);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 1.5rem;
    background: var(--bg-body);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

/* --- Action Buttons --- */
.actions {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.primary-btn,
.secondary-btn {
    padding: 0.875rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(37, 99, 235, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.secondary-btn:hover {
    background: #fee2e2;
    color: var(--danger);
    border-color: #fecaca;
}

/* --- Results Panel --- */
.results-panel {
    background: #f0fdf4;
    /* Green 50 */
    border: 1px solid #bbf7d0;
    /* Green 200 */
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-panel.hidden {
    display: none;
}

.results-panel h3 {
    font-size: 0.875rem;
    color: #15803d;
    /* Green 700 */
    margin-bottom: 0.75rem;
    font-weight: 700;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.points-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.store-list {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.points-list li {
    padding: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.points-list li:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.points-list li.depot-item {
    border-left: 4px solid var(--primary);
    background: #eff6ff;
}

.points-list li.point-item {
    border-left: 4px solid var(--success);
}

.store-info {
    display: flex;
    flex-direction: column;
}

.store-name {
    font-weight: 600;
    color: var(--text-main);
}

.store-coords {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Buttons inside lists */
.add-btn,
.remove-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.add-btn {
    background: var(--success);
    color: white;
}

.add-btn:hover {
    background: #16a34a;
    transform: scale(1.1);
}

.remove-btn {
    background: transparent;
    color: var(--text-muted);
}

.remove-btn:hover {
    background: #fee2e2;
    color: var(--danger);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 1.5rem;
    background: var(--bg-body);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

/* --- Action Buttons --- */
.actions {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.primary-btn,
.secondary-btn {
    padding: 0.875rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(37, 99, 235, 0.3);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.secondary-btn:hover {
    background: #fee2e2;
    color: var(--danger);
    border-color: #fecaca;
}

/* --- Results Panel --- */
.results-panel {
    background: #f0fdf4;
    /* Green 50 */
    border: 1px solid #bbf7d0;
    /* Green 200 */
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-panel.hidden {
    display: none;
}

.results-panel h3 {
    font-size: 0.875rem;
    color: #15803d;
    /* Green 700 */
    margin-bottom: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #bbf7d0;
}

.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.result-item .label {
    color: #166534;
    /* Green 800 */
}

.result-item .value {
    font-weight: 700;
    color: #14532d;
    /* Green 900 */
    font-size: 1rem;
}

/* --- Custom Map Markers --- */
.custom-marker {
    background: transparent;
    border: none;
}

.depot-marker .marker-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.depot-marker .marker-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 50% 50% 50% 0;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    transform: rotate(-45deg);
}

.depot-marker .marker-icon::before {
    content: '🏭';
    transform: rotate(45deg);
}

.depot-marker .marker-label {
    background: #dc2626;
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    margin-top: 0.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.point-marker .marker-content {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50% 50% 50% 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    transform: rotate(-45deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.point-marker .marker-content:hover {
    transform: rotate(-45deg) scale(1.15);
}

.point-marker .marker-number {
    color: white;
    font-weight: 700;
    font-size: 1rem;
    transform: rotate(45deg);
    user-select: none;
}

/* --- Map --- */
.map-container {
    flex: 1;
    background: var(--border);
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column-reverse;
    }

    .sidebar {
        width: 100%;
        height: 50vh;
        border-right: none;
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 20px -5px rgb(0 0 0 / 0.15);
        border-radius: 1.5rem 1.5rem 0 0;
        /* Bottom sheet look */
        margin-top: -1rem;
        /* Overlap map slightly */
        z-index: 2000;
    }

    .sidebar-header {
        padding: 1rem;
        text-align: center;
    }

    .sidebar-header h1 {
        justify-content: center;
        font-size: 1.25rem;
    }

    .controls {
        padding: 1rem;
    }

    .map-container {
        height: 55vh;
        /* Allow overlap */
    }

    /* Adjust buttons for touch */
    .primary-btn,
    .secondary-btn {
        padding: 1rem;
        font-size: 1rem;
    }

    .mode-btn {
        padding: 0.75rem;
    }
}