/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

/* Mobile-first approach */
@media (min-width: 768px) {
    .container {
        padding: 0 20px;
    }
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem 0;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 10px;
    flex-wrap: wrap;
}

.logo:hover {
    transform: scale(1.02);
    background: rgba(102, 126, 234, 0.1);
}

.logo i {
    font-size: 2rem;
    color: #667eea;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.tagline {
    font-size: 0.9rem;
    color: #666;
    font-weight: 400;
    line-height: 1.4;
    padding: 0 1rem;
}

/* Mobile header adjustments */
@media (min-width: 768px) {
    .header {
        padding: 2rem 0;
        margin-bottom: 2rem;
    }
    
    .logo {
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .logo:hover {
        transform: scale(1.05);
    }
    
    .logo i {
        font-size: 2.5rem;
    }
    
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .tagline {
        font-size: 1.1rem;
        padding: 0;
    }
}

/* Main Content */
.main-content {
    margin-bottom: 3rem;
}

/* Use Case Selection */
.usecase-selection h2 {
    text-align: center;
    color: white;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    padding: 0 1rem;
    line-height: 1.3;
}

.usecase-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.usecase-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.usecase-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.usecase-card:active {
    transform: translateY(-2px);
}

.usecase-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    transform: translateY(-3px);
}

.usecase-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.usecase-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #333;
    line-height: 1.3;
}

.usecase-card p {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.features span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #555;
    justify-content: center;
    flex-wrap: wrap;
}

.features i {
    color: #667eea;
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* Tablet and desktop adjustments */
@media (min-width: 768px) {
    .usecase-selection h2 {
        font-size: 2.5rem;
        margin-bottom: 3rem;
        padding: 0;
    }
    
    .usecase-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 2rem;
    }
    
    .usecase-card {
        padding: 2.5rem;
        border-radius: 20px;
    }
    
    .usecase-card:hover {
        transform: translateY(-10px);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    }
    
    .usecase-icon {
        width: 80px;
        height: 80px;
        margin: 0 auto 1.5rem;
        font-size: 2rem;
    }
    
    .usecase-card h3 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .usecase-card p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .features span {
        font-size: 0.9rem;
        justify-content: flex-start;
    }
    
    .features i {
        font-size: 0.8rem;
    }
}

/* Camera Interface */
.camera-interface {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.camera-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.camera-header h2 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

.camera-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.video-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16/9;
    width: 100%;
    max-width: 100%;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror the video for better UX */
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.camera-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    text-align: center;
    padding: 1rem;
}

.camera-status i {
    font-size: 2rem;
    color: #667eea;
}

/* Controls Panel */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Tablet and desktop adjustments */
@media (min-width: 768px) {
    .camera-interface {
        border-radius: 20px;
        padding: 2rem;
        margin-bottom: 2rem;
    }
    
    .camera-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
        margin-bottom: 2rem;
    }
    
    .camera-header h2 {
        font-size: 2rem;
        text-align: left;
    }
    
    .camera-container {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
        margin-bottom: 2rem;
    }
    
    .video-container {
        border-radius: 15px;
    }
    
    #video {
        transform: none; /* Don't mirror on desktop */
    }
    
    .camera-status {
        font-size: 1.2rem;
        gap: 1rem;
    }
    
    .camera-status i {
        font-size: 3rem;
    }
    
    .controls-panel {
        gap: 2rem;
    }
}

/* Processed Frame Display */
.processed-frame-container {
    margin-top: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.processed-frame-container h3 {
    color: #fff;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    text-align: center;
}

.processed-frame-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

#processedFrame {
    max-width: 100%;
    height: auto;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.frame-info {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.info-item i {
    color: #667eea;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn {
    padding: 0.875rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    min-height: 44px; /* Minimum touch target size */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

/* Tablet and desktop button adjustments */
@media (min-width: 768px) {
    .control-group {
        gap: 1rem;
    }
    
    .btn {
        padding: 1rem 1.5rem;
        border-radius: 10px;
        font-size: 1rem;
        min-height: auto;
    }
    
    .btn:active {
        transform: none;
    }
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f, #a8e6cf);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(86, 171, 47, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(240, 147, 251, 0.4);
}

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

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Status Indicators */
.status-indicators {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #dee2e6;
}

.status-item i {
    font-size: 0.8rem;
}

.text-success { color: #28a745; }
.text-warning { color: #ffc107; }
.text-danger { color: #dc3545; }
.text-muted { color: #6c757d; }

/* Results Panel */
.results-panel {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.results-panel h3 {
    color: #333;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    text-align: center;
    line-height: 1.3;
}

.last-session-badge {
    background: #ffc107;
    color: #212529;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Tablet and desktop adjustments */
@media (min-width: 768px) {
    .results-panel {
        border-radius: 15px;
        padding: 2rem;
        margin-top: 2rem;
    }
    
    .results-panel h3 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .last-session-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        border-radius: 12px;
    }
    
    .results-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

/* Frame Display Area */
.frame-display-area {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
}

.frame-display-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 16px 16px 0 0;
    transition: all 0.3s ease;
}

.frame-display-area.frozen::before {
    background: linear-gradient(90deg, #ffc107, #ff9800);
}

.frame-display-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
}

.frame-display-header h3 {
    color: #333;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1.3;
}

.processing-type-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    align-self: center;
}

.processing-type-badge.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: processing-pulse 2s infinite;
}

@keyframes processing-pulse {
    0% { left: -100%; }
    100% { left: 100%; }
}

.frame-display-header h3 i {
    color: #667eea;
}

.frame-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.frame-controls .btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex: 1;
    min-width: 120px;
}

.frame-controls .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.frame-controls .btn:active {
    transform: translateY(0);
}

.frame-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
}

/* Tablet and desktop adjustments */
@media (min-width: 768px) {
    .frame-display-area {
        border-radius: 20px;
        padding: 2rem;
        margin-top: 2rem;
    }
    
    .frame-display-area::before {
        height: 4px;
        border-radius: 20px 20px 0 0;
    }
    
    .frame-display-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
    }
    
    .header-left {
        text-align: left;
    }
    
    .frame-display-header h3 {
        font-size: 1.5rem;
        justify-content: flex-start;
        gap: 0.75rem;
    }
    
    .processing-type-badge {
        padding: 0.25rem 0.75rem;
        font-size: 0.8rem;
        border-radius: 20px;
        align-self: flex-start;
    }
    
    .frame-controls {
        gap: 0.75rem;
        justify-content: flex-end;
    }
    
    .frame-controls .btn {
        flex: none;
        min-width: auto;
    }
    
    .frame-controls .btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }
    
    .frame-container {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
        align-items: start;
    }
}

.processed-frame-wrapper {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#processedFrame {
    width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    transition: all 0.3s ease;
}

#processedFrame.frozen {
    filter: brightness(0.8) contrast(1.2);
    border: 3px solid #ffc107;
    box-shadow: 0 8px 32px rgba(255, 193, 7, 0.3);
}

.frame-placeholder {
    text-align: center;
    color: #6c757d;
    padding: 2rem;
}

.frame-placeholder i {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.frame-placeholder p {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

.frame-placeholder span {
    font-size: 0.9rem;
    color: #6c757d;
}

.frame-info-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.frame-stats h4 {
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

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

.stat-item i {
    color: #667eea;
    width: 20px;
    text-align: center;
}

.stat-item span {
    color: #495057;
    font-size: 0.9rem;
}

.text-success {
    color: #28a745 !important;
    font-weight: 600;
}

.text-warning {
    color: #ffc107 !important;
    font-weight: 600;
}

.text-muted {
    color: #6c757d !important;
}

/* Hair contamination status badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.compliant {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.violation {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.frame-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid #667eea;
    color: #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.btn-outline:disabled {
    border-color: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
}

.btn-outline:disabled:hover {
    background: transparent;
    color: #6c757d;
}

.result-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.result-card h4 {
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.result-unit {
    color: #666;
    font-size: 0.9rem;
}

.result-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-clean { background: #d4edda; color: #155724; }
.category-stubble { background: #fff3cd; color: #856404; }
.category-short { background: #cce5ff; color: #004085; }
.category-medium { background: #f8d7da; color: #721c24; }
.category-long { background: #e2e3e5; color: #383d41; }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    padding: 1rem;
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    color: #333;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
    background: #f8f9fa;
}

.modal-body {
    padding: 1.5rem;
}

.calibration-instructions {
    margin-bottom: 1.5rem;
}

.calibration-instructions h4 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.calibration-instructions ul {
    list-style: none;
    padding: 0;
}

.calibration-instructions li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.calibration-instructions li:before {
    content: "✓";
    color: #28a745;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.calibration-preview {
    text-align: center;
    width: 100%;
    height: 200px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    overflow: hidden;
    position: relative;
}

.calibration-preview img,
.calibration-preview video {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.calibration-preview video {
    width: 100%;
    height: 100%;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    background: white;
    border-radius: 0 0 16px 16px;
}

.modal-footer .btn {
    flex: 1;
    min-width: 120px;
}

/* Tablet and desktop adjustments */
@media (min-width: 768px) {
    .modal {
        padding: 2rem;
    }
    
    .modal-content {
        margin: 5% auto;
        border-radius: 20px;
        max-width: 600px;
        max-height: 80vh;
    }
    
    .modal-header {
        padding: 1.5rem 2rem;
        border-radius: 20px 20px 0 0;
    }
    
    .modal-header h3 {
        font-size: 1.5rem;
    }
    
    .modal-close {
        font-size: 2rem;
        min-width: auto;
        min-height: auto;
        padding: 0;
    }
    
    .modal-body {
        padding: 2rem;
    }
    
    .calibration-instructions h4 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .calibration-instructions li {
        font-size: 1rem;
        padding: 0.5rem 0;
    }
    
    .calibration-preview img {
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
    
    .modal-footer {
        padding: 1.5rem 2rem;
        justify-content: flex-end;
        border-radius: 0 0 20px 20px;
    }
    
    .modal-footer .btn {
        flex: none;
        min-width: auto;
    }
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.loading-spinner p {
    font-size: 1.2rem;
    color: white;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-100px);
    transition: transform 0.3s ease;
    z-index: 3000;
    max-width: 100%;
}

.toast.show {
    transform: translateY(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #28a745;
}

.toast.error .toast-icon {
    color: #dc3545;
}

.toast.warning .toast-icon {
    color: #ffc107;
}

.toast-message {
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    line-height: 1.5;
    margin-top: 2rem;
}

/* Tablet and desktop adjustments */
@media (min-width: 768px) {
    .toast {
        top: 20px;
        right: 20px;
        left: auto;
        max-width: 350px;
        border-radius: 10px;
        padding: 1rem 1.5rem;
        transform: translateX(400px);
    }
    
    .toast.show {
        transform: translateX(0);
    }
    
    .toast-icon {
        font-size: 1.2rem;
    }
    
    .toast-message {
        font-size: 1rem;
    }
    
    .footer {
        padding: 2rem 0;
        font-size: 0.9rem;
    }
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .header {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
    
    .logo {
        gap: 0.5rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .tagline {
        font-size: 0.85rem;
        padding: 0 0.5rem;
    }
    
    .usecase-selection h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .usecase-card {
        padding: 1.25rem;
    }
    
    .camera-interface {
        padding: 1rem;
    }
    
    .camera-header h2 {
        font-size: 1.25rem;
    }
    
    .frame-display-area {
        padding: 1rem;
    }
    
    .results-panel {
        padding: 1rem;
    }
    
    .modal {
        padding: 0.5rem;
    }
    
    .modal-content {
        margin: 1% auto;
    }
}

/* Mode Selection Styles */
.mode-selection {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mode-selection h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.mode-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.mode-card:hover::before {
    opacity: 0.05;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.mode-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.mode-icon {
    position: relative;
    z-index: 2;
    margin-bottom: 1rem;
}

.mode-icon i {
    font-size: 3rem;
    color: #667eea;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mode-card h3 {
    position: relative;
    z-index: 2;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.mode-card p {
    position: relative;
    z-index: 2;
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.mode-card .features {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mode-card .features span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #555;
    font-size: 0.9rem;
}

.mode-card .features i {
    color: #28a745;
    font-size: 0.8rem;
}

/* Use Case Header */
.usecase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.usecase-header h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Single Image Interface Styles */
.single-image-interface {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.single-image-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.single-image-header h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.single-image-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.image-upload-area {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 2px dashed #e0e0e0;
    transition: all 0.3s ease;
}

.upload-zone {
    text-align: center;
    padding: 2rem;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.upload-zone:hover {
    background: rgba(102, 126, 234, 0.05);
    border-color: #667eea;
}

.upload-content i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
    display: block;
}

.upload-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.upload-content p {
    color: #666;
    margin-bottom: 1.5rem;
}

.image-preview {
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.image-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Image Source Selection */
.image-source-selection {
    text-align: center;
    margin-bottom: 2rem;
}

.image-source-selection h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #333;
}

.source-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.source-btn {
    min-width: 200px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.source-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.source-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.source-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Image Capture Area */
.image-capture-area {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 2px dashed #e0e0e0;
    transition: all 0.3s ease;
}

.image-capture-area:hover {
    border-color: #667eea;
}

/* Camera Area for Single Image */
.image-camera-area {
    margin-top: 1rem;
}

.image-camera-area .camera-container {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-camera-area .camera-container video {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.camera-status {
    text-align: center;
}

.camera-status i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.camera-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Mobile Responsive for Mode Selection */
@media (max-width: 768px) {
    .mode-selection {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .mode-selection h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .mode-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .mode-card {
        padding: 1.5rem;
    }
    
    .mode-icon i {
        font-size: 2.5rem;
    }
    
    .mode-card h3 {
        font-size: 1.25rem;
    }
    
    .usecase-header,
    .single-image-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .usecase-header h2,
    .single-image-header h2 {
        font-size: 1.5rem;
    }
    
    .single-image-container {
        gap: 1.5rem;
    }
    
    .image-upload-area {
        padding: 1.5rem;
    }
    
    .upload-zone {
        padding: 1.5rem;
    }
    
    .upload-content i {
        font-size: 2.5rem;
    }
    
    .upload-content h3 {
        font-size: 1.25rem;
    }
    
    .image-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .source-options {
        flex-direction: column;
        align-items: center;
    }
    
    .source-btn {
        min-width: 150px;
        width: 100%;
        max-width: 300px;
    }
    
    .image-camera-area .camera-container {
        min-height: 250px;
    }
    
    .camera-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .camera-controls .btn {
        width: 100%;
        max-width: 200px;
    }
}
