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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1600px;
    width: 100%;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
    flex-shrink: 0;
}

header h1 {
    font-size: 1.8em;
    margin-bottom: 5px;
    font-weight: 700;
}

.subtitle {
    font-size: 0.9em;
    opacity: 0.9;
}

main {
    padding: 15px;
    flex: 1;
    overflow: hidden;
    display: flex;
    gap: 15px;
    min-height: 0;
}

.main-layout {
    display: flex;
    gap: 20px;
    height: 100%;
    overflow: hidden;
}

/* Left Side: Video Section */
.video-section {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

/* Right Side: Info Section */
.info-section {
    flex: 1;
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 10px;
    overflow: hidden;
    min-width: 0;
}

.video-wrapper {
    position: relative;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    flex: 1;
    min-height: 0;
}

#videoFeed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.overlay {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
}

.status-indicator {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
    backdrop-filter: blur(10px);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 2s infinite;
}

.status-dot.inactive {
    background: #ef4444;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.camera-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 8px;
    justify-content: center;
    flex-shrink: 0;
}

.camera-recommendations {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 0.85em;
}

.recommendations-header {
    font-weight: 600;
    margin-bottom: 8px;
    color: #667eea;
}

.recommendation-item {
    padding: 6px 8px;
    margin: 4px 0;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #667eea;
    cursor: pointer;
    transition: all 0.2s;
}

.recommendation-item:hover {
    background: #f0f0f0;
    transform: translateX(2px);
}

.recommendation-item .reason {
    font-size: 0.8em;
    color: #666;
    margin-top: 2px;
}

.dual-camera-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
    background: #f0f9ff;
    border-radius: 8px;
    flex-shrink: 0;
}

.dual-camera-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
}

.dual-camera-controls input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.cross-reference-panel {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    border: 2px solid #fbbf24;
}

.camera-selector label {
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.camera-select {
    flex: 1;
    max-width: 400px;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.camera-select:hover {
    border-color: #667eea;
}

.camera-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.camera-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-shrink: 0;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-icon {
    font-size: 1.2em;
}

/* Compact Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    flex-shrink: 0;
}

.stat-card-compact {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-label-compact {
    font-size: 0.75em;
    color: #6b7280;
    margin-bottom: 5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value-compact {
    font-size: 1.8em;
    font-weight: 700;
    color: #667eea;
}

/* Compact Analytics */
.analytics-compact {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.analytics-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.9em;
    color: #333;
}

.analytics-grid-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.analytics-item-compact {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px;
    background: white;
    border-radius: 6px;
}

.analytics-label-compact {
    font-size: 0.7em;
    color: #6b7280;
    font-weight: 600;
}

.analytics-value-compact {
    font-size: 0.9em;
    font-weight: 700;
    color: #667eea;
}

.btn-reset-small {
    padding: 4px 10px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset-small:hover {
    background: #dc2626;
}

.btn-reset {
    padding: 8px 15px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.analytics-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.analytics-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

.analytics-label {
    font-weight: 600;
    color: #6b7280;
    font-size: 0.9em;
}

.analytics-value {
    font-weight: 700;
    color: #667eea;
    font-size: 1.1em;
}

.stat-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 0.9em;
    color: #6b7280;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2.5em;
    font-weight: 700;
    color: #667eea;
}

/* Compact Features Panel */
.features-panel-compact {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px;
    border-radius: 10px;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-title {
    margin: 0 0 8px 0;
    color: white;
    font-size: 0.9em;
    font-weight: 600;
    flex-shrink: 0;
}

.features-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    align-content: start;
}

.feature-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.feature-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.8em;
    flex-shrink: 0;
}

.feature-card-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    font-size: 0.7em;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.feature-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    min-height: fit-content;
}

.feature-label {
    opacity: 0.8;
    font-size: 0.75em;
    line-height: 1.2;
}

.feature-value {
    font-weight: 600;
    color: #fff;
    font-size: 0.8em;
    line-height: 1.2;
    word-break: break-word;
}

.feature-placeholder-compact {
    text-align: center;
    padding: 20px;
    opacity: 0.8;
    font-size: 0.9em;
}

/* Remove info panel - not needed in compact layout */
.info-panel {
    display: none;
}

.info-panel h3 {
    margin-bottom: 15px;
    color: #333;
}

.info-panel ul {
    list-style: none;
    padding-left: 0;
}

.info-panel li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #6b7280;
}

.info-panel li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

footer {
    background: #f9fafb;
    padding: 8px 20px;
    text-align: center;
    color: #6b7280;
    font-size: 0.75em;
    flex-shrink: 0;
}

/* Responsive design */
@media (max-width: 1200px) {
    .main-layout {
        flex-direction: column;
    }
    
    .video-section {
        flex: 0 0 auto;
    }
    
    .info-section {
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .analytics-grid-compact {
        grid-template-columns: 1fr;
    }
    
    .feature-card-content {
        grid-template-columns: 1fr;
    }
    
    .camera-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .camera-selector label {
        text-align: center;
    }
    
    .camera-select {
        max-width: 100%;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    margin: auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 700;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
}

.modal-body p {
    font-size: 1.1em;
    margin-bottom: 20px;
    color: #333;
    line-height: 1.6;
}

.instructions {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid #667eea;
}

.instructions h3 {
    margin: 0 0 15px 0;
    color: #667eea;
    font-size: 1.1em;
}

.instructions ol {
    margin: 0;
    padding-left: 20px;
    color: #555;
}

.instructions li {
    margin: 10px 0;
    line-height: 1.6;
}

.instructions ul {
    margin: 8px 0 0 20px;
    padding-left: 15px;
}

.instructions ul li {
    margin: 5px 0;
    font-size: 0.95em;
    color: #666;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1;
    min-width: 150px;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.2em;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
}

