* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f7f7f7;
    color: #333;
    font-family: 'Inter', 'Segoe UI', 'Roboto', 'Arial', Helvetica, sans-serif;
    counter-reset: camera-counter;
    overflow-x: hidden;
    position: relative;
}

/* Remove top navigation bar - commented out */
/* .top-nav { ... } */

/* Logo and Menu positioned directly on body */
.body-header {
    position: absolute; /* Changed from fixed to absolute */
    top: 20px;
    left: 20px;
    right: 20px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center; /* Center content */
    z-index: 1000;
    pointer-events: none; /* Allow clicks to pass through except for interactive elements */
}

.body-header > * {
    pointer-events: auto; /* Re-enable pointer events for child elements */
}

.header-left {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #da2b26;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 10px;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.menu-toggle:hover {
    background: rgba(218, 43, 38, 0.1);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(218, 43, 38, 0.2);
}

.hamburger-line {
    width: 28px;
    height: 3px;
    background-color: #da2b26;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0; /* Remove gap between logo and lite badge */
    /* Remove background styling */
}

.logo {
    height: 100px; /* Increased from 60px */
    width: auto;
}

.lite {
    padding: 5px 8px;
    color: whitesmoke;
    font-size: 20px;
    background-color: #da2b26;
    height: 32px;
    width: 50px;
    font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.main-container {
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding-top: 120px; /* Keep the padding to prevent content overlap */
}

/* Left Panel - Update positioning to be fixed independently */
.left-panel {
    position: fixed;
    top: 0; /* Changed from 120px to 0 since header is no longer fixed */
    left: 0;
    width: 320px;
    height: 100vh; /* Changed from calc(100vh - 120px) to 100vh */
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    color: #333;
    padding: 20px 0 0 0; /* Add top padding to account for header space */
    overflow-y: auto;
    box-shadow: 
        4px 0 25px rgba(0,0,0,0.15),
        0 0 0 1px rgba(255,255,255,0.1);
    transform: translateX(-100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 25px 25px 0;
    z-index: 1002;
    backdrop-filter: blur(10px);
}

.left-panel.active {
    transform: translateX(0);
    box-shadow: 
        8px 0 40px rgba(218, 43, 38, 0.2),
        0 0 0 1px rgba(218, 43, 38, 0.1);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    padding: 25px 20px 15px 20px;
    border-bottom: 2px solid rgba(218, 43, 38, 0.1);
    background: linear-gradient(135deg, rgba(218, 43, 38, 0.05), transparent);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.panel-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #da2b26;
    background: linear-gradient(135deg, #da2b26, #ff4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-btn {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, rgba(218, 43, 38, 0.1), rgba(218, 43, 38, 0.05));
    border: 2px solid rgba(218, 43, 38, 0.2);
    border-radius: 50%;
    color: #da2b26;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: linear-gradient(135deg, #da2b26, #c92520);
    color: white;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 15px rgba(218, 43, 38, 0.3);
}

.panel-section {
    margin: 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(218, 43, 38, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.panel-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(218, 43, 38, 0.03), transparent);
    transition: left 0.6s ease;
}

.panel-section:hover::before {
    left: 100%;
}

.panel-section:hover {
    background: rgba(218, 43, 38, 0.02);
    transform: translateX(5px);
    box-shadow: 
        inset 4px 0 0 rgba(218, 43, 38, 0.3),
        4px 0 20px rgba(218, 43, 38, 0.1);
}

.panel-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-section:hover h4 {
    color: #da2b26;  
}

.panel-section.active {
    background: rgba(218, 44, 39, 0.08);
    color: #da2b26;
    opacity: 1;
    font-weight: 600;
    border: 1px solid rgba(218, 44, 39, 0.1);
    box-shadow: 0 4px 12px rgba(218, 44, 39, 0.06);
}

.panel-section.active h4 {
    color: #da2b26;
}

.panel-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
}

.panel-select, .panel-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-bottom: 10px;
}

.panel-select {
    background-color: rgba(255,255,255,0.9);
    color: #333;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 10px auto;
    padding-right: 40px;
}

.panel-btn {
    background-color: rgba(255,255,255,0.9);
    color: #da2b26;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.panel-btn:hover {
    background-color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(218, 43, 38, 0.2);
}

.status-content {
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
}

/* .mode-selector-container-panel { (previous css)
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: fit-content;
    height: fit-content;
}

.mode-selector-container{
    display: flex;
    flex-direction: row;
    gap: 8px;
} */

/* Fix for mode selector panels in sidebar and main content */
.mode-selector-container-panel {
    display: flex;
    flex-direction: row;       /* Arrange horizontally */
    flex-wrap: wrap;           /* Allow items to wrap into multiple lines */
    gap: 10px;
    width: fit-content;
    height: fit-content;
    padding: 8px;
    background: rgba(255,255,255,0.9);
    border-radius: 12px;
    box-sizing: border-box;
}

/* Fix for mode selector in top controls */
.mode-selector-container {
    display: flex;
    flex-wrap: wrap;           /* Allow wrapping */
    flex-direction: row;
    justify-content: center;   /* Center align the options */
    gap: 10px;
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.9);
    border-radius: 12px;
    box-sizing: border-box;
}


.mode-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.mode-option:hover {
    opacity: 1;
    background: rgba(218, 44, 39, 0.04);
    transform: translateX(4px);
    color: #da2b26;
    border-color: rgba(218, 44, 39, 0.2);
}

.mode-option.active {
    background: rgba(218, 44, 39, 0.08);
    color: #da2b26;
    opacity: 1;
    font-weight: 600;
    border: 1px solid rgba(218, 44, 39, 0.1);
    box-shadow: 0 4px 12px rgba(218, 44, 39, 0.06);
}

.mode-option:hover .mode-text,
.mode-option.active .mode-text {
    color: #da2b26;
}

.mode-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.mode-text {
    flex: 1;
    transition: color 0.3s ease;
}


/* Old (Removed/Modified) */
/* .content-area {
    display: flex;
    flex-direction: column; 
    padding: 20px;
    margin-left: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    justify-content: space-around;
    gap: 20px;
} */

/* NEW/UPDATED CSS */
.content-area {
    display: flex; /* Enable flexbox */
    flex-direction: row; /* Arrange children in a row */
    flex-grow: 1; /* Allow it to grow to fill space */
    padding: 20px;
    margin-left: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 20px; /* Spacing between content-left and right-panel */
    width: 100%; /* Ensure it spans the width */
    max-width: calc(100% - 20px); /* Adjust to leave some margin/padding space */
    margin: 0 auto; /* Center the content area */
}

/* NEW/UPDATED CSS */
.content-left {
    flex-grow: 1; /* Allow it to take up the remaining space */
    min-width: 0; /* Important for flex-grow to work correctly */
    display: flex;
    flex-direction: column;
}

/* Ensure the top controls are contained */
/* .top-controls {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
} 
*/

/* Top Controls - Same as Original */
.top-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Ensure video streams container expands */
/* #videoStreams {
    flex-grow: 1;
    margin: 10px 0; 
    justify-content: center;
} */

/* Video Streams */
#videoStreams {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    align-items: flex-start;
    margin: 30px 20px;
}



/* Right Panel for Live Results - Enhanced with hover effects */
/* .right-panel {
    width: 1000px;
    background-color: #ffffff;
    border-left: 1px solid #e0e0e0;
    padding: 20px;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px 20px 20px 20px;
} 
*/



/* NEW/UPDATED CSS */
.right-panel {
    width: 400px; /* Set a fixed width for the sidebar */
    flex-shrink: 0; /* Prevent it from shrinking */
    background-color: #ffffff;
    border-left: 1px solid #e0e0e0;
    padding: 20px;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    display: none; /* Initially hidden */
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px;
}

.right-panel.visible {
    display: flex; /* Show when camera is added */
}

.right-panel .panel-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #da2b26;
    padding-bottom: 10px;
    transition: all 0.3s ease;
}

.right-panel:hover .panel-header {
    border-bottom-color: #da2b26;
    padding-bottom: 12px;
}

.right-panel .panel-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #da2b26;
    transition: all 0.3s ease;
}

.right-panel:hover .panel-header h3 {
    transform: scale(1.02);
    text-shadow: 0 2px 4px rgba(218, 43, 38, 0.1);
}


.results-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    overflow-y: auto;
    padding: 5px; 
}

/* Enhanced results sections with hover effects - simplified for single section */
.results-section {
    flex: 1;
    min-width: 100%;
    margin-bottom: 0;
    padding: 15px;
    background: rgba(218, 43, 38, 0.05);
    border: 1px solid rgba(218, 43, 38, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.results-section:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 
        0 10px 25px rgba(218, 43, 38, 0.15),
        0 5px 15px rgba(0, 0, 0, 0.1);
    background: rgba(218, 43, 38, 0.08);
    border-color: rgba(218, 43, 38, 0.3);
}

.results-section h4 {
    font-size: 1.0rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #da2b26;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.results-section:hover h4 {
    color: #b81f1a;
    transform: translateY(-2px);
    text-shadow: 0 2px 8px rgba(218, 43, 38, 0.3);
    font-size: 1.05rem;
}

/* Enhanced content areas with better scrolling */
.results-content {
    flex: 1;
    padding: 10px;
    background: rgba(255,255,255,0.9);
    border-radius: 8px;
    border: 1px solid rgba(218, 43, 38, 0.2);
    overflow-y: auto;
    max-height: calc(100vh - 200px); /* Allow proper scrolling */
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    backdrop-filter: blur(5px);
    font-family: 'Courier New', monospace; /* Better for structured data */
    font-size: 13px;
    line-height: 1.4;
}

.results-section:hover .results-content {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(218, 43, 38, 0.4);
    box-shadow: inset 0 2px 4px rgba(218, 43, 38, 0.05);
}

/* Enhanced result items */
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: 1px solid rgba(218, 43, 38, 0.1);
    font-size: 12px;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin-bottom: 2px;
}

.result-item:hover {
    background: rgba(218, 43, 38, 0.05);
    transform: translateX(3px);
    padding: 6px;
    box-shadow: 0 2px 8px rgba(218, 43, 38, 0.1);
}

.result-item:last-child {
    border-bottom: none;
}

/* Improved text styling for better readability */
.result-time {
    font-weight: 600;
    color: #666;
    font-size: 11px;
    min-width: 70px;
}

.result-type {
    flex: 1;
    text-align: left;
    color: #333;
    font-weight: 500;
    word-wrap: break-word;
    white-space: pre-line; /* Allow line breaks in detection results */
}

/* Custom scrollbar for better UX */
.results-content::-webkit-scrollbar {
    width: 6px;
}

.results-content::-webkit-scrollbar-track {
    background: rgba(218, 43, 38, 0.1);
    border-radius: 3px;
}

.results-content::-webkit-scrollbar-thumb {
    background: rgba(218, 43, 38, 0.4);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.results-content::-webkit-scrollbar-thumb:hover {
    background: rgba(218, 43, 38, 0.6);
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .results-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .results-section {
        min-width: auto;
    }
    
    .results-section:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .results-section:nth-child(1):hover,
    .results-section:nth-child(2):hover,
    .results-section:nth-child(3):hover {
        transform: translateY(-4px) scale(1.01);
        rotate: none;
    }
}



#sourceSelector, #webcamControls, #cctvControls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.btn, #cameraSelect, .form-input, input[type="number"] {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 11px 22px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    outline: none;
}

.btn {
    background-color: #da2b26;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 8px rgba(218, 43, 38, 0.1);
    border: none;
}

.btn:hover {
    background-color: #b81f1a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(218, 43, 38, 0.2);
}

.btn:disabled {
    background-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#sourceSelector .btn.active {
    background-color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#sourceSelector .btn.active:hover {
    background-color: #000;
}

#cameraSelect, .form-input, input[type="number"] {
    background-color: #fff;
    color: #333;
    border-color: #ccc;
}

#cameraSelect:hover, .form-input:hover, input[type="number"]:hover {
    border-color: #b81f1a;
}

#cameraSelect:focus, .form-input:focus, input[type="number"]:focus {
    border-color: #b81f1a;
    box-shadow: 0 0 0 3px rgba(218, 43, 38, 0.1);
}

#cameraSelect {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 10px auto;
    padding-right: 40px;
}

.form-input {
    flex-grow: 1;
    min-width: 300px;
}



.videoContainer {
    position: relative;
    max-width: 1200px; /* Increased from 900px */
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    background: #111;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid #fff;
    display: inline-block;
    vertical-align: top;
    margin: 20px;
}

.videoContainer::before {
    content: 'CAM ' counter(camera-counter);
    counter-increment: camera-counter;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background-color: rgba(218, 43, 38, 0.8);
    color: #fff;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    font-weight: bold;
    backdrop-filter: blur(4px);
}

.videoContainer video, .videoContainer .overlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #222;
}

.stream-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    gap: 5px;
}

.videoContainer:hover .stream-controls {
    opacity: 1;
}

.stream-controls .btn {
    padding: 8px 12px;
    font-size: 12px;
    background-color: rgba(218, 43, 38, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.7);
}

/* Custom Select Dropdown with Hover Effects */
.custom-select-container {
    position: relative;
    min-width: 200px;
}

.custom-select {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 22px;
    background: #ffffff;
    border: 1px solid #ccc;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    user-select: none;
}

.custom-select:hover {
    background: rgba(218, 44, 39, 0.04);
    transform: translateX(4px);
    border-color: #da2b26;
    color: #da2b26;
    box-shadow: 0 4px 12px rgba(218, 43, 38, 0.1);
}

.custom-select.active {
    background: rgba(218, 44, 39, 0.08);
    border-color: #da2b26;
    color: #da2b26;
    box-shadow: 0 4px 12px rgba(218, 43, 38, 0.15);
}

.select-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    color: #666;
}

.custom-select:hover .select-arrow,
.custom-select.active .select-arrow {
    color: #da2b26;
}

.custom-select.active .select-arrow {
    transform: rotate(180deg);
}

/* Dropdown Options */
.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #da2b26;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    max-height: 250px;
    overflow-y: auto;
    margin: 0;
    padding: 8px 0;
    list-style: none;
}

.custom-options.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    transition: all 0.2s ease;
    margin: 2px 8px;
    border-radius: 8px;
}

.custom-option:hover {
    background: rgba(218, 44, 39, 0.04);
    transform: translateX(4px);
    color: #da2b26;
    box-shadow: 0 2px 8px rgba(218, 44, 39, 0.1);
}

.custom-option.active {
    background: rgba(218, 44, 39, 0.08);
    color: #da2b26;
    font-weight: 600;
    border-left: 3px solid #da2b26;
}

.option-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.option-text {
    flex: 1;
}

/* Enhanced Input and Button Styles */
.custom-input {
    transition: all 0.3s ease;
}

.custom-input:hover {
    background: rgba(218, 44, 39, 0.02);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(218, 43, 38, 0.1);
}

.custom-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(218, 43, 38, 0.3);
}


/* Initial Model Selection Modal - Professional Design */
.model-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(218, 43, 38, 0.1));
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.model-selection-overlay.show {
    opacity: 1;
    visibility: visible;
}

.model-selection-modal {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    padding: 40px;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(0.8) translateY(-20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.model-selection-overlay.show .model-selection-modal {
    transform: scale(1) translateY(0);
}

.model-selection-header {
    text-align: center;
    margin-bottom: 35px;
    position: relative;
}

.model-selection-header::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #da2b26, #ff4444);
    border-radius: 2px;
}

.model-selection-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, #da2b26, #ff4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.model-selection-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    margin: 0;
    font-weight: 400;
}

.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.model-card {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 160px;
}

.model-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(218, 43, 38, 0.05), transparent);
    transition: left 0.5s ease;
}

.model-card:hover::before {
    left: 100%;
}

.model-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: #da2b26;
    box-shadow: 
        0 15px 35px rgba(218, 43, 38, 0.15),
        0 5px 15px rgba(0, 0, 0, 0.1);
}

.model-card.selected {
    border-color: #da2b26;
    background: linear-gradient(145deg, #da2b26, #c92520);
    color: white;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 20px 40px rgba(218, 43, 38, 0.3),
        0 10px 20px rgba(0, 0, 0, 0.15);
}

.model-card.selected .model-icon {
    transform: scale(1.2);
    filter: brightness(1.2);
}

.model-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    display: block;
}

.model-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    transition: color 0.3s ease;
}

.model-description {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.4;
    margin: 0;
    transition: opacity 0.3s ease;
}

.model-card.selected .model-description {
    opacity: 0.9;
}

.model-selection-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 35px;
    padding-top: 25px;
    border-top: 1px solid #e9ecef;
}

.model-action-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    position: relative;
    overflow: hidden;
}

.model-action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.model-action-btn:hover::before {
    width: 300px;
    height: 300px;
}

.model-confirm-btn {
    background: linear-gradient(135deg, #da2b26, #c92520);
    color: white;
    box-shadow: 0 4px 15px rgba(218, 43, 38, 0.3);
}

.model-confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(218, 43, 38, 0.4);
}

.model-confirm-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.model-cancel-btn {
    background: transparent;
    color: #6c757d;
    border: 2px solid #e9ecef;
}

.model-cancel-btn:hover {
    background: #f8f9fa;
    border-color: #da2b26;
    color: #da2b26;
    transform: translateY(-2px);
}

.model-info-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.model-card:hover .model-info-badge,
.model-card.selected .model-info-badge {
    opacity: 1;
    transform: scale(1);
}

.model-card.selected .model-info-badge {
    background: rgba(255, 255, 255, 0.2);
}

/* Hide existing mode selectors initially */
.mode-selector-container,
.mode-selector-container-panel {
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.3s ease;
}

.mode-selector-container.enabled,
.mode-selector-container-panel.enabled {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive adjustments for model selection */
@media (max-width: 768px) {
    .model-selection-modal {
        padding: 25px;
        margin: 20px;
        max-width: none;
        width: calc(100% - 40px);
    }
    
    .model-selection-title {
        font-size: 1.8rem;
    }
    
    .model-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .model-card {
        min-height: 140px;
        padding: 20px 15px;
    }
    
    .model-selection-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .model-action-btn {
        width: 100%;
    }
}

/* Responsive adjustments for header */
@media (max-width: 768px) {
    .body-header {
        position: absolute; /* Keep absolute on mobile too */
        top: 15px;
        left: 15px;
        right: 15px;
        height: 70px;
    }
    
    .main-container {
        padding-top: 100px;
    }
    
    .left-panel {
        top: 0;
        height: 100vh;
        width: 280px;
    }
    
    .left-panel .panel-header {
        margin-top: 85px; /* Adjusted for mobile */
    }
    
    .logo {
        height: 70px; /* Increased from 45px for mobile too */
    }
    
    .menu-toggle {
        width: 45px;
        height: 45px;
    }
    
    .hamburger-line {
        width: 24px;
    }
    
    .logo-container {
        padding: 8px 15px;
        gap: 12px;
    }
}

/* ROI control styles - Updated for horizontal layout */
.roi-controls {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.9));
    border-radius: 15px;
    padding: 12px;
    box-shadow: 
        0 8px 25px rgba(218, 43, 38, 0.15),
        0 0 0 1px rgba(218, 43, 38, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(218, 43, 38, 0.2);
    margin: 15px 0;
    display: none;
    flex-direction: row; /* Changed from flex-wrap to row */
    gap: 12px; /* Increased gap for better spacing */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    flex-wrap: nowrap; /* Prevent wrapping to keep in one row */
}

.roi-controls.visible {
    display: flex;
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.roi-controls .panel-btn {
    padding: 10px 16px; /* Increased padding for better appearance */
    font-size: 13px; /* Slightly larger font */
    font-weight: 600;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #da2b26, #c92520);
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 90px; /* Increased min-width for better button size */
    box-shadow: 0 2px 8px rgba(218, 43, 38, 0.2);
    position: relative;
    overflow: hidden;
    white-space: nowrap; /* Prevent text wrapping */
}

/* Special styling for active draw button */
.roi-controls .panel-btn[style*="background-color: rgb(231, 76, 60)"],
.roi-controls .panel-btn[style*="background-color:#e74c3c"] {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    animation: pulse 1.5s infinite;
    box-shadow: 
        0 4px 15px rgba(231, 76, 60, 0.4),
        0 0 0 3px rgba(231, 76, 60, 0.2);
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4), 0 0 0 3px rgba(231, 76, 60, 0.2);
    }
    50% { 
        transform: scale(1.05); 
        box-shadow: 0 6px 20px rgba(231, 76, 60, 0.6), 0 0 0 6px rgba(231, 76, 60, 0.3);
    }
}

/* Enhanced panel buttons */
.panel-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid transparent;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 8px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 249, 250, 0.8));
    color: #333;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.panel-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(218, 43, 38, 0.1), transparent);
    transition: left 0.5s ease;
}

.panel-btn:hover::before {
    left: 100%;
}

.panel-btn:hover {
    background: linear-gradient(135deg, rgba(218, 43, 38, 0.05), rgba(218, 43, 38, 0.02));
    border-color: rgba(218, 43, 38, 0.3);
    color: #da2b26;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(218, 43, 38, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .left-panel {
        width: 300px;
        border-radius: 0 20px 20px 0;
    }
    
    .roi-controls {
        margin: 10px;
        padding: 10px;
        gap: 8px;
        flex-wrap: wrap; /* Allow wrapping on mobile */
    }
    
    .roi-controls .panel-btn {
        padding: 8px 12px;
        font-size: 11px;
        min-width: 70px;
    }
    
    .panel-section {
        padding: 15px;
    }
    
    .panel-header {
        padding: 20px 15px 12px 15px;
    }
    
    .panel-header h3 {
        font-size: 1.1rem;
    }
}