body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    display: block;
    min-height: 100vh;
    background-color: #f0f2f5; /* Light grey background */
    overflow-y: auto;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 0;
    margin: auto;
    background-color: #fff; /* White container */
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

/* Layout container for two-column layout */
.layout-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Left column (camera and tabs) */
.left-column {
    width: 100%;
    margin-bottom: 20px;
}

/* Right column (controls) */
.right-column {
    /*width: 100%;*/
    padding: 0 20px;
}

/* Media query for tablet and desktop views */
@media (min-width: 768px) {
    .layout-container {
        flex-direction: row;
        gap: 20px;
    }

    .left-column {
        width: 60%;
        margin-bottom: 0;
    }

    .right-column {
        width: 40%;
    }
}
h1 {
    text-align: center;
    color: #2c3e50; /* Dark blue */
    margin-bottom: 15px;

}

/*Device Tabs*/
.device-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
    justify-content: flex-start; /* Align tabs to the start */
    overflow-x: auto; /* Enable horizontal scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    white-space: nowrap; /* Prevent wrapping to new line */
    scrollbar-width: thin; /* Firefox */
    padding-bottom: 5px; /* Space for scrollbar */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.device-tabs::-webkit-scrollbar {
    height: 4px;
}

/* Track */
.device-tabs::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

/* Handle */
.device-tabs::-webkit-scrollbar-thumb {
    background: #888; 
    border-radius: 10px;
}

/* Handle on hover */
.device-tabs::-webkit-scrollbar-thumb:hover {
    background: #555; 
}

@media (min-width: 768px) {
    .device-tabs {
        margin-bottom: 0; /* Remove bottom margin on tablet/desktop */
    }

    .device-tabs button {
        font-size: 1.1em; /* Larger buttons on tablet/desktop */
        padding: 12px 18px;
    }

    .room-view-btn {
        padding: 8px 16px !important; /* Larger room view buttons */
        font-size: 1em !important;
    }
}
/* Make device tabs (rooms) display inline */
#deviceTabs > button {
    flex-shrink: 0; /* Prevent buttons from shrinking */
}
.device-tabs button {
    padding: 10px 15px;
    font-size: 1em;
    background-color: #f0f2f5;
    color: #34495e;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: background-color 0.3s;
}

.device-tabs button:hover {
    background-color: #e5e8ec;
}

.device-tabs button.active {
    background-color: #fff; /* White container */
    color: #2c3e50; /* Dark blue */
    border-bottom: 2px solid #3498db; /* Blue selected tab */
}

/* Room View Buttons inside Device Tabs */
.room-view-buttons {
    display: flex;
    align-items: center;
    margin-left: auto; /* Push to the right */
    float: right; /* Explicitly float to the right */
}

.room-view-btn {
    padding: 6px 12px !important;
    font-size: 0.9em !important;
    background-color: #3498db !important;
    color: #fff !important;
    border: 1px solid #2980b9 !important;
    border-radius: 4px !important;
    margin-left: 5px !important;
}

.room-view-btn:hover {
    background-color: #2980b9 !important;
}

.room-view-btn.active {
    /* Button visibility now controlled by JavaScript */
}

/* Room view styles moved to .room-view-btn above */

.control-grid{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Cards in grid */
    grid-gap: 10px;
}

@media (min-width: 768px) {
    .control-grid {
        grid-template-columns: repeat(2, 1fr); /* Two columns on tablet */
    }
}

@media (min-width: 992px) {
    .control-grid {
        grid-template-columns: repeat(2, 1fr); /* Two columns on desktop */
    }
}

.card{
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.card h2 {
    color: #34495e; /* Darker grey heading */
    margin-bottom: 10px;
    font-size: 1.2em;
}
.treat-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;

}
.treat-controls button {
    margin-bottom: 10px;
}

/* Style for the beep switch container */
.treat-controls div {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Style for the beep label */
.treat-controls span {
    margin-right: 0;
    font-size: 0.9em;
}
.temp-controls{
    display: flex;
    justify-content: space-around;
    margin-top: 10px;

}

.btn {
    padding: 10px 14px;
    font-size: 1em;
    background-color: #3498db; /* Medium blue */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9; /* Darker blue */
}
.small-btn {
    padding: 8px 10px;
    font-size: 0.9em;
}

/* Slider for buzzer */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}
input:checked + .slider {
    background-color: #2ecc71; /* Green */
}
input:focus + .slider {
    box-shadow: 0 0 1px #2ecc71; /* Green */
}
input:checked + .slider:before {
    -webkit-transform: translateX(20px);
    -ms-transform: translateX(20px);
    transform: translateX(20px);
}
.slider.round{
    border-radius: 34px;
}
.slider.round:before {
    border-radius: 50%;
}
.temp-controls {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
}
#temperatureCard p {
    font-size: 1.3em;
    font-weight: bold;
    text-align: center;
    margin-top: 15px;
    margin-bottom: 0;

}

.command-status {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 80%;
    max-width: 600px;
    padding: 10px;
    background-color: #e8f5e9; /* Light green background */
    border: 1px solid #a5d6a7; /* Light green border */
    border-radius: 4px;
    color: #388e3c; /* Dark green text */
    text-align: center;
    font-size: 1em;
    z-index: 1000;
    display: none; /* Hidden by default */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Treats Progress Bar */
.treats-progress-wrapper {
    display: flex;
    align-items: center;
    margin-top: 15px;
    width: 100%;
}

.treats-progress-container {
    flex-grow: 1;
    background-color: #e0e0e0;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    position: relative;
}

.treats-progress-bar {
    height: 100%;
    background-color: #4CAF50;
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 100%; /* Set initial width to 100% */
}

.refresh-btn {
    margin-left: 10px;
    padding: 5px 8px !important;
    border-radius: 50% !important;
    font-size: 16px !important;
    line-height: 1;
    min-width: 30px;
    min-height: 30px;
}

.treats-count {
    margin-top: 5px;
    text-align: center;
    font-size: 14px;
    color: #555;
    display: none;
}

/* Video player styling */
video {
    display: block;
    margin: 0 auto 20px;
    border-radius: 8px;
    background-color: #000;
}

/* Video container for positioning the buffering overlay */
.video-container {
    position: relative;
    width: 100%;
    margin: 0 auto 15px;
}

@media (min-width: 768px) {
    .video-container iframe {
        height: 600px !important; /* Make video bigger on tablet/desktop */
    }
}

/* Custom buffering indicator */
.buffering-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    opacity: 0.7; /* More visible buffering animation */
    display: block; /* Show by default */
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

#installBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    padding: 12px 20px;
    font-size: 16px;
    background-color: orange;
    color: white;
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

#installBtn:hover {
    transform: scale(1.05);
}

.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #95a5a6; /* Grey background for disabled buttons */
}

/* Styles for stream resizing */
.stream-container {
    transition: all 0.3s ease;
}

.zoomie.fullsize {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    aspect-ratio: auto;
    background-color: #000;
}

.zoomie.fullsize video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 100vh;
}
