/* WiFi Mesh Section - Constrain width and add padding */
.wifi-mesh-section {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 40px;
}

/* Override camera-container height for WiFi mesh section */
.wifi-mesh-section .camera-container {
    min-height: 500px !important;
    max-height: 600px;
}

/* WiFi Mesh Visualizer Styles */

.wifi-mesh-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto auto;
    gap: 20px;
    margin-top: 20px;
}

/* Canvas Wrapper */
.canvas-wrapper {
    position: relative;
    background: #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    min-height: 600px;
}

#meshCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 26, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(74, 158, 255, 0.3);
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Camera Presets */
.camera-presets {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    z-index: 5;
}

.preset-btn {
    padding: 8px 16px;
    background: rgba(42, 42, 42, 0.9);
    color: #e0e0e0;
    border: 1px solid #4a9eff;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: rgba(74, 158, 255, 0.2);
}

.preset-btn.active {
    background: #4a9eff;
    color: white;
}

/* Auto-rotate Toggle */
.auto-rotate-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 5;
}

.auto-rotate-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(42, 42, 42, 0.9);
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    color: #e0e0e0;
}

.auto-rotate-toggle input[type="checkbox"] {
    cursor: pointer;
}

/* Reset View Button */
.reset-view-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(42, 42, 42, 0.9);
    color: #e0e0e0;
    border: 1px solid #4a9eff;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 5;
}

.reset-view-btn:hover {
    background: #4a9eff;
    color: white;
}

/* Playback Controls */
.playback-controls {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    grid-column: 1 / 2;
    grid-row: 3 / 4;
}

/* Timeline */
.timeline-container {
    margin-bottom: 20px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #999;
    font-size: 14px;
}

.date-display {
    color: #4a9eff;
    font-weight: bold;
}

.timeline-wrapper {
    position: relative;
}

#timelineScrubber {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #444;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

#timelineScrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
}

#timelineScrubber::-webkit-slider-thumb:hover {
    background: #3a8eef;
    transform: scale(1.2);
}

#timelineScrubber::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #4a9eff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
}

#timelineScrubber::-moz-range-thumb:hover {
    background: #3a8eef;
    transform: scale(1.2);
}

/* Timeline Events */
.timeline-events {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    pointer-events: none;
}

.timeline-event {
    position: absolute;
    width: 2px;
    height: 8px;
    background: #ffeb3b;
    opacity: 0.7;
}

/* Transport Controls */
.transport-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.control-btn {
    background: #444;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #e0e0e0;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #555;
    transform: scale(1.1);
}

.control-btn.play-btn {
    width: 60px;
    height: 60px;
    background: #4a9eff;
}

.control-btn.play-btn:hover {
    background: #3a8eef;
}

.control-btn.playing .play-icon {
    display: none;
}

.control-btn.playing .pause-icon {
    display: block !important;
}

/* Speed Controls */
.speed-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.speed-controls label {
    color: #999;
    font-size: 14px;
}

.speed-btn {
    padding: 6px 12px;
    background: #444;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    min-width: 50px;
}

.speed-btn:hover {
    background: #555;
}

.speed-btn.active {
    background: #4a9eff;
    border-color: #4a9eff;
    color: white;
}

/* Date Selector */
.date-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.date-selector label {
    color: #999;
    font-size: 14px;
}

.date-selector input[type="date"] {
    padding: 8px 12px;
    background: #444;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
}

.date-selector input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* Detection Legend */
.detection-legend {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.detection-legend h3 {
    color: #4a9eff;
    margin-bottom: 15px;
    font-size: 18px;
}

.legend-items {
    margin-bottom: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: #e0e0e0;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    display: inline-block;
}

/* Statistics Panel */
.stats-panel {
    border-top: 1px solid #444;
    padding-top: 15px;
    margin-top: 15px;
}

.stats-panel h4 {
    color: #4a9eff;
    margin-bottom: 12px;
    font-size: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: #e0e0e0;
    font-size: 14px;
}

.stat-item span:last-child {
    color: #4a9eff;
    font-weight: bold;
}

/* Info Panel */
.info-panel-mesh {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.info-panel-mesh h3 {
    color: #4a9eff;
    margin-bottom: 15px;
    font-size: 18px;
}

.info-panel-mesh p {
    margin-bottom: 12px;
    color: #ccc;
    font-size: 14px;
    line-height: 1.6;
}

.info-panel-mesh ul {
    margin: 15px 0;
    padding-left: 20px;
    color: #ccc;
}

.info-panel-mesh li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.info-note {
    font-style: italic;
    color: #999;
    font-size: 13px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #444;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .wifi-mesh-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
    }

    .canvas-wrapper {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        min-height: 400px;
    }

    .playback-controls {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }

    .detection-legend {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }

    .info-panel-mesh {
        grid-column: 1 / 2;
        grid-row: 4 / 5;
    }

    .camera-presets {
        flex-wrap: wrap;
        max-width: 300px;
    }
}

@media (max-width: 768px) {
    .canvas-wrapper {
        min-height: 300px;
    }

    .preset-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .control-btn {
        width: 40px;
        height: 40px;
    }

    .control-btn.play-btn {
        width: 50px;
        height: 50px;
    }

    .speed-btn {
        padding: 4px 10px;
        font-size: 12px;
        min-width: 40px;
    }

    .transport-controls {
        gap: 10px;
    }

    .speed-controls {
        gap: 5px;
    }
}
