body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: #333;
    padding-bottom: 40px; /* Add space for fixed mmwave-data */
}

header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: #ffffff;
    padding: 20px;
    margin-bottom: 20px;
    border-bottom: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    margin: 0;
    font-size: 2.2em;
    font-weight: 600;
    color: #ffffff;
}

.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: calc(100vh - 40px);
    padding-bottom: 60px; /* Add space for fixed mmwave-data */
}

main {
    padding: 0;
    background: white;
    height: calc(100vh - 200px);
}

.services-grid {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.btn, button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #007bff;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
    font-family: 'Arial', sans-serif;
}

.btn:hover, button:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* iframe container styles */
.iframe-container {
    margin-top: 0;
    border: none;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 240px);
    position: relative;
    margin: 0 20px;
}

iframe {
    width: 100%;
    height: calc(100vh - 240px);
    border: none;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 0 20px;
    margin-top: 0;
}

.iframe-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 10px auto;
}

.mmwave-data {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.2);
    height: 40px;
    transition: height 0.6s ease-in-out, padding 0.6s ease-in-out;
    overflow: hidden;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    backdrop-filter: blur(10px);
}

.mmwave-data.expanded {
    height: calc(66dvh + 5rem);
    padding: 20px;
}

.show{
    right: 10px;
    position: absolute;
    top: 10px;
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    z-index: 10;
}

.show:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.stats-display {

    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
    z-index: 5;
}

.mmwave-data.expanded .stats-display {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
    margin-bottom: 20px;
}

.chart-container {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-in-out 0.3s, transform 0.4s ease-in-out 0.3s;
    margin-top: 20px;
    display: none;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 15px;
}

.mmwave-data.expanded .chart-container {
    opacity: 1;
    transform: translateY(0);
    display: grid;
}

.chart-container canvas {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    padding: 10px;
}

#breathchart {
    max-height: 33dvh;
}

#heartchart {
    max-height: 33dvh;
}

@media (max-width: 768px) {
    .mmwave-data.expanded {
        height: 50vh;
        padding: 15px;
    }
    
    .chart-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 10px;
    }
    
    #breathchart {
        max-height: 33dvh;
    }

    #heartchart {
        max-height: 33dvh;
    }
    
    body {
        padding-bottom: 50px; /* Extra space on mobile */
    }
    
    .container {
        padding-bottom: 70px; /* Extra space on mobile */
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
    .header-nav {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    .container {
        margin: 10px;
        border-radius: 10px;
        min-height: calc(100vh - 20px);
        padding-bottom: 70px; /* Override for mobile */
    }
    
    main {
        height: calc(100vh - 220px);
    }
    
    .services-grid {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn, button {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    iframe {
        height: calc(100vh - 260px);
        margin: 0 10px;
    }
    
    .iframe-container {
        height: calc(100vh - 260px);
        margin: 0 10px;
    }
}

/* Additional enhancements */
.btn:active, button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.btn:focus, button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Footer styling */
footer {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: #ffffff;
    padding: 15px 20px;
    margin-top: auto;
    border-top: 1px solid #34495e;
    text-align: center;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-content p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
}

/* Image Monitor Panel Styles */
.image-monitor-panel {
    position: fixed;
    top: 0;
    left: -500px;
    width: 500px;
    height: 100vh;
    background: white;
    border-right: 1px solid #ddd;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.image-monitor-panel[style*="block"] {
    left: 0;
}

.monitor-header {
    padding: 1rem;
    background: #4CAF50;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #388E3C;
}

.monitor-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator {
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
}

.btn-small {
    padding: 0.25rem 0.75rem;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-small:hover {
    background: rgba(255,255,255,0.3);
}

.close-monitor {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-monitor:hover {
    background: rgba(255,255,255,0.2);
}

.monitor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.latest-image {
    padding: 1rem;
    border-bottom: 1px solid #ddd;
    text-align: center;
}

.latest-image img {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-height: 200px;
}

.image-info {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.image-info p {
    margin: 0.25rem 0;
}

.monitor-logs {
    flex: 1;
    padding: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.monitor-logs h4 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1rem;
}

.logs-container {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

.log-entry {
    margin-bottom: 0.5rem;
    padding: 0.25rem;
    border-radius: 2px;
}

.log-entry:hover {
    background: #e9ecef;
}

.timestamp {
    color: #6c757d;
    font-weight: bold;
    margin-right: 0.5rem;
}

/* Thermal Sidebar Styles - Following mmwave-data pattern */
.thermal-sidebar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px 0 0 8px;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.2);
    width: 60px; /* Collapsed width - similar to mmwave height */
    transition: width 0.6s ease-in-out, padding 0.6s ease-in-out;
    overflow: hidden;
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 1000;
    backdrop-filter: blur(10px);
    height: auto;
    max-height: 80vh;
}

.thermal-sidebar.open {
    width: 450px; /* Expanded width */
    padding: 20px;
}

.thermal-header {
    display: flex;
    justify-content: center; /* Center the button when collapsed */
    align-items: center;
    padding: 10px; /* Consistent padding */
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    border-radius: 8px 0 0 8px;
    min-height: 40px;
    width: 100%; /* Take full width of container */
}

.thermal-sidebar.open .thermal-header {
    justify-content: space-between; /* Space between title and button when expanded */
    padding: 15px 20px;
}

.thermal-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
    display: none; /* Completely hidden in collapsed state */
    transition: opacity 0.3s ease;
}

.thermal-sidebar.open .thermal-header h3 {
    display: block; /* Show when expanded */
    opacity: 1;
}

.thermal-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 18px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    position: static; /* Remove absolute positioning */
}

.thermal-sidebar.open .thermal-toggle {
    position: static; /* Keep static when expanded */
}

.thermal-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.thermal-content {
    display: none; /* Completely hidden in collapsed state */
    transition: opacity 0.4s ease, padding 0.6s ease;
}

.thermal-sidebar.open .thermal-content {
    display: block; /* Show when expanded */
    padding: 20px;
    opacity: 1;
}

.thermal-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.thermal-image-container img,
.thermal-image-container canvas {
    width: 100%;
    max-width: 400px; /* Increased from 300px to 400px */
    height: auto;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.thermal-label {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    text-align: center;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .thermal-sidebar {
        width: 50px; /* Smaller collapsed width on mobile */
    }
    
    .thermal-sidebar.open {
        width: 320px; /* Smaller expanded width on mobile */
    }
    
    .thermal-image-container img,
    .thermal-image-container canvas {
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .thermal-sidebar {
        width: 45px;
    }
    
    .thermal-sidebar.open {
        width: 300px;
    }
    
    .thermal-header {
        padding: 12px 8px;
    }
    
    .thermal-sidebar.open .thermal-header {
        padding: 12px 15px;
    }
    
    .thermal-header h3 {
        font-size: 1.1em;
    }
}

/* Thermal Image Styles */
.thermal-image-container.active {
    position: relative;
}
.thermal-image-container.active #thermalImage {
    border: none;
}
.thermal-image-container.active #thermalCanvas {
    border: none;
    position: absolute;
    opacity: 0.75;
}
