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

/* Body Styling */
body {
    font-family: Arial, sans-serif;
    background-color: #f9f9f9;
    color: #333;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Container */
.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
}

/* Heading */
h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    color: #2c3e50;
}

/* Toggle Button */
.toggle-button {
    width: auto;
    padding: 0.7rem;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background-color: #27ae60;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
    align-self: center;
}

.toggle-button.stop {
    background-color: #e74c3c;
}

.toggle-button:hover {
    opacity: 0.9;
}

/* Video Container */
.video-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background-color: #000;
    margin-top: 0.5rem;
}

video, canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

canvas {
    opacity: 0.5;
}

/* Controls Section */
.controls {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
}

.control-group {
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: bold;
    font-size: 0.9rem;
}

.control-group input[type="range"],
.control-group select {
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
    transition: border-color 0.2s ease-in-out;
}

.control-group input[type="range"]:focus,
.control-group select:focus {
    border-color: #3498db;
    outline: none;
}

/* Camera Selection */
#cameraSelect {
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
    transition: border-color 0.2s ease-in-out;
}

#cameraSelect:focus {
    border-color: #3498db;
    outline: none;
}

/* Status Section */
.status {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

#motionStatus {
    flex: 1 1 100%;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 0.5rem;
    border-radius: 4px;
    background-color: #27ae60;
    color: white;
}

#motionStatus.active {
    background-color: #e74c3c;
}

#stats {
    display: flex;
    flex: 1;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
}

#stats span {
    font-size: 0.9rem;
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }

    .control-group {
        flex: 1 1 48%;
    }

    #stats {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.2rem;
    }

    .control-group {
        flex: 1 1 100%;
    }

    #motionStatus {
        font-size: 1rem;
    }

    #stats span {
        font-size: 0.8rem;
    }
}
