/* Brand Colors:
   Primary: #93CCEA (light blue)
   Gray: #939598
   Secondary Dark: #000033 (navy)
   Secondary Blue: #3066BE
*/

html, body {
    background-color: #000033;
    color: white;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
}

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

video, canvas {
    position: fixed;
    top: 0;
    left: 0;
}

/* Control Panel */
#controlPanel {
    position: fixed;
    top: 20px;
    right: 20px;
    bottom: 20px;
    background: rgba(0, 0, 51, 0.95);
    border: 2px solid #93CCEA;
    border-radius: 8px;
    padding: 20px;
    z-index: 100;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(147, 204, 234, 0.4);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for control panel */
#controlPanel::-webkit-scrollbar {
    width: 8px;
}

#controlPanel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

#controlPanel::-webkit-scrollbar-thumb {
    background: rgba(147, 204, 234, 0.5);
    border-radius: 4px;
}

#controlPanel::-webkit-scrollbar-thumb:hover {
    background: rgba(147, 204, 234, 0.8);
}

#controlPanel h2 {
    margin: 0 0 20px 0;
    font-size: 1.5em;
    color: #93CCEA;
    text-align: center;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #93CCEA;
    font-size: 0.9em;
}

.control-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #3066BE;
    border-radius: 4px;
    background: rgba(0, 0, 51, 0.7);
    color: white;
    font-size: 14px;
    box-sizing: border-box;
}

.control-group input:focus {
    outline: none;
    border-color: #93CCEA;
    box-shadow: 0 0 8px rgba(147, 204, 234, 0.5);
}

.control-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.control-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #3066BE;
    border-radius: 4px;
    background: rgba(0, 0, 51, 0.7);
    color: white;
    font-size: 14px;
    box-sizing: border-box;
    cursor: pointer;
}

.control-group select:focus {
    outline: none;
    border-color: #93CCEA;
    box-shadow: 0 0 8px rgba(147, 204, 234, 0.5);
}

.control-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.control-group select option {
    background: #000033;
    color: white;
}

.control-group small {
    display: block;
    margin-top: 5px;
    color: #939598;
    font-size: 0.8em;
}

.control-group .rate-info {
    color: #93CCEA;
    font-style: italic;
}

/* Slider Styles */
.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(147, 204, 234, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #93CCEA;
    cursor: pointer;
    border: 2px solid #000033;
    box-shadow: 0 0 8px rgba(147, 204, 234, 0.6);
}

.slider::-webkit-slider-thumb:hover {
    background: #3066BE;
    box-shadow: 0 0 12px rgba(147, 204, 234, 0.8);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #93CCEA;
    cursor: pointer;
    border: 2px solid #000033;
    box-shadow: 0 0 8px rgba(147, 204, 234, 0.6);
}

.slider::-moz-range-thumb:hover {
    background: #3066BE;
    box-shadow: 0 0 12px rgba(147, 204, 234, 0.8);
}

.slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

.slider-labels small {
    color: #939598;
    font-size: 0.75em;
}

#detectionRateValue {
    color: #93CCEA;
    font-weight: bold;
}

/* Advanced Settings Section */
.advanced-section {
    margin-top: 20px;
    border-top: 1px solid rgba(147, 204, 234, 0.3);
    padding-top: 15px;
}

.toggle-btn {
    width: 100%;
    padding: 10px;
    background: rgba(147, 204, 234, 0.1);
    border: 1px solid #3066BE;
    border-radius: 4px;
    color: #93CCEA;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.toggle-btn:hover {
    background: rgba(147, 204, 234, 0.2);
    box-shadow: 0 0 8px rgba(147, 204, 234, 0.4);
}

.toggle-btn:active {
    background: rgba(147, 204, 234, 0.3);
}

.advanced-content {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 51, 0.5);
    border: 1px solid rgba(147, 204, 234, 0.2);
    border-radius: 4px;
}

.settings-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.control-group.half {
    flex: 1;
    margin-bottom: 0;
}

.help-text {
    display: block;
    color: #939598;
    font-size: 0.75em;
    margin-top: 10px;
    line-height: 1.4;
}

.section-heading {
    color: #93CCEA;
    font-size: 0.95em;
    margin: 20px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(147, 204, 234, 0.3);
    font-weight: bold;
}

.section-heading:first-child {
    margin-top: 0;
}

#panSpeedValue,
#tiltSpeedValue,
#centerOffsetXValue,
#centerOffsetYValue,
#deadzoneXValue,
#deadzoneYValue,
#minHeadroomValue,
#maxHeadroomValue,
#zoomSpeedValue {
    color: #93CCEA;
    font-weight: bold;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #93CCEA;
    cursor: pointer;
}

.checkbox-label span {
    font-weight: 600;
    color: #93CCEA;
}

.control-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-start {
    background: #93CCEA;
    color: #000033;
    font-weight: bold;
}

.btn-start:hover:not(:disabled) {
    background: #3066BE;
    color: white;
    box-shadow: 0 0 10px rgba(147, 204, 234, 0.5);
}

.btn-stop {
    background: #939598;
    color: white;
}

.btn-stop:hover:not(:disabled) {
    background: #000033;
    border: 1px solid #93CCEA;
    box-shadow: 0 0 10px rgba(147, 204, 234, 0.5);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status-message {
    margin-top: 15px;
    padding: 10px;
    background: rgba(147, 204, 234, 0.1);
    border: 1px solid #93CCEA;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9em;
}

.status-message.error {
    background: rgba(255, 0, 0, 0.1);
    border-color: #FF6666;
    color: #FF6666;
}

/* FPS Counter */
#fps {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 51, 0.8);
    padding: 5px 10px;
    border: 1px solid #93CCEA;
    border-radius: 4px;
    color: #93CCEA;
    z-index: 100;
}

#fps:empty {
    display: none;
}

#fps:after {
    content: " detections/sec";
}

/* Manual PTZ Controls */
.manual-ptz-section {
    margin-top: 20px;
    border-top: 1px solid rgba(147, 204, 234, 0.3);
    padding-top: 15px;
}

.ptz-controls-grid {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
}

.ptz-dpad {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
    gap: 4px;
}

.ptz-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #3066BE;
    border-radius: 6px;
    background: rgba(147, 204, 234, 0.15);
    color: #93CCEA;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ptz-btn:hover {
    background: rgba(147, 204, 234, 0.3);
    border-color: #93CCEA;
    box-shadow: 0 0 8px rgba(147, 204, 234, 0.4);
}

.ptz-btn:active {
    background: #3066BE;
    color: white;
    transform: scale(0.95);
}

.ptz-up { grid-column: 2; grid-row: 1; }
.ptz-left { grid-column: 1; grid-row: 2; }
.ptz-home { grid-column: 2; grid-row: 2; font-size: 18px; }
.ptz-right { grid-column: 3; grid-row: 2; }
.ptz-down { grid-column: 2; grid-row: 3; }

.zoom-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.zoom-label {
    font-size: 0.75em;
    color: #939598;
    text-transform: uppercase;
}

.ptz-zoom {
    width: 44px;
    height: 36px;
    font-size: 20px;
    font-weight: bold;
}

/* Performance Note */
.performance-note {
    margin-top: 20px;
    padding: 15px;
    background: rgba(147, 204, 234, 0.08);
    border: 1px solid rgba(147, 204, 234, 0.25);
    border-radius: 6px;
}

.performance-note p {
    margin: 10px 0;
    font-size: 0.85em;
    color: #ccc;
    line-height: 1.5;
}

.performance-note ol {
    margin: 10px 0;
    padding-left: 20px;
    font-size: 0.8em;
    color: #aaa;
}

.performance-note li {
    margin: 6px 0;
}

.performance-note code {
    background: rgba(0, 0, 51, 0.6);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #93CCEA;
}

.docs-link {
    display: inline-block;
    margin-top: 10px;
    color: #93CCEA;
    font-size: 0.85em;
    text-decoration: none;
    transition: color 0.2s;
}

.docs-link:hover {
    color: #3066BE;
    text-decoration: underline;
}
