:root {
    --header-height: 50px;
    --primary-color: #3080ee;
    --primary-hover: #2060ce;
    --text-color: #ffffff;
    --bg-dark: rgba(0,0,0,0.8);
    --bg-light: rgba(255,255,255,0.8);
    --ui-spacing: 15px;
    --ui-border-radius: 5px;
    --ui-shadow: 0 2px 6px rgba(0,0,0,0.2);
    --ui-background: rgba(0,0,0,0.7);
    --ui-background-hover: rgba(0,0,0,0.9);
    --ui-transition: all 0.3s ease;
    --navigable-color: rgba(0, 255, 100, 0.8);
    --non-navigable-color: rgba(255, 50, 50, 0.8);
}

body { 
    margin: 0; 
    overflow: hidden;
    font-family: Arial, sans-serif;
}

canvas { 
    display: block; 
}

/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow: hidden;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 500px;
    width: 90%;
    padding: 40px;
}

.loading-header h1 {
    font-size: 2.5rem;
    margin: 0 0 10px 0;
    font-weight: 300;
    letter-spacing: 2px;
}

.loading-header p {
    font-size: 1.1rem;
    margin: 0 0 40px 0;
    opacity: 0.9;
    font-weight: 300;
}

.loading-animation {
    margin: 40px 0;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-progress {
    margin: 40px 0;
}

.progress-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 1.2rem;
    font-weight: 500;
}

.status-text {
    font-size: 1rem;
    margin: 20px 0;
    opacity: 0.9;
    min-height: 24px;
}

.loading-steps {
    margin: 30px 0;
    text-align: left;
}

.loading-step {
    display: flex;
    align-items: center;
    margin: 15px 0;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.loading-step-pending {
    opacity: 0.5;
}

.loading-step-active {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.loading-step-completed {
    background: rgba(76, 172, 254, 0.2);
}

.step-icon {
    width: 24px;
    height: 24px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.step-name {
    flex: 1;
    font-size: 1rem;
}

.loading-footer {
    margin-top: 40px;
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Error state */
.loading-screen.loading-error {
    background: linear-gradient(135deg, #721e1e 0%, #982a2a 100%);
}

.loading-error .progress-bar {
    background: linear-gradient(90deg, #ff4757 0%, #ff3742 100%);
}

.loading-error .loading-spinner {
    border-top-color: #ff4757;
}

/* Responsive design */
@media (max-width: 768px) {
    .loading-content {
        padding: 20px;
    }
    
    .loading-header h1 {
        font-size: 2rem;
    }
    
    .loading-step {
        padding: 10px;
        margin: 10px 0;
    }
    
    .step-name {
        font-size: 0.9rem;
    }
}

/* Header styling */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-dark);
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.header-logo {
    font-size: 18px;
    font-weight: bold;
}

.header-controls {
    display: flex;
    align-items: center;
}

.login-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-form input {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.username-display {
    font-weight: bold;
}

#no-project {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-dark);
    color: var(--text-color);
    padding: 40px;
    border-radius: var(--ui-border-radius);
    text-align: center;
    display: none;
}

.form-group {
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.form-group label {
    margin-right: 5px;
    white-space: nowrap;
}

.form-group input {
    width: 150px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button {
    background: var(--primary-color);
    color: var(--text-color);
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 5px;
}

button:hover {
    background: var(--primary-hover);
}

#admin-link {
    position: absolute;
    top: calc(var(--header-height) + 10px);
    right: var(--ui-spacing);
    color: var(--text-color);
    background: #333;
    padding: 10px 20px;
    border-radius: var(--ui-border-radius);
    text-decoration: none;
    z-index: 1001;
    box-shadow: var(--ui-shadow);
}

#admin-link:hover {
    background: #555;
}

/* Loading indicator (legacy - replaced by new loading screen) */
#loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-dark);
    color: var(--text-color);
    padding: 20px;
    border-radius: var(--ui-border-radius);
    z-index: 1000;
    box-shadow: var(--ui-shadow);
}

.welcome-message {
    margin-right: 10px;
    color: #4caf50;
}

/* PMV UI Elements - Refined and Hardcoded */
.pmv-ui-element {
    position: absolute;
    background: var(--ui-background);
    color: var(--text-color);
    padding: 12px;
    border-radius: var(--ui-border-radius);
    z-index: 1000;
    pointer-events: all;
    transition: var(--ui-transition);
    box-shadow: var(--ui-shadow);
}

.pmv-ui-element:hover {
    background: var(--ui-background-hover);
}

/* Camera selector - Top left, below header */
#camera-selector {
    display: none;
    top: calc(var(--header-height) + var(--ui-spacing));
    left: var(--ui-spacing);
    width: 152px;
    max-width: 10%;
}

.selector-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.selector-row:last-child {
    margin-bottom: 0;
}

.selector-row span {
    min-width: 70px;
    margin-right: 10px;
    font-size: 14px;
}

#camera-selector select {
    background: rgba(0,0,0,0.5);
    color: var(--text-color);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Fullscreen button - Top right, below header */
#fullscreen-button {
    display: none;
    top: calc(var(--header-height) + var(--ui-spacing));
    right: var(--ui-spacing);
    text-align: center;
    width: 40px;
    height: 40px;
    padding: 0;
    line-height: 40px;
    font-size: 18px;
}

/* Information panel - FIXED: Proper scrolling implementation */
#info-panel {
    position: absolute;
    top: calc(var(--header-height) + var(--ui-spacing) * 2 + 100px);
    left: var(--ui-spacing);
    bottom: var(--ui-spacing);
    width: 152px;
    max-width: 10%;
    background: var(--ui-background);
    color: var(--text-color);
    padding: 12px;
    border-radius: var(--ui-border-radius);
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--ui-shadow);
    display: none; /* Initial state */
    flex-direction: column;
    /* Remove overflow: hidden - this was preventing scrollbars */
    /* Calculate explicit height for proper flexbox behavior */
    height: calc(100vh - var(--header-height) - var(--ui-spacing) * 3 - 100px);
}

/* Show the panel when active */
#info-panel.active,
#info-panel:not([style*="display: none"]) {
    display: flex !important;
}

#info-panel h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 16px;
}

#info-panel-content {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 8px;
}

/* Info panel tabs - Fixed header */
.info-panel-tabs {
    display: flex;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    flex-shrink: 0; /* Prevent tabs from shrinking */
}

.info-panel-tab {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.info-panel-tab:first-child {
    border-radius: var(--ui-border-radius) 0 0 0;
}

.info-panel-tab:last-child {
    border-radius: 0 var(--ui-border-radius) 0 0;
}

.info-panel-tab:hover {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
}

.info-panel-tab.active {
    background: rgba(255,255,255,0.2);
    color: var(--text-color);
    border-bottom-color: var(--primary-color);
}

/* Info panel scrollable content - FIXED: Ensure scrolling works */
.info-panel-scrollable {
    flex: 1; /* Take up remaining space */
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden; /* Hide horizontal scrollbar */
    padding-right: 8px; /* Space for scrollbar */
    margin-right: -4px; /* Compensate for padding */
    
    /* Force minimum height for scrolling to work */
    min-height: 0; /* Critical for flexbox scrolling */
    max-height: 100%; /* Ensure it doesn't exceed container */
    
    /* Smooth scrolling */
    scroll-behavior: smooth;
    
    /* Ensure scrollbar appears when needed */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.4) rgba(255,255,255,0.1);
}

/* Force scrollbar to always show when content overflows */
.info-panel-scrollable:hover {
    scrollbar-color: rgba(255,255,255,0.6) rgba(255,255,255,0.2);
}

/* Enhanced scrollbar for webkit browsers - FIXED: More visible scrollbar */
.info-panel-scrollable::-webkit-scrollbar {
    width: 8px;
    background: rgba(255,255,255,0.1); /* Add background to make it visible */
}

.info-panel-scrollable::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    margin: 2px 0; /* Add margins to track */
}

.info-panel-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.5); /* Make thumb more visible */
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
    min-height: 30px; /* Minimum thumb size */
}

.info-panel-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.7);
}

.info-panel-scrollable::-webkit-scrollbar-thumb:active {
    background: rgba(255,255,255,0.9);
}

/* Force scrollbar to be visible even when not hovering */
.info-panel-scrollable::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 2px rgba(255,255,255,0.1);
}

/* Booth list styling - Enhanced for scrolling */
.booth-list {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.3);
    /* Remove any height restrictions to allow natural content flow */
}

.booth-list h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #ffd700;
    font-weight: bold;
    position: sticky; /* Keep header visible during scroll */
    top: 0;
    background: var(--ui-background);
    padding: 4px 0;
    z-index: 1;
}

.booth-item {
    margin-bottom: 10px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255,255,255,0.05);
}

.booth-item:last-child {
    margin-bottom: 10px; /* Add bottom margin for last item to ensure scrolling space */
}

.booth-item:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.booth-company {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 3px;
    color: #fff;
}

.booth-number {
    font-size: 11px;
    color: #ccc;
    margin-bottom: 6px;
}

.booth-cameras {
    margin-left: 10px;
    margin-bottom: 4px;
}

.booth-camera {
    font-size: 11px;
    color: #88ccff;
    margin-bottom: 2px;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: block;
    text-decoration: none;
}

.booth-camera:hover {
    color: #aaddff;
    background: rgba(136, 204, 255, 0.2);
    text-decoration: none;
}

.booth-camera .camera-icon {
    margin-right: 4px;
}

/* Booth animations styling */
.booth-animations {
    margin-left: 10px;
}

.booth-animation {
    font-size: 11px;
    color: #ffaa66;
    margin-bottom: 2px;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: block;
    text-decoration: none;
}

.booth-animation:hover {
    color: #ffcc88;
    background: rgba(255, 170, 102, 0.2);
    text-decoration: none;
}

.booth-animation .animation-icon {
    margin-right: 4px;
}

/* Navigation controls - Bottom center - Combined container */
#navigation-controls {
    display: none;
    bottom: var(--ui-spacing);
    left: 50%;
    transform: translateX(-50%);
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#navigation-controls.active {
    display: flex;
}

#navigation-controls button {
    margin: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 2px solid rgba(100, 100, 100, 0.6);
    border-radius: 10px;
    color: rgba(60, 60, 60, 0.9);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

#navigation-controls button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(80, 80, 80, 0.8);
    color: rgba(40, 40, 40, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#navigation-controls button:active {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.3);
}

/* Active button highlighting - glowing border effect */
#navigation-controls button.active {
    background: rgba(48, 128, 238, 0.7);
    border-color: rgba(48, 128, 238, 0.8);
    color: white;
    box-shadow: 0 0 0 3px rgba(48, 128, 238, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2);
}

#navigation-controls button.active::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid rgba(48, 128, 238, 0.6);
    border-radius: 14px;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(1.05);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

/* Vertical separator within navigation controls */
.navigation-separator {
    width: 2px;
    height: 44px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 4px;
    border-radius: 1px;
}

/* Advanced Navigation controls - Now part of main navigation container */
#advanced-navigation-controls {
    display: flex;
    gap: 8px;
}

#advanced-navigation-controls button {
    margin: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 2px solid rgba(100, 100, 100, 0.6);
    border-radius: 10px;
    color: rgba(60, 60, 60, 0.9);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

#advanced-navigation-controls button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(80, 80, 80, 0.8);
    color: rgba(40, 40, 40, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#advanced-navigation-controls button:active {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.3);
}

/* Active button highlighting for advanced controls */
#advanced-navigation-controls button.active {
    background: rgba(48, 128, 238, 0.7);
    border-color: rgba(48, 128, 238, 0.8);
    color: white;
    box-shadow: 0 0 0 3px rgba(48, 128, 238, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2);
}

#advanced-navigation-controls button.active::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid rgba(48, 128, 238, 0.6);
    border-radius: 14px;
    animation: pulse-glow 2s infinite;
}

/* Material Override Button - Top right, below fullscreen button */
#material-override-btn {
    position: absolute;
    display: none;
    top: calc(var(--header-height) + var(--ui-spacing) + 60px); /* Below fullscreen button */
    right: var(--ui-spacing);
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--ui-border-radius);
    cursor: pointer;
    transition: var(--ui-transition);
    z-index: 1000;
    box-shadow: var(--ui-shadow);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#material-override-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#material-override-btn.active {
    background: rgba(48, 128, 238, 0.8);
    border-color: rgba(48, 128, 238, 1);
    color: white;
}

#material-override-btn i {
    font-size: 16px;
}

/* RGI Logo Container - UPDATED: Lower z-index to stay below other UI elements */
#rgi-logo-container {
    position: absolute;
    bottom: var(--ui-spacing);
    right: var(--ui-spacing);
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 50; /* CHANGED: Reduced from 999 to 50 to keep it on bottom layer */
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

#rgi-logo-container img {
    max-width: 120px;
    height: auto;
    margin-bottom: 5px;
}

#rgi-logo-text {
    color: var(--text-color);
    font-size: 12px;
    text-align: center;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    max-width: 120px;
    word-wrap: break-word;
}

/* Navigation cursor styles */
.navigation-cursor {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    /* Removed transform transition - causes lag during mousemove */
}

.cursor-ring {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.2s ease;
}

.cursor-dot {
    width: 4px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.navigation-cursor.navigable .cursor-ring {
    border-color: var(--navigable-color);
    box-shadow: 0 0 8px rgba(0, 255, 100, 0.5);
}

.navigation-cursor.non-navigable .cursor-ring {
    border-color: var(--non-navigable-color);
    box-shadow: 0 0 8px rgba(255, 50, 50, 0.5);
}

/* Measurement container styles - UPDATED: Higher z-index to stay above logo */
.measurement-container {
    position: absolute;
    bottom: 20px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    z-index: 500; /* CHANGED: Increased from 100 to 500 to keep it above logo */
    display: none;
    min-width: 250px;
}

.measurement-container.active {
    display: block;
}

.measurement-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.measurement-count {
    font-weight: bold;
    color: #3080ee;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
}

.distance-display {
    margin-bottom: 5px;
    font-weight: bold;
}

.unit-selector {
    margin-bottom: 10px;
}

.unit-selector select {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 5px;
    width: 100%;
    border-radius: 4px;
}

.measurement-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.measurement-actions button {
    flex: 1;
    min-width: 70px;
    padding: 6px 10px;
    border-radius: 4px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 13px;
}

.measurement-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.measurement-actions button.danger {
    background: rgba(220, 53, 69, 0.7);
}

.measurement-actions button.danger:hover {
    background: rgba(220, 53, 69, 0.9);
}

#new-measurement {
    background: rgba(40, 167, 69, 0.7);
}

#new-measurement:hover {
    background: rgba(40, 167, 69, 0.9);
}

#finish-measurement {
    background: rgba(48, 128, 238, 0.7);
}

#finish-measurement:hover {
    background: rgba(48, 128, 238, 0.9);
}

/* Measurement hover point with improved appearance */
.measurement-point-hover {
    position: absolute;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    background: rgba(255, 100, 100, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    z-index: 99;
    pointer-events: none;
    animation: pulse-measure 1.5s infinite;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
}

@keyframes pulse-measure {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

/* Light and dark theme support */
body.light-theme {
    --ui-background: rgba(255,255,255,0.7);
    --ui-background-hover: rgba(255,255,255,0.9);
    --text-color: #333;
}

body.light-theme .top-header {
    background: var(--bg-light);
    color: #333;
}

body.light-theme .welcome-message {
    color: #28a745;
}

body.light-theme button {
    background: var(--primary-color);
    color: white;
}

body.light-theme .booth-list h4 {
    color: #ff8800;
}

body.light-theme .booth-camera {
    color: #0066cc;
}

body.light-theme .booth-camera:hover {
    color: #0044aa;
    background: rgba(0, 102, 204, 0.2);
}

body.light-theme .booth-animation {
    color: #cc6600;
}

body.light-theme .booth-animation:hover {
    color: #aa4400;
    background: rgba(204, 102, 0, 0.2);
}

/* Light theme info panel tabs */
body.light-theme .info-panel-tab {
    background: rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.7);
}

body.light-theme .info-panel-tab:hover {
    background: rgba(0,0,0,0.15);
    color: rgba(0,0,0,0.9);
}

body.light-theme .info-panel-tab.active {
    background: rgba(0,0,0,0.2);
    color: #333;
    border-bottom-color: var(--primary-color);
}

/* Light theme navigation controls */
body.light-theme #navigation-controls {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(200, 200, 200, 0.4);
}

body.light-theme #navigation-controls button {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(120, 120, 120, 0.5);
    color: rgba(40, 40, 40, 0.9);
}

body.light-theme #navigation-controls button:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(100, 100, 100, 0.7);
    color: rgba(20, 20, 20, 1);
}

body.light-theme #advanced-navigation-controls button {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(120, 120, 120, 0.5);
    color: rgba(40, 40, 40, 0.9);
}

body.light-theme #advanced-navigation-controls button:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(100, 100, 100, 0.7);
    color: rgba(20, 20, 20, 1);
}

body.light-theme .navigation-separator {
    background: rgba(120, 120, 120, 0.4);
}

/* Light theme material override button */
body.light-theme #material-override-btn {
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    border-color: rgba(120, 120, 120, 0.5);
}

body.light-theme #material-override-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(100, 100, 100, 0.7);
}

body.light-theme #material-override-btn.active {
    background: rgba(48, 128, 238, 0.8);
    color: white;
}

/* Light theme RGI logo text */
body.light-theme #rgi-logo-text {
    color: #333;
    text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.8);
}

/* Light theme info panel scrollbar */
body.light-theme .info-panel-scrollable::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

body.light-theme .info-panel-scrollable::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-color: rgba(0,0,0,0.1);
}

body.light-theme .info-panel-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.5);
}

body.light-theme .info-panel-scrollable::-webkit-scrollbar-thumb:active {
    background: rgba(0,0,0,0.7);
}

body.light-theme .booth-list h4 {
    background: rgba(255,255,255,0.7); /* Ensure header background in light theme */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .pmv-ui-element {
        padding: 8px;
    }
    
    /* Make camera selector and info panel narrower on mobile */
    #camera-selector {
        width: 120px;
        max-width: 14%;
    }
    
    #info-panel {
        width: 120px;
        max-width: 14%;
    }
    
    #navigation-controls {
        bottom: 10px;
        padding: 6px;
        gap: 6px;
    }
    
    #navigation-controls button {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    #advanced-navigation-controls button {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .navigation-separator {
        height: 38px;
    }
    
    #fullscreen-button {
        width: 36px;
        height: 36px;
        line-height: 36px;
    }

    #material-override-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    #rgi-logo-container img {
        max-width: 80px;
    }

    #rgi-logo-text {
        font-size: 10px;
        max-width: 80px;
    }
    
    /* Loading screen responsive adjustments */
    .loading-content {
        padding: 20px;
    }
    
    .loading-header h1 {
        font-size: 2rem;
    }
    
    .loading-step {
        padding: 10px;
        margin: 10px 0;
    }
    
    .step-name {
        font-size: 0.9rem;
    }
    
    /* Info panel mobile scrolling improvements */
    .info-panel-scrollable {
        padding-right: 4px;
        margin-right: -2px;
    }
    
    .info-panel-scrollable::-webkit-scrollbar {
        width: 6px;
    }
    
    .booth-item {
        padding: 6px 8px;
        margin-bottom: 8px;
    }
}

/* Ultra-wide screen adjustments */
@media (min-width: 1920px) {
    #camera-selector {
        width: 168px;
        max-width: 9%;
    }
    
    #info-panel {
        width: 168px;
        max-width: 9%;
    }
}

/* Very small screens (mobile landscape) */
@media (max-width: 480px) {
    #camera-selector {
        width: 112px;
        max-width: 18%;
    }
    
    #info-panel {
        width: 112px;
        max-width: 18%;
    }
    
    /* Even smaller scrollbar for very small screens */
    .info-panel-scrollable::-webkit-scrollbar {
        width: 4px;
    }
    
    .booth-item {
        padding: 4px 6px;
        margin-bottom: 6px;
    }
    
    .booth-company {
        font-size: 12px;
    }
    
    .booth-number {
        font-size: 10px;
    }
}

/* Loading checklist styles */
.loading-checklist {
    margin: 20px 0;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
    
    /* Custom scrollbar for checklist */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.4) rgba(255, 255, 255, 0.1);
}

.loading-checklist::-webkit-scrollbar {
    width: 6px;
}

.loading-checklist::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.loading-checklist::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
}

.loading-checklist::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.6);
}

.loading-checklist h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #4facfe;
    font-weight: 600;
}

.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checklist-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.checklist-item-pending {
    opacity: 0.6;
}

.checklist-item-loading {
    background: rgba(76, 172, 254, 0.15);
    border-color: rgba(76, 172, 254, 0.3);
    box-shadow: 0 0 10px rgba(76, 172, 254, 0.2);
}

.checklist-item-success {
    background: rgba(40, 167, 69, 0.15);
    border-color: rgba(40, 167, 69, 0.3);
}

.checklist-item-failed {
    background: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.3);
}

.checklist-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.checklist-item-pending .checklist-icon {
    color: rgba(255, 255, 255, 0.5);
}

.checklist-item-loading .checklist-icon {
    color: #4facfe;
}

.checklist-item-success .checklist-icon {
    color: #28a745;
}

.checklist-item-failed .checklist-icon {
    color: #dc3545;
}

.checklist-name {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.3;
}

.checklist-item-pending .checklist-name {
    color: rgba(255, 255, 255, 0.6);
}

.checklist-item-loading .checklist-name {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.checklist-item-success .checklist-name {
    color: rgba(255, 255, 255, 0.8);
}

.checklist-item-failed .checklist-name {
    color: rgba(255, 255, 255, 0.7);
}

/* Hide checklist when empty */
.loading-checklist:empty {
    display: none;
}