/* Main Styles for Gesture Controlled 3D Particles */

* {
    box-sizing: border-box;
}

body { 
    margin: 0; 
    overflow: hidden; 
    background-color: #050505; 
    color: white; 
    font-family: sans-serif; 
}

/* Video Element */
#videoElement { 
    position: absolute; 
    bottom: 20px; 
    left: 20px;
    width: 240px; 
    height: 180px; 
    transform: scaleX(-1); 
    border: 3px solid #333; 
    border-radius: 8px; 
    z-index: 100;
    object-fit: cover;
    filter: brightness(1.1) contrast(1.2);
}

/* Detection Status Display */
#detectionStatus {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-size: 12px;
    color: #00ff88;
    background: rgba(0, 0, 0, 0.8);
    padding: 5px 10px;
    border-radius: 4px;
    margin-top: 150px;
    z-index: 100;
}

/* Main UI Panel */
#ui { 
    position: absolute; 
    top: 20px; 
    left: 20px; 
    z-index: 100; 
    pointer-events: none; 
    background: rgba(0, 0, 0, 0.6);
    padding: 15px;
    border-radius: 8px;
}

#ui h2 { 
    margin: 0 0 10px 0; 
    color: #00ff88;
    font-size: 16px;
}

#ui p { 
    margin: 5px 0; 
    font-size: 13px; 
}

#loading { 
    color: #00ff88; 
    font-weight: bold; 
    margin-top: 10px; 
}

/* Settings Button */
#settingsButton {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(0, 255, 136, 0.2);
    border: 2px solid #00ff88;
    color: #00ff88;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

#settingsButton:hover {
    background: rgba(0, 255, 136, 0.4);
}

/* Settings Panel */
#settingsPanel {
    position: fixed;
    right: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    background: rgba(10, 10, 10, 0.95);
    border-left: 2px solid #00ff88;
    color: white;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#settingsPanel.open {
    transform: translateX(0);
}

/* Settings Header */
#settingsHeader {
    padding: 15px;
    border-bottom: 1px solid #00ff88;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#settingsHeader h3 {
    margin: 0;
    color: #00ff88;
    font-size: 14px;
}

/* Settings Content */
#settingsContent {
    padding: 15px;
    flex-grow: 1;
    overflow-y: auto;
    max-height: 400px;
}

/* Settings Group */
.settingGroup {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
}

.settingGroup label {
    display: block;
    font-size: 12px;
    color: #00ff88;
    margin-bottom: 5px;
    font-weight: bold;
}

.settingGroup input[type="range"] {
    width: 100%;
    cursor: pointer;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(0, 255, 136, 0.2);
    border-radius: 3px;
    outline: none;
}

.settingGroup input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00ff88;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}

.settingGroup input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00ff88;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}

.settingGroup input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #00ff88;
}

.settingGroup select {
    width: 100%;
    padding: 6px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid #00ff88;
    color: #00ff88;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.settingGroup select option {
    background: #0a0a0a;
    color: #00ff88;
}

/* Close Button */
#settingsClose {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    transition: color 0.3s;
}

#settingsClose:hover {
    color: #ffdd00;
}

/* Scrollbar Styling for Settings Content */
#settingsContent::-webkit-scrollbar {
    width: 6px;
}

#settingsContent::-webkit-scrollbar-track {
    background: rgba(0, 255, 136, 0.1);
}

#settingsContent::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.5);
    border-radius: 3px;
}

#settingsContent::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.8);
}

/* Responsive Design for Mobile */
@media (max-width: 1024px) {
    #ui {
        font-size: 11px;
        padding: 10px;
        top: 10px;
        left: 10px;
    }

    #ui p {
        margin: 3px 0;
        font-size: 11px;
    }

    #settingsButton {
        padding: 6px 10px;
        font-size: 12px;
        top: 10px;
        right: 10px;
    }

    #videoElement {
        width: 180px;
        height: 135px;
        bottom: 10px;
        left: 10px;
    }

    #detectionStatus {
        bottom: 145px;
        left: 10px;
        font-size: 10px;
    }

    #detectionFeedback {
        bottom: 160px;
        right: 10px;
        font-size: 10px;
    }
}

@media (max-width: 768px) {
    #ui {
        font-size: 10px;
        padding: 8px;
        top: 5px;
        left: 5px;
    }

    #ui h2 {
        font-size: 13px;
    }

    #ui p {
        margin: 2px 0;
        font-size: 9px;
    }

    #settingsButton {
        padding: 5px 8px;
        font-size: 11px;
        top: 5px;
        right: 5px;
    }

    #videoElement {
        width: 160px;
        height: 120px;
        bottom: 5px;
        left: 5px;
    }

    #detectionStatus {
        bottom: 125px;
        left: 5px;
        font-size: 9px;
        padding: 3px 6px;
    }

    #detectionFeedback {
        bottom: 140px;
        right: 5px;
        font-size: 9px;
    }

    .handIndicator {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }

    #fpsCounter {
        padding: 2px 6px;
        font-size: 9px;
    }

    #inputModeIndicator {
        padding: 4px 8px;
        font-size: 9px;
        min-width: 80px;
    }

    #qualityBar {
        width: 70px;
        height: 3px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 12px;
    }

    #ui {
        font-size: 9px;
        padding: 6px;
        top: 3px;
        left: 3px;
        max-width: 150px;
    }

    #ui h2 {
        font-size: 11px;
        margin: 0 0 5px 0;
    }

    #ui p {
        margin: 1px 0;
        font-size: 8px;
        line-height: 1.2;
    }

    #loading {
        font-size: 8px;
    }

    #settingsButton {
        padding: 4px 6px;
        font-size: 10px;
        top: 3px;
        right: 3px;
    }

    #videoElement {
        width: 120px;
        height: 90px;
        bottom: 3px;
        left: 3px;
        border-width: 2px;
    }

    #detectionStatus {
        bottom: 93px;
        left: 3px;
        font-size: 8px;
        padding: 2px 4px;
    }

    #detectionFeedback {
        bottom: 108px;
        right: 3px;
        font-size: 8px;
    }

    .handIndicator {
        width: 14px;
        height: 14px;
        font-size: 8px;
        border-width: 1px;
    }

    #fpsCounter {
        padding: 2px 4px;
        font-size: 8px;
    }

    #inputModeIndicator {
        padding: 3px 6px;
        font-size: 8px;
        min-width: 70px;
        border-width: 1px;
    }

    #qualityBar {
        width: 60px;
        height: 2px;
    }

    #settingsPanel {
        width: 100%;
        max-width: 280px;
    }

    #settingsHeader {
        padding: 10px;
    }

    #settingsHeader h3 {
        font-size: 12px;
    }

    #settingsContent {
        padding: 10px;
    }

    .settingGroup {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .settingGroup label {
        font-size: 10px;
    }

    .settingGroup input[type="range"] {
        height: 5px;
    }

    .settingGroup input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 360px) {
    #ui {
        max-width: 140px;
    }

    #videoElement {
        width: 100px;
        height: 75px;
    }

    #detectionFeedback {
        bottom: 80px;
    }

    #settingsPanel {
        max-width: 100%;
    }
}

/* Landscape mode optimizations */
@media (max-height: 600px) {
    #ui {
        top: 5px;
    }

    #videoElement {
        bottom: 5px;
        width: 150px;
        height: 112px;
    }

    #detectionStatus {
        bottom: 115px;
    }

    #settings content {
        max-height: 300px;
    }
}

/* High DPI/Retina screen optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Increase border/line widths slightly for clarity */
    #ui {
        border: 1px solid rgba(0, 255, 136, 0.3);
    }

    #settingsPanel {
        border-left-width: 3px;
    }

    #settingsButton {
        border-width: 2px;
    }
}
