* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252540;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --node-vehicle: #3b82f6;
    --node-ped: #22c55e;
    --node-external: #f59e0b;
    --connection: rgba(99, 102, 241, 0.6);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: 24px;
    width: auto;
}

.header h1 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex: 1;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-light);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Toolbar */
.toolbar {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 12px;
    z-index: 100;
    flex-wrap: wrap;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    backdrop-filter: blur(8px);
}

.tool-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 4px;
}

.tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.tool-btn.active {
    background: var(--accent);
    color: white;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}

.checkbox-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.checkbox-label input {
    accent-color: var(--accent);
}

.stats {
    font-size: 0.75rem;
    color: var(--text-muted);
    gap: 12px;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
}

#pathCanvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.canvas-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 15, 26, 0.9);
    border: 2px dashed var(--border-color);
    margin: 20px;
    border-radius: 12px;
    transition: all 0.2s;
}

.canvas-overlay.hidden {
    display: none;
}

.canvas-overlay.drag-over {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.drop-content {
    text-align: center;
    color: var(--text-secondary);
}

.drop-content svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.drop-content h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.drop-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.drop-content .hint {
    margin-top: 12px;
    font-size: 0.8rem;
}

.zoom-indicator {
    position: absolute;
    bottom: 16px;
    left: 16px;
    padding: 6px 12px;
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
}

.coords-indicator {
    position: absolute;
    bottom: 16px;
    left: 100px;
    padding: 6px 12px;
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, monospace;
    backdrop-filter: blur(8px);
}

/* Properties Panel */
.properties-panel {
    width: 280px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, opacity 0.2s;
}

.properties-panel.hidden {
    transform: translateX(100%);
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.panel-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.property-group {
    margin-bottom: 20px;
}

.property-group h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.property-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.property-row label {
    width: 80px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.property-row input,
.property-row select {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.property-row input:focus,
.property-row select:focus {
    outline: none;
    border-color: var(--accent);
}

.property-row input[type="number"] {
    width: 70px;
    flex: none;
}

.coord-inputs {
    display: flex;
    gap: 6px;
    flex: 1;
}

.coord-inputs input {
    flex: 1;
    min-width: 0;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

#statusHelp {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.7rem;
}

/* Node type colors legend */
.legend {
    display: flex;
    gap: 16px;
    padding: 8px 12px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.vehicle { background: var(--node-vehicle); }
.legend-dot.ped { background: var(--node-ped); }
.legend-dot.external { background: var(--node-external); }

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        gap: 8px;
    }

    .properties-panel {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        z-index: 200;
    }

    .stats {
        display: none;
    }

    #statusHelp {
        display: none;
    }
}
