/* =================================================================
   1. Base & Variables
   ================================================================= */
:root {
    --primary-color: #5081b8;
    --primary-color-hover: #4975a7;
    --primary-color-active: #3271b9;
    --text-on-primary: #ffffff;
    --text-color-main: #333;
    --text-color-secondary: #3a4c65;
    
    --bg-main: #f5f7fa;
    --bg-container: #ffffff;
    --bg-card: #f4f7f9;
    --bg-tab-inactive: #d1d9e6;
    --bg-tab-hover: #a8bddb;

    --status-good: rgb(16, 138, 16);
    --status-poor: rgb(255, 166, 0);
    --status-closed: rgb(179, 20, 20);

    --shadow-main: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.2);
    --shadow-active: 0 3px 8px rgba(0, 0, 0, 0.15);

    --border-radius-sm: 5px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;

    --base-font-size: 1.5vmin;
}

/* Dark Theme Variables */
html[data-theme='dark'] {
    --primary-color: #5081b8;
    --primary-color-hover: #4975a7;
    --primary-color-active: #3271b9;
    --text-on-primary: #0d1117;
    --text-color-main: #c9d1d9;
    --text-color-secondary: #8b949e;

    --bg-main: #1f232a;
    --bg-container: #1b1f27;
    --bg-card: #1c212b;
    --bg-tab-inactive: #242e3d;
    --bg-tab-hover: #2e4358;
    --input-bg: #0d1117;
    --input-border: #30363d;
    --table-header-bg: #161b22;
    --table-row-bg: #0d1117;
    --table-row-hover-bg: #161b22;
    --dropdown-bg: #161b22;
    --dropdown-hover-bg: #21262d;

    --shadow-main: 0 4px 15px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.4);
    --shadow-active: 0 3px 8px rgba(0, 0, 0, 0.25);
}

html, body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 1vmin;
    overflow-y: auto;
    background-color: var(--bg-main);
    font-size: var(--base-font-size);
    width: 100vw;
    min-height: 100vh;
}

h1, h2, h3, h4, h5 {
    margin: 0;
    padding: 1vmin;
    color: var(--text-color-main);
}
h1 { font-size: 5vmin; }
h2 { font-size: 3vmin; }
h3 { font-size: 2vmin; }
h4 { font-size: 1.5vmin; }
h5 { font-size: 1vmin; padding: 0.1vmin; }

input, button {
    font-family: inherit;
    font-size: 1.5vmin;
}

canvas {
    max-width: 100%;
    height: 60vmin;
    max-height: 400px;
}

footer {
    text-align: center;
    padding: 1vmin;
    flex-shrink: 0;
    font-size: 1.2vmin;
}

/* =================================================================
   2. Layout & Container
   ================================================================= */
.container {
    padding: 2vmin;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-main);
    width: 90vw;
    max-width: 1200px;
    min-width: 300px;
    overflow-y: auto;
    transition: box-shadow 0.3s ease;
    text-align: center;
    margin: 0 auto;
}
.container:hover {
    box-shadow: var(--shadow-hover);
}

.tab-content {
    display: none;
    overflow-y: auto;
    max-height: calc(100vh - 10vmin);
    padding: 2vmin;
    background-color: var(--bg-container);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-main);
    transition: opacity 0.3s ease-in-out;
}
.tab-content.active {
    display: block;
    opacity: 1;
}

/* =================================================================
   3. Tabs
   ================================================================= */
.tab-buttons {
    display: flex;
    justify-content: center; /* Changed from space-around to center for a better look */
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 2vmin;
    background-color: var(--bg-main);
    padding: 1vmin;
    border-radius: var(--border-radius-md);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.tab-button {
    background-color: var(--bg-tab-inactive);
    border: none;
    padding: 1vmin 2vmin; /* Default padding for inactive tabs */
    cursor: pointer;
    font-size: 2vmin;
    color: var(--text-color-secondary);
    border-radius: var(--border-radius-sm);
    margin: 0.5vmin;
    /* Added 'padding' to the transition to animate the width change smoothly */
    transition: background-color 0.3s, transform 0.2s, padding 0.4s ease-in-out;
    font-weight: bold;
    flex-shrink: 0; /* Prevents buttons from shrinking if the container gets crowded */
}

.tab-button:hover {
    background-color: var(--bg-tab-hover);
    transform: translateY(-2px);
}

.tab-button.active {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-active);
    /* --- KEY CHANGE --- */
    /* Increased horizontal padding to make the active tab wider */
    padding-left: 6vmin;
    padding-right: 6vmin;
}

/* =================================================================
   4. Buttons & Inputs
   ================================================================= */
.save-button, .loginButton {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    padding: 1vmin 2vmin;
    font-size: 1.5vmin;
    border-radius: var(--border-radius-lg);
}
.save-button:hover, .loginButton:hover {
    background-color: var(--primary-color-active);
}
.loginButton {
    padding: 1vmin;
    font-size: 2vmin;
}

.delete-btn {
    color: #d9534f; /* A shade of red */
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    float: left; /* Positions the 'X' to the left in the cell */
}
.delete-btn:hover {
    color: #c9302c; /* Darker red on hover */
}

input[type="time"] {
    padding: 1vmin;
    font-size: 1.5vmin;
    border: 1px solid #ccc;
    border-radius: var(--border-radius-sm);
    width: 12vmin;
    max-width: 120px;
    min-width: 80px;
}

input[type="time"]:disabled {
    background-color: #f0f0f0;
    color: #aaa;
}

input[type="password"] {
    padding: 1vmin;
    font-size: 1.5vmin;
    border: 1px solid #ccc;
    border-radius: var(--border-radius-sm);
    width: 12vmin;
    max-width: 120px;
    min-width: 80px;
}

input[type="password"]:disabled {
    background-color: #f0f0f0;
    color: #aaa;
}

input[type="description"] {
    padding: 1vmin;
    font-size: 1.5vmin;
    border: 1px solid #ccc;
    border-radius: var(--border-radius-sm);
    width: 40vmin;
    max-width: 40vmin;
    min-width: 80px;
}

input[type="text"] {
    padding: 1vmin;
    font-size: 1.5vmin;
    border: 1px solid #ccc;
    border-radius: var(--border-radius-sm);
    width: 12vmin;
    max-width: 120px;
    min-width: 80px;
}

input[type="text"]:disabled {
    background-color: #f0f0f0;
    color: #aaa;
}

.logout-button {
    background-color: #c0392b; /* A standard, noticeable red */
    color: var(--text-on-primary);
    border: none;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    padding: 1.2vmin 2.5vmin;
    font-size: 1.8vmin;
    border-radius: var(--border-radius-lg);
    font-weight: bold;
    width: 60%;
    max-width: 250px;
    margin-top: 1vmin;
}

.logout-button:hover {
    background-color: #a93226;
    transform: translateY(-2px);
}

.logout-button i {
    margin-left: 10px;
}

/* =================================================================
   5. Components (Cards, Sections, etc.)
   ================================================================= */
.subsection {
    margin: 2vmin;
    padding: 1vmin;
    background-color: var(--bg-card);
    border-radius: var(--border-radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
    position: relative;
}
.subsection:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.connectivity-dot {
    width: 1vmin;
    height: 1vmin;
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    top: 1.3vmin;  
    right: 1.3vmin;  
}
.connectivity-dot.good { background-color: var(--status-good); }
.connectivity-dot.poor { background-color: var(--status-poor); }
.connectivity-dot.closed { background-color: var(--status-closed); }

.lamp-image {
    width: 10vmin;
    max-width: 80px;
    min-width: 40px;
    height: auto;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.2s;
}
.lamp-image:hover {
    transform: scale(1.05);
}

.schedule-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1vmin;
    margin-top: 1vmin;
    justify-content: center;
}
.schedule-controls label { font-size: 1.5vmin; min-width: 60px; }

/* Home Map View */
.houseMap-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: auto;
}
.houseMap {
    height: auto;
    width: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.room-overlay {
    position: absolute;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background-color 0.3s, border-color 0.3s;
    border-radius: 10%;
}
.room-overlay.off {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: rgba(0, 0, 0, 0.5);
}
.room-overlay.on {
    background-color: rgba(255, 223, 0, 0.5);
    border-color: rgba(255, 223, 0, 0.8);
}

/* =================================================================
   6. Car Tab (Map & Controls)
   ================================================================= */
.map-section {
    width: 100%;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 1vmin;
    align-items: start;
    position: relative; /* This is the positioning context for the wave */
    overflow: hidden;
    border-radius: var(--border-radius-md);
}

.map-canvas {
    width: 100%;
    height: 40vmin;
    min-height: 250px;
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.controls-container {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 1vmin;
    /* --- FIX: Add position and z-index --- */
    position: relative;
    z-index: 2;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 1vmin;
}

.control-button, .update-button {
    padding: 1vmin;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 2vmin;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
}

.control-button:hover, .update-button:hover {
    transform: translateY(-2px);
}

.update-button {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
    height: 100%;
}

.control-button {
    background-color: var(--bg-tab-inactive);
    color: var(--text-color-secondary);
}

.control-button:hover {
    background-color: var(--bg-tab-hover);
}

.control-button.active {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-active);
}


/* =================================================================
   Protection Wave Effect
   ================================================================= */

/* This container holds the waves and is positioned behind the map */
.protection-wave-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Behind map canvas and controls */
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

/* This class is toggled by JavaScript to show the waves */
.map-section.protection-on .protection-wave-container {
    opacity: 1;
}

/* --- FIX: Ensure the .map container is also lifted --- */
.map-section .map {
    position: relative;
    z-index: 2;
    background-color: transparent; /* Allows the wave to be seen behind */
}

/* Individual wave styling - creates a pulsing circle */
.protection-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 180px;
    border-radius: 50%;
    background: rgba(229, 62, 62, 0.7);
    transform: translate(-50%, -50%);
    animation: pulse-animation 3s infinite cubic-bezier(0.6, 0, 0.2, 1);
}

/* Stagger the animations for a more natural, continuous pulse */
.p-wave-1 {
    animation-delay: 0s;
}
.p-wave-2 {
    animation-delay: -0.5s;
}
.p-wave-3 {
    animation-delay: -1s;
}

/* The animation keyframes for the pulse effect */
@keyframes pulse-animation {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* =================================================================
   7. Voice Assistant
   ================================================================= */
.voice-button {
    position: relative;
    width: 10vmin;
    height: 10vmin;
    background-color: #5081b8;
    border-radius: 15%; transition: 0.5s;
    z-index: 1000;
    margin: 1vmin;
    padding: 1vmin;
    border: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.voice-button::before {
    content: '';
    background-color: #5081b8;
    border-radius: 50%;
    z-index: 1000;
}

.mic-icon {
    position: relative;
    width: 5vmin;
    height: auto;
    fill: white;
    z-index: 1000;
}

/* Trigger bounce and shake animations when the button is active */
.voice-button.active .mic-icon {
    animation: 
    bounce 0.6s ease-in-out,
    shake 0.5s ease-in-out;
}
.voice-button.active {
    border-radius: 35%; transition: 0.7s;
}

.wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #5081b8;
    border-radius: 40%;
    opacity: 0;
}

/* Wave 1: Red */
.wave-1 {
    background-color: rgba(222, 146, 146, 0.2); /* Red with opacity */
    z-index: 999;
}

/* Define unique base colors for other waves */
.wave-2 {
    background-color: rgba(212, 117, 206, 0.2); /* Teal */
    z-index: 999;
}

.wave-3 {
    background-color: rgba(104, 179, 223, 0.2);
    z-index: 999;
}

.wave-4 {
    background-color: rgba(233, 184, 239, 0.2); /* Lime */
    z-index: 999;
}

.wave-5 {
    background-color: rgba(230, 230, 167, 0.2); /* Yellow */
    z-index: 999;
}

.wave-6 {
    background-color: rgba(226, 173, 154, 0.2); /* Orange */
    z-index: 999;
}

.wave-7 {
    background-color: rgba(201, 146, 185, 0.2); /* Purple */
    z-index: 999;
}

.voice-button.active .wave-1 {
    animation: wave 4s infinite ease-out 2s;
    border-radius: 45%;
}

.voice-button.active .wave-2 {
    animation: wave 2s infinite ease-out 0.4s;
    border-radius: 40%;
}

.voice-button.active .wave-3 {
    animation: wave 1s infinite ease-out 0.8s;
    border-radius: 50%;
}

.voice-button.active .wave-4 {
    animation: wave 5s infinite ease-out 1.2s;
    border-radius: 60%;
}

.voice-button.active .wave-5 {
    animation: wave 3s infinite ease-out 1.6s;
    border-radius: 70%;
}

.voice-button.active .wave-6 {
    animation: wave 1s infinite ease-out 2s;
    border-radius: 80%;
}

.voice-button.active .wave-7 {
    animation: wave 3s infinite ease-out;
    border-radius: 90%;
}

@keyframes wave {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(5);
        opacity: 0;
    }
}

/* Bounce animation: scales the mic up and down */
@keyframes bounce {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(0.9);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Shake animation: rotates the mic slightly back and forth */
@keyframes shake {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(3deg);
    }
    50% {
        transform: rotate(-3deg);
    }
    75% {
        transform: rotate(3deg);
    }
    100% {
        transform: rotate(0deg);
    }
}
.response-box-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 2vmin;
    z-index: 10000;
}

.response-box {
    position: relative;
    padding: 1.5vmin 3vmin;
    min-height: 10vmin;
    min-width: 30vmin;
    max-width: 100vmin;
    background-color: #f5f5f5;
    border-radius: 1vmin;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    font-size: 1.5vmin;
    color: #333;
    text-align: center;
    overflow: hidden;
    z-index: 10000;
}

.loader {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    z-index: 10000;
    display: none;
}

.dot {
    width: 0.6vmin;
    height: 0.6vmin;
    background-color: #5081b8;
    border-radius: 50%;
    position: absolute;
    animation: orbit 2s linear infinite;
    z-index: 10000;
}

.dot:nth-child(1) { animation-delay: 0s; opacity: 100%;}
.dot:nth-child(2) { animation-delay: 0.08s; opacity: 80%;}
.dot:nth-child(3) { animation-delay: 0.16s; opacity: 60%;}
.dot:nth-child(4) { animation-delay: 0.24s; opacity: 40%;}
.dot:nth-child(4) { animation-delay: 0.32s; opacity: 20%;}

@keyframes orbit {
    0% {
        top: 0;
        left: 0;
    }
    25% {
        top: 0;
        left: 100%;
        transform: translateX(-100%);
    }
    50% {
        top: 100%;
        left: 100%;
        transform: translate(-100%, -100%);
    }
    75% {
        top: 100%;
        left: 0;
        transform: translateY(-100%);
    }
    100% {
        top: 0;
        left: 0;
    }
}

/* =================================================================
   8. Media Queries (Responsive Design)
   ================================================================= */
@media (max-width: 600px) {
    html, body { font-size: 2vmin; }
    h1 { font-size: 6vmin; }
    h2 { font-size: 4vmin; }
    h3 { font-size: 3vmin; }

    .container { width: 95vw; padding: 3vmin; }
    .tab-content { padding: 3vmin; max-height: calc(100vh - 15vmin); }
    .tab-button { font-size: 3vmin; padding: 1.5vmin 4vmin; }

    .schedule-controls { flex-direction: column; gap: 1.5vmin; }
    .schedule-controls input[type="time"], .schedule-controls label { font-size: 2vmin; }
}

@media (min-width: 1201px) {
    html, body { font-size: 1.2vmin; } /* Adjust for very large screens if needed */
    .container { width: 80vw; }
    .tab-button { font-size: 1.5vmin; }
}

/* =================================================================
   9. Dropdown Tab Styles
   ================================================================= */
.dropdown-tab {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--bg-tab-inactive);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-size: 1.8vmin;
}

.dropdown-content a:hover {
    background-color: var(--bg-tab-hover);
}

/* Class to show the dropdown */
.dropdown-content.show {
    display: block;
}

/* =================================================================
   10. Heat Map Style
   ================================================================= */

/* Styling for the new view-toggle button */
/* Styling for the Heat Map Feature V3 */

/* Legend Toolbar */
#temp-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1vmin;
    margin-top: 1.5vmin;
    padding: 1vmin;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f8f9fa;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
#temp-legend.visible {
    opacity: 1;
}

.temp-label {
    font-size: 1.5vmin;
    font-weight: bold;
    color: #555;
}

.temp-gradient-bar {
    width: 50%;
    height: 2vmin;
    border-radius: 5px;
    /* A simple, direct gradient from the same blue to the same orange */
    background: linear-gradient(to right, 
        rgb(0, 123, 255), 
        rgb(255, 111, 0)
    );
}

/* Heat Spot Layer */
#heat-map-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.heat-spot {
    position: absolute;
    border-radius: 50%;
    transform: scale(2);
    opacity: 0;
    animation: fadeInHeatSpot 0.6s forwards;
    /* Also make it a flex container to center the text inside it */
    display: flex;
    justify-content: center;
    align-items: center;
}

.heat-spot-text {
    color: rgb(24, 24, 24);
    font-weight: bold;
    font-size: 1vmin;
    text-shadow: 0 0 4px black;
}

@keyframes fadeInHeatSpot {
  to {
    opacity: 1;
  }
}

/* =================================================================
   10. Admin Main Table
   ================================================================= */

.status-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1em;
    font-size: 1.8vmin; /* Match other table styles */
}

.status-table th, .status-table td {
    border: 1px solid #ddd;
    padding: 1vmin;
    text-align: left;
    vertical-align: middle;
}

.status-table th {
    background-color: #f0f0f0;
    font-weight: bold;
}

.status-table td {
    background-color: #fff;
}

.status-indicator {
    display: inline-block;
    padding: 0.5vmin 1vmin;
    border-radius: var(--border-radius-sm);
    color: white;
    font-weight: bold;
    text-transform: capitalize;
}

/* Use connectivity status colors from your root variables */
.status-indicator.good {
    background-color: var(--status-good);
}
.status-indicator.medium {
    background-color: #f0ad4e; /* A distinct medium color */
}
.status-indicator.poor {
    background-color: var(--status-poor);
}
.status-indicator.closed {
    background-color: var(--status-closed);
}

.error-message {
    color: var(--status-closed);
    font-weight: bold;
}

.customer-summary-row {
    cursor: pointer;
    background-color: #f9f9f9;
    transition: background-color 0.2s ease-in-out;
}
.customer-summary-row:hover {
    background-color: #eef4fb;
}

/* Style for when a row is expanded */
.customer-summary-row.expanded {
    background-color: #e1eaf5;
    font-weight: bold;
}

/* Style for the hidden device rows */
.customer-detail-row {
    background-color: #ffffff;
}
.customer-detail-row .detail-cell-indent {
    border: none;
    background-color: #fdfdfd;
    border-bottom: 1px solid #f0f0f0;
}

/* Style for the [+] and [-] icon */
.toggle-icon {
    display: inline-block;
    width: 20px;
    text-align: center;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 110%;
}

.scrollable-table-container {
    /* Set a max-height. You can adjust this value. 45vh is ~45% of the viewport height. */
    max-height: 45vh;
    min-height: 200px; /* Ensure it has a reasonable minimum height */
    overflow-y: auto; /* This is the key: show a vertical scrollbar ONLY when needed */
    border: 1px solid #ddd;
    border-radius: var(--border-radius-sm);
    margin-top: 1em;
    position: relative; /* Required for the sticky header to work */
}

/* Ensure the table inside the container uses the full width */
.scrollable-table-container table {
    width: 100%;
    /* border-collapse: collapse; is already in your .status-table style, which is good */
}

/* This makes the table header (<th>) stick to the top of the scrollable container */
.scrollable-table-container thead th {
    position: sticky;
    top: 0;
    /* The z-index ensures the header stays on top of the scrolling content */
    z-index: 2;
    /* We must set a background color, otherwise the content below will show through */
    background-color: #f0f0f0; /* Matches your existing header style */
}

/* =================================================================
   11. Dark Mode Toggle Switch
   ================================================================= */
.theme-switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1vmin 0;
}

.theme-switch {
    position: relative;
    /* display: inline-block; */
    width: 60px;
    height: 34px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
}

.slider-icon {
    font-size: 16px;
    z-index: 1;
    color: white;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* =================================================================
   12. Refresh Icons
   ================================================================= */
.refresh-icon {
    font-size: 1.8vmin;
    cursor: pointer;
    color: var(--primary-color);
    transition: color 0.2s, transform 0.2s;
    display: inline-block; /* Needed for transform */
    vertical-align: middle; /* Aligns icon nicely with text */
}

.refresh-icon:hover {
    color: var(--primary-color-active);
    transform: rotate(90deg);
}

/* Animation for when the icon is clicked */
.refresh-icon.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
/* =================================================================
   13. Mesh Graph Visualization
   ================================================================= */
.mesh-graph-container {
    width: 100%;
    height: 400px; /* You can adjust the height */
    margin-top: 1em;
    padding: 0;
}

/* Style for the row containing the graph */
.customer-graph-row td {
    padding: 10px;
    background-color: #fdfdfd;
}

/* =================================================================
   14. OTA Update Styles
   ================================================================= */

/* Update Icon Style */
.update-icon {
    font-size: 1.8vmin;
    cursor: pointer;
    color: #3498db; /* A distinct blue for update */
    transition: color 0.2s, transform 0.2s;
    display: inline-block;
    vertical-align: middle;
    margin-left: 10px;
}

.update-icon:hover {
    color: #2980b9;
    transform: scale(1.2);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* Modal Content Box */
.modal-content {
    background-color: var(--bg-container);
    padding: 2em;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-hover);
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    font-weight: bold;
    color: var(--text-color-secondary);
    cursor: pointer;
}

/* Custom File Input */
.file-input-wrapper {
    margin: 1.5em 0;
}
.file-input {
    display: none; /* Hide the default input */
}
.file-input-label {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
    padding: 0.8em 1.5em;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color 0.3s;
}
.file-input-label:hover {
    background-color: var(--primary-color-hover);
}
.file-name-display {
    margin-top: 1em;
    font-style: italic;
    color: var(--text-color-secondary);
}

/* OTA Status Log */
.ota-status-log {
    margin-top: 1.5em;
    padding: 1em;
    background-color: var(--bg-card);
    border-radius: var(--border-radius-sm);
    min-height: 50px;
    text-align: left;
    font-family: monospace;
    color: var(--text-color-main);
    white-space: pre-wrap;
    word-wrap: break-word;
}
