/* webapp/style.css */

:root {
    --bg-color: #282c34;
    --text-color: #abb2bf;
    --primary-color: #61afef;
    --green: #50fa7b;
    --red: #ff5555;
    --orange: #ffb86c;
    --secondary-color: #444a56;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
}

.container {
    padding: 20px;
    width: 100%;
    max-width: 400px;
}

h1 {
    color: var(--primary-color);
    margin-top: 0;
}

#status {
    font-weight: bold;
    margin: 20px 0;
    padding: 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.status-connected {
    color: var(--green);
    background-color: rgba(80, 250, 123, 0.1);
}
.status-disconnected {
    color: var(--red);
    background-color: rgba(255, 85, 85, 0.1);
}
.status-connecting {
    color: var(--orange);
    background-color: rgba(255, 184, 108, 0.1);
}

/* Base style for buttons in the initial view */
#initial-view button {
    width: 100%;
    padding: 20px;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;

    /* Flexbox for aligning icon and text */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px; /* Space between icon and text */
}

#initial-view button:active {
    transform: scale(0.97);
}

/* Primary "Scan" button style */
#initial-view #scanBtn {
    background-color: var(--primary-color);
    color: var(--bg-color);
}

#initial-view #scanBtn:hover {
    background-color: #7ac0f1;
}

/* Icon sizing for initial view buttons */
#initial-view button svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2.5; /* Slightly thicker stroke for visibility */
}

.main-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 25px;
}

/* General style for all icon buttons in the grid */
.main-controls-grid button {
    width: 80px;
    height: 80px;
    padding: 0; /* Remove padding to rely on flex centering */
    font-size: 1.5em; /* This is now for fallback text, not the icon */
    font-weight: bold;
    border: none;
    border-radius: 50%; /* Make the buttons circular */
    cursor: pointer;
    background-color: var(--secondary-color);
    color: var(--text-color);
    transition: transform 0.1s ease, background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    
    /* Flexbox for perfect icon centering */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Place the button in the center of its grid cell */
    margin: 0 auto;
}

.main-controls-grid button:hover {
    background-color: #525967;
}

.main-controls-grid button:active {
    transform: scale(0.95);
}

/* Style the big, central play/pause button differently */
.main-controls-grid .btn-play-pause {
    width: 100px;
    height: 100px;
    background-color: var(--primary-color);
    color: var(--bg-color);
    grid-row: 2; /* Place it on the second row */
    grid-column: 2; /* Place it in the middle column */
}

.main-controls-grid .btn-play-pause:hover {
    background-color: #7ac0f1;
}

/* Control the size and color of the SVG icons themselves */
.controls button svg {
    width: 45%; /* Size the icon relative to the button size */
    height: 45%;
    stroke: currentColor; /* The magic! Icon color will match the button's text color */
    stroke-width: 2;
}

/* Update the secondary disconnect button for its icon */
.controls button.btn-secondary {
    width: 100%;
    background-color: var(--secondary-color);
    color: var(--text-color);
    font-size: 1em;
    padding: 15px;
    border-radius: 10px; /* Back to a rectangle */
    display: flex; /* Use flex to align icon and text */
    justify-content: center;
    align-items: center;
    gap: 10px; /* Space between icon and text */
}

.controls button.btn-secondary:hover {
    background-color: #525967;
}

.controls button.btn-secondary svg {
    width: 20px; /* Fixed size for this button's icon */
    height: 20px;
}

#qr-reader {
    width: 100%;
    max-width: 300px;
    margin: 20px auto;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    overflow: hidden; /* Keeps the video feed inside the rounded corners */
}

/* --- CUSTOM VOLUME SLIDER STYLES --- */

.volume-control {
    margin-bottom: 25px;
    /* Use Flexbox to align the icons and slider */
    display: flex;
    align-items: center;
    gap: 15px; /* Creates space between the icons and the slider */
    padding: 0 20px;
}

.volume-control svg {
    width: 24px;
    height: 24px;
    stroke: var(--text-color);
    /* Make the icons slightly less prominent than the slider thumb */
    opacity: 0.6;
    /* Prevent the icons from shrinking */
    flex-shrink: 0;
}

/* --- Cross-browser Slider Styling --- */
#volumeSlider {
    /* Reset default appearance */
    -webkit-appearance: none;
    appearance: none;
    
    /* Make the slider take up the available space */
    width: 100%; 
    flex-grow: 1;

    height: 8px; /* Height of the track */
    background: transparent; /* The input element itself is transparent */
    cursor: pointer;
}

/* Style the Track (the bar) */
#volumeSlider::-webkit-slider-runnable-track {
    height: 8px;
    background: var(--secondary-color);
    border-radius: 4px;
}
#volumeSlider::-moz-range-track {
    height: 8px;
    background: var(--secondary-color);
    border-radius: 4px;
}

/* Style the Thumb (the circle you drag) */
#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none; /* Override default look */
    appearance: none;
    margin-top: -6px; /* Vertically center thumb on the track */
    
    background-color: var(--primary-color);
    height: 20px;
    width: 20px;
    border-radius: 50%;
    border: 2px solid var(--bg-color);
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
}
#volumeSlider::-moz-range-thumb {
    background-color: var(--primary-color);
    height: 20px;
    width: 20px;
    border-radius: 50%;
    border: 2px solid var(--bg-color);
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
}

/* Add a subtle press effect to the thumb */
#volumeSlider:active::-webkit-slider-thumb {
    transform: scale(1.1);
}
#volumeSlider:active::-moz-range-thumb {
    transform: scale(1.1);
}