:root {
    --primary: #0145AC;
    --primary-light: #3b82f6;
    --secondary: #FF6700;
    --secondary-hover: #E65C00;
    --dark: #002D72;
    --bg: #0f172a;
    --sidebar-bg: #1e293b;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: #334155;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 68px;
}

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

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: var(--bg);
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

#sidebar.collapsed .logo h1,
#sidebar.collapsed .nav-text,
#sidebar.collapsed .sidebar-footer button span {
    display: none;
}

#sidebar.collapsed .logo::after {
    content: 'GM';
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.logo {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
}

.logo span {
    color: var(--secondary);
}

#user-badge {
    color: var(--muted);
    font-size: 0.65rem;
}

/* Collapse Toggle Button */
.collapse-btn {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--secondary);
    border-radius: 50%;
    border: 2px solid var(--sidebar-bg);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    font-size: 0.8rem;
    transition: transform 0.3s;
}

#sidebar.collapsed .collapse-btn {
    transform: translateY(-50%) rotate(180deg);
}

nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom Scrollbar */
nav::-webkit-scrollbar {
    width: 3px;
}
nav::-webkit-scrollbar-thumb {
    background: var(--border);
}

nav ul {
    list-style: none;
}

nav li {
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
}

nav li span.icon {
    font-size: 1.2rem;
    min-width: 24px;
    display: flex;
    justify-content: center;
}

nav li:hover {
    background: var(--border);
    color: var(--text);
}

nav li.active {
    background: rgba(1, 69, 172, 0.1);
    color: var(--primary-light);
    border-right: 4px solid var(--primary);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--sidebar-bg);
}

.btn-primary {
    width: 100%;
    padding: 0.6rem;
    background: var(--primary);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.btn-logout {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.8rem;
    cursor: pointer;
}

/* Map Area */
#map-container {
    flex: 1;
    position: relative;
    height: 100%;
    background: var(--bg);
}

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

.minimal-map-type {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1001;
    background: var(--sidebar-bg);
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 1px solid var(--border);
}

.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.layer-control {
    background: var(--sidebar-bg);
    padding: 4px;
    border-radius: 8px;
    display: none;
    gap: 4px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.layer-control.show {
    display: flex;
}

.layer-control button {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
}

.layer-control button.active {
    background: var(--primary);
    color: white;
}

/* Professional Map Shapes */
.node-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid white;
}
.node-cto-dot { background: #3b82f6; }
.node-ceo-dot { background: #9333ea; }
.node-pole-dot { background: #64748b; }
.node-client-dot { background: #f59e0b; }

.shape-square {
    width: 12px;
    height: 12px;
    background: #3b82f6;
    border: 1.5px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.shape-diamond {
    width: 12px;
    height: 12px;
    background: #9333ea;
    border: 1.5px solid white;
    transform: rotate(45deg);
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.shape-circle {
    width: 10px;
    height: 10px;
    background: #ffffff;
    border: 2px solid #334155;
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(0,0,0,0.5);
}

.shape-triangle {
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 12px solid #f59e0b;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
}

.map-icon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.marker-label {
    margin-top: 4px;
    font-size: 9px;
    font-weight: 800;
    color: white;
    background: rgba(15, 23, 42, 0.85);
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    border: 1px solid var(--border);
    pointer-events: none;
}

.custom-node-icon.selected {
    filter: drop-shadow(0 0 8px #FF6700) brightness(1.2);
    transform: scale(1.3) !important;
    z-index: 1000 !important;
}

.leaflet-container {
    background: var(--bg) !important;
}

/* Properties Panel */
.info-panel {
    background: var(--sidebar-bg);
    width: 240px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    color: var(--muted);
    transition: all 0.3s;
    border: 1px solid var(--border);
}

.info-panel.collapsed {
    height: 36px;
    overflow: hidden;
}

.info-header {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.info-header h3 {
    color: var(--text);
    font-size: 0.85rem;
}

.info-content {
    padding: 12px;
    font-size: 0.8rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.modal-content {
    background: var(--sidebar-bg);
    padding: 1.5rem;
    border-radius: 8px;
    width: 320px;
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.75rem;
    color: var(--muted);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: white;
    font-size: 0.85rem;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
}

.mobile-menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: white;
}

/* Response */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        position: fixed;
        top: 10px;
        left: 10px;
        background: var(--primary);
        width: 36px;
        height: 36px;
        border-radius: 6px;
        align-items: center;
        justify-content: center;
        z-index: 2000;
    }

    #sidebar {
        position: fixed;
        left: -250px;
        height: 100%;
        transition: left 0.3s;
    }

    #sidebar.mobile-open {
        left: 0;
    }

    .map-controls {
        top: 55px;
    }
    
    .minimal-map-type {
        top: 10px;
    }
}
