/* Professional Image Overlay System for Clinical Radiographs */
/* Designed for Thakaamed AI clinical validation interface */

/* Overlay Container */
.image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.image-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Container */
.overlay-container {
    position: relative;
    width: 95%;
    height: 95%;
    max-width: 1400px;
    max-height: 900px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.overlay-header {
    background: linear-gradient(135deg, #9370DB, #663399);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.overlay-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.overlay-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 4px 0 0 0;
}

.overlay-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Control Buttons */
.overlay-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.overlay-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.overlay-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
}

.close-btn {
    background: rgba(220, 38, 38, 0.8);
    border-color: rgba(220, 38, 38, 0.9);
    padding: 8px 12px;
    font-size: 18px;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(220, 38, 38, 0.9);
}

/* Content Area */
.overlay-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Image Viewer */
.image-viewer {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* View Modes */
.single-view {
    justify-content: center;
    align-items: center;
}

.comparison-view {
    flex-direction: row;
}

.image-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border-right: 2px solid #e2e8f0;
}

.image-panel:last-child {
    border-right: none;
}

.panel-header {
    background: #f8fafc;
    padding: 12px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-title {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 16px;
}

.panel-subtitle {
    font-size: 14px;
    color: #64748b;
}

/* Image Container */
.image-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: grab;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-container.dragging {
    cursor: grabbing;
}

.radiograph-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    user-select: none;
    -webkit-user-drag: none;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    padding: 8px;
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.zoom-level {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

/* Side Panel */
.overlay-sidebar {
    width: 350px;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    font-size: 18px;
    color: #9370DB;
}

/* Case Navigation */
.case-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.nav-btn {
    flex: 1;
    padding: 10px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.nav-btn:hover {
    border-color: #9370DB;
    color: #9370DB;
}

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

.nav-btn:disabled:hover {
    border-color: #e2e8f0;
    color: #64748b;
}

/* Case Info */
.case-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.info-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.info-value {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    display: block;
}

.info-label {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* Problems List */
.problems-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

.problem-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.problem-item:hover {
    border-color: #9370DB;
    box-shadow: 0 2px 8px rgba(147, 112, 219, 0.1);
}

.problem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.tooth-number {
    background: #9370DB;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.confidence-badge {
    background: #10b981;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.confidence-badge.medium {
    background: #f59e0b;
}

.confidence-badge.low {
    background: #ef4444;
}

.problem-type {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
}

.problem-details {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* Image Selection */
.image-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.image-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.image-thumb:hover {
    border-color: #9370DB;
}

.image-thumb.active {
    border-color: #9370DB;
    box-shadow: 0 0 0 2px rgba(147, 112, 219, 0.3);
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #9370DB;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Keyboard Shortcuts Help */
.shortcuts-help {
    position: absolute;
    top: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
}

.shortcuts-help.visible {
    opacity: 1;
    visibility: visible;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 15px;
}

.shortcut-key {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .overlay-sidebar {
        width: 300px;
    }
    
    .overlay-container {
        width: 98%;
        height: 98%;
    }
}

@media (max-width: 768px) {
    .overlay-container {
        flex-direction: column;
    }
    
    .overlay-sidebar {
        width: 100%;
        max-height: 250px;
        order: -1;
    }
    
    .overlay-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .overlay-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .comparison-view {
        flex-direction: column;
    }
    
    .image-panel {
        border-right: none;
        border-bottom: 2px solid #e2e8f0;
    }
    
    .image-panel:last-child {
        border-bottom: none;
    }
    
    .case-nav {
        flex-direction: column;
    }
    
    .case-info {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .overlay-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .overlay-header {
        padding: 15px 20px;
    }
    
    .overlay-title {
        font-size: 18px;
    }
    
    .overlay-subtitle {
        font-size: 13px;
    }
    
    .sidebar-section {
        padding: 15px;
    }
    
    .zoom-controls {
        bottom: 10px;
        right: 10px;
        gap: 6px;
    }
    
    .zoom-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    .image-overlay {
        position: static;
        background: white;
        width: 100%;
        height: auto;
    }
    
    .overlay-header {
        background: white;
        color: black;
        border-bottom: 2px solid #000;
    }
    
    .overlay-controls {
        display: none;
    }
    
    .overlay-sidebar {
        border: none;
        background: white;
    }
    
    .zoom-controls {
        display: none;
    }
    
    .shortcuts-help {
        display: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .image-overlay {
        background: rgba(0, 0, 0, 0.98);
    }
    
    .overlay-container {
        border: 2px solid #000;
    }
    
    .overlay-btn {
        border-width: 2px;
    }
    
    .image-panel {
        border-width: 3px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .image-overlay,
    .radiograph-image,
    .overlay-btn,
    .problem-item,
    .image-thumb {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: #9370DB;
    }
}