/* Basic resets for a full-screen mobile experience */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow-x: hidden; /* Allow vertical scrolling for controls */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #121212; /* A dark theme is better for camera apps */
    color: #e0e0e0;
}

/* Main application container, using flexbox for layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Full viewport height */
}

/* Header: Stays at the top */
.header {
    text-align: center;
    padding: 1rem 0.5rem;
    flex-shrink: 0; /* Prevents this from shrinking */
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 10; /* Ensure header is on top */
    position: relative;
}
.header h1, .header p {
    margin: 0;
    padding: 0;
}
.header h1 {
    font-size: 1.5rem;
}
.header p {
    font-size: 0.9rem;
    color: #aaa;
}

/* Controls panel for sliders */
.controls-panel {
    background-color: #1f1f1f;
    padding: 1rem;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #ccc;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #333;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
}

.reset-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.reset-btn:hover {
    background: #ff5252;
}

/* Video container: This will grow to fill the available space */
.video-container {
    flex-grow: 1; /* This is the key property to make it fill space */
    position: relative;
    background-color: #000; /* Black background while camera loads */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Prevent any overflow */
    min-height: 300px; /* Ensure minimum height */
}

/* Update video and canvas styles for better visibility */
video, canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from cover to contain */
}

video {
    z-index: 1;
    display: block !important; /* Force display */
}

canvas {
    z-index: 2;
    display: block;
    background-color: transparent; /* Ensures transparency */
}

/* Controls container: Fixed space at the bottom */
.controls-container {
    height: 60px; /* Reserve a fixed space for info */
    flex-shrink: 0; /* Prevents this from shrinking */
    background-color: #1f1f1f;
    border-top: 1px solid #333;
    display: flex;
    justify-content: space-between; /* Changed from center to space-between */
    align-items: center;
    padding: 1rem;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

.detection-info {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    color: #aaa;
}

/* Add counter display styles */
#counter-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: #4CAF50;
    margin-top: 0.5rem;
}

#circle-count {
    display: inline-block;
    min-width: 30px;
    padding: 2px 8px;
    background: rgba(76, 175, 80, 0.2);
    border-radius: 4px;
}

.camera-switch-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 1rem;
}

.camera-switch-btn:hover {
    background: #45a049;
}