/* Azure Maps Viewer Styles */

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100vh;
    margin-left: 280px;
    transition: margin-left 0.3s ease;
}

/* Main control panel - always visible */
.info-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.96);
    border-right: 2px solid #ddd;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    z-index: 1000;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Panel header */
.panel-header {
    padding: 12px 15px 8px 15px;
    border-bottom: 1px solid #ddd;
    background: rgba(240, 248, 255, 0.8);
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    color: #0078d4;
    font-size: 16px;
    font-weight: 600;
}

/* Scrollable content area */
.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Compact sections */
.panel-section {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-section h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cache status */
#cache-status {
    font-size: 11px;
    margin-bottom: 5px;
}

#cache-info {
    font-weight: 600;
}

/* Layer visibility toggles - always visible */
#layer-toggles {
    margin: 0;
}

.toggle-group {
    margin: 6px 0;
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    transition: all 0.2s ease;
}

.toggle-label input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.0);
    cursor: pointer;
    accent-color: #0078d4;
}

.toggle-text {
    color: #333;
    transition: color 0.2s ease;
}

.toggle-label:hover .toggle-text {
    color: #0078d4;
}

.toggle-label input[type="checkbox"]:checked + .toggle-text {
    color: #0078d4;
    font-weight: 600;
}

.toggle-label input[type="checkbox"]:not(:checked) + .toggle-text {
    color: #888;
    text-decoration: line-through;
}

/* Consistent styling for standalone toggle items */
.toggle-controls .toggle-item {
    margin: 6px 0;
    display: flex;
    align-items: center;
}

.toggle-controls .toggle-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    transition: all 0.2s ease;
}

.toggle-controls .toggle-item input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.0);
    cursor: pointer;
    accent-color: #0078d4;
}

.toggle-controls .toggle-item .toggle-label {
    color: #333;
    transition: color 0.2s ease;
}

.toggle-controls .toggle-item label:hover .toggle-label {
    color: #0078d4;
}

.toggle-controls .toggle-item input[type="checkbox"]:checked + .toggle-label {
    color: #0078d4;
    font-weight: 600;
}

.toggle-controls .toggle-item input[type="checkbox"]:not(:checked) + .toggle-label {
    color: #888;
    text-decoration: line-through;
}

/* Brigade controls toggle button */
.brigade-toggle-btn,
.brigade-panel-toggle {
    width: 100%;
    background: #2c5530;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    transition: background-color 0.2s;
}

.brigade-toggle-btn:hover,
.brigade-panel-toggle:hover {
    background: #3a6b3f;
}

.brigade-toggle-btn.active,
.brigade-panel-toggle.active {
    background: #ff6b35;
}

/* Expandable brigade panel */
.brigade-panel {
    position: fixed;
    top: 0;
    left: 280px;
    width: 300px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.97);
    border-right: 2px solid #ddd;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brigade-panel.open {
    transform: translateX(0);
}

.brigade-panel.open ~ #map {
    margin-left: 580px;
}

.brigade-panel-header {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
    background: rgba(44, 85, 48, 0.1);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brigade-panel-header h4 {
    margin: 0;
    color: #2c5530;
    font-size: 14px;
    font-weight: 600;
}

.close-brigade-panel {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.brigade-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px;
}

/* Compact brigade list */
#brigade-list {
    margin: 0;
}

.brigade-item {
    margin: 6px 0;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: rgba(250, 250, 250, 0.8);
    font-size: 11px;
}

.brigade-visibility {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.brigade-visibility input[type="checkbox"] {
    margin-right: 5px;
    transform: scale(0.9);
}

.brigade-name {
    flex: 1;
    font-weight: 500;
    font-size: 11px;
    margin-left: 4px;
}

.brigade-turnout {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #666;
}

.brigade-turnout input {
    width: 35px;
    padding: 2px 4px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 10px;
    transition: border-color 0.2s ease;
}

.brigade-turnout input:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

/* Integrated color picker in visibility row */
.brigade-color-picker {
    width: 24px;
    height: 16px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    padding: 0;
    background: none;
    margin-right: 4px;
    flex-shrink: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    overflow: hidden;
    box-shadow: 0 0 0 0.5px #999;
}

.brigade-color-picker:hover {
    box-shadow: 0 0 0 1px #0078d4;
}

.brigade-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border: none;
    border-radius: 2px;
}

.brigade-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
    width: 100%;
    height: 100%;
}

.brigade-color-picker::-moz-color-swatch {
    border: none;
    border-radius: 2px;
}

.reset-color-btn {
    width: 16px;
    height: 16px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #666;
    margin-right: 6px;
    flex-shrink: 0;
}

.reset-color-btn:hover {
    background: #e8e8e8;
    border-color: #0078d4;
    color: #0078d4;
}

/* Warning row for color conflicts */
.brigade-warning-row {
    margin: 2px 0 0 24px; /* Indent to align with controls above */
}

.color-conflict-warning {
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 2px;
    margin-left: 4px;
}

.color-conflict-warning.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.color-conflict-warning.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c2c7;
}

/* Scenario controls */
#scenario-controls {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
}

.scenario-buttons {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.scenario-btn {
    flex: 1;
    padding: 6px 8px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: background-color 0.2s;
    background: #666;
    color: white;
}

.scenario-btn:hover {
    background: #777;
}

.scenario-btn-primary {
    background: #2c5530;
    color: white;
}

.scenario-btn-primary:hover {
    background: #3a6b3f;
}

.scenario-btn-secondary {
    background: #666;
    color: white;
}

.scenario-btn-secondary:hover {
    background: #777;
}

#scenario-stats {
    font-size: 10px;
    color: #666;
    line-height: 1.3;
}

/* Toggle all container */
.toggle-all-container {
    margin-bottom: 8px;
}

.btn-small,
.toggle-all-btn {
    font-size: 10px;
    padding: 4px 8px;
    background: #0078d4;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-small:hover,
.toggle-all-btn:hover {
    background: #106ebe;
}

/* Feature info panel */
.feature-info {
    position: absolute;
    bottom: 10px;
    left: 290px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 300px;
    z-index: 1000;
    display: none;
    font-size: 12px;
    transition: left 0.3s ease;
}

/* Adjust feature info when brigade panel is open */
.brigade-panel.open ~ .feature-info {
    left: 590px;
}

.feature-info h4 {
    margin: 0 0 8px 0;
    color: #0078d4;
    font-size: 14px;
}

/* Loading overlay */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1500;
    text-align: center;
    font-size: 14px;
}

/* Compact legend */
#coverage-legend {
    font-size: 10px;
    line-height: 1.3;
}

#coverage-legend .legend-text {
    margin-bottom: 5px;
}

#coverage-legend .opacity-demo-high {
    opacity: 0.12;
}

#coverage-legend .opacity-demo-low {
    opacity: 0.04;
}

#coverage-legend .legend-note {
    color: #666;
    font-style: italic;
}

/* Legend color boxes */
.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 1px solid #ccc;
    vertical-align: middle;
}

.legend-item {
    margin: 4px 0;
    display: flex;
    align-items: center;
}

.legend-color.critical {
    background: #ff6b6b;
}

.legend-color.extended {
    background: #4ecdc4;
}

/* Time controls styling */
.time-controls {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    margin-top: 4px;
    background-color: #f9f9f9;
}

.time-controls-header {
    margin-bottom: 8px;
}

.time-controls-title {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
}

.time-slider-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-label {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#time-value {
    font-weight: 600;
    color: #0078d4;
}

.time-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    cursor: pointer;
}

.time-slider:hover {
    opacity: 1;
}

.time-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0078d4;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.time-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0078d4;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #888;
    margin-top: 4px;
    padding: 0 9px; /* Align with slider thumb centers */
}

.time-controls.collapsed .time-slider-container {
    display: none;
}

/* Hide time controls when isochrones are disabled */
.time-controls.hidden {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .info-panel {
        width: 240px;
    }
    
    #map {
        margin-left: 240px;
    }
    
    .brigade-panel {
        width: 260px;
        left: 240px;
    }
    
    .brigade-panel.open ~ #map {
        margin-left: 500px;
    }
    
    .feature-info {
        left: 250px;
    }
    
    .brigade-panel.open ~ .feature-info {
        left: 510px;
    }
}

/* Hide analysis controls for now */
#analysis-controls {
    display: none;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .info-panel {
        background: rgba(40, 40, 40, 0.96);
        border-right: 2px solid #555;
        color: #e0e0e0;
    }
    
    .panel-header {
        background: rgba(30, 30, 30, 0.8);
        border-bottom: 1px solid #555;
    }
    
    .panel-header h3 {
        color: #4db8ff;
    }
    
    .panel-section {
        border-bottom: 1px solid #444;
    }
    
    .panel-section h4 {
        color: #ccc;
    }
    
    .toggle-text {
        color: #e0e0e0;
    }
    
    .toggle-label:hover .toggle-text {
        color: #4db8ff;
    }
    
    .toggle-label input[type="checkbox"]:checked + .toggle-text {
        color: #4db8ff;
    }
    
    .toggle-label input[type="checkbox"]:not(:checked) + .toggle-text {
        color: #888;
    }
    
    .brigade-panel {
        background: rgba(40, 40, 40, 0.97);
        border-right: 2px solid #555;
        color: #e0e0e0;
    }
    
    .brigade-panel-header {
        background: rgba(44, 85, 48, 0.2);
        border-bottom: 1px solid #555;
    }
    
    .brigade-panel-header h4 {
        color: #6fc276;
    }
    
    .close-brigade-panel {
        color: #ccc;
    }
    
    .close-brigade-panel:hover {
        color: #fff;
    }
    
    .brigade-item {
        border: 1px solid #555;
        background: rgba(50, 50, 50, 0.8);
        color: #e0e0e0;
    }
    
    .brigade-name {
        color: #e0e0e0;
    }
    
    .brigade-turnout {
        color: #ccc;
    }
    
    .brigade-turnout input {
        border: 1px solid #666;
        background: #333;
        color: #e0e0e0;
    }
    
    .reset-color-btn {
        border: 1px solid #666;
        background: #333;
        color: #ccc;
    }
    
    .reset-color-btn:hover {
        background: #444;
        border-color: #4db8ff;
        color: #4db8ff;
    }
    
    .feature-info {
        background: rgba(40, 40, 40, 0.95);
        color: #e0e0e0;
    }
    
    .feature-info h4 {
        color: #4db8ff;
    }
    
    .loading {
        background: rgba(40, 40, 40, 0.95);
        color: #e0e0e0;
    }
    
    .time-controls {
        border: 1px solid #555;
        background-color: #2a2a2a;
    }
    
    .time-controls-title {
        color: #ccc;
    }
    
    .slider-label {
        color: #e0e0e0;
    }
    
    #time-value {
        color: #4db8ff;
    }
    
    .time-slider {
        background: #555;
    }
    
    .time-slider::-webkit-slider-thumb {
        background: #4db8ff;
    }
    
    .time-slider::-moz-range-thumb {
        background: #4db8ff;
    }
    
    .slider-ticks {
        color: #999;
    }
    
    #coverage-legend .legend-note {
        color: #999;
    }
}
