/* Reset default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, sans-serif;
}

/* Body and container styling */
body {
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}
.frames-sidebar{
    display: none;
}

/* Header styling */
.app-header {
    background-color: #2c3e50;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    font-size: 1.5em;
}

.file-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.btn-primary {
    background-color: #091320;
    color: white;
}

.btn-secondary {
    background-color: #4d85e9;
    color: white;
}

.btn:hover {
    transform: scale(1.05);
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary:hover {
    background-color: #95a5a6;
}

/* Main content layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar styling */
.sidebar {
    width: 300px;
    background-color: #ebeaea;
    padding: 15px;
    overflow-y: auto;
    border-right: 1px solid #ddd;
}
.sidebar .logo {
    display: inline-flex;
    width: 100%;
    justify-content: center;
}

.sidebar .logo img {
    width: 190px;
    height: auto;
}
.sidebar h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.series-container {
    margin-bottom: 20px;
}

.series-thumbnail {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
    padding: 5px;
    cursor: pointer;
    transition: box-shadow 0.3s;
}

.series-thumbnail:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.thumbnail-wrapper {
    width: 100%;
    height: 100px;
    overflow: hidden;
}

.thumbnail-label {
    text-align: center;
    font-size: 0.9em;
    color: #666;
    padding-top: 5px;
}

.metadata-container {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
}

.metadata-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.metadata-key {
    font-weight: bold;
    color: #2c3e50;
}

.metadata-value {
    color: #666;
}

/* Viewer container */
.viewer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #283142;
    padding: 10px;
}

/* Toolbar styling */
.toolbar {
    display: flex;
    gap: 10px;
    padding: 10px;
    background-color: #ebeaea;
    border-radius: 5px;
    margin-bottom: 10px;
}

.tool-group {
    display: flex;
    gap: 5px;
}

.toolButton {
    padding: 8px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.toolButton:hover {
    background-color: #f5f5f5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.toolButton.active {
    background-color: #3498db;
    color: white;
    border-color: #2980b9;
}

/* Dropdown styling */
.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 150px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1;
    border-radius: 5px;
    padding: 5px;
    top: 100%;
    left: 0;
}

.dropdown-content button {
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border: none;
    background: none;
    cursor: pointer;
}

.dropdown-content button:hover {
    background-color: #f5f5f5;
}

.show {
    display: block;
}

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

#frameSlider {
    width: 150px;
}

/* Image container */
.image-container {
    flex: 1;
    position: relative;
    background-color: #000;
    border-radius: 5px;
    overflow: hidden;
}

#dicomImage {
    width: 100%;
    height: 100%;
}

.frames-sidebar {
    position: absolute;
    right: 0;
    top: 0;
    width: 150px;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 10px;
    max-height: 100%;
    overflow-y: auto;
    display: none;
}

.frame-item {
    margin-bottom: 10px;
    cursor: pointer;
    color: white;
}

.frame-item.active {
    border: 2px solid #3498db;
}

.frame-item canvas {
    width: 100%;
    height: 80px;
}

.frame-item span {
    display: block;
    text-align: center;
    font-size: 0.9em;
}

/* Overlay styling */
.viewport-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    color: white;
    pointer-events: none;
}

.overlay-item {
    padding: 5px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
}

/* Footer styling */
.app-footer {
    background-color: #232c3c;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#statusMessage {
    font-size: 0.9em;
}

/* CT Playback Controls Styling */
#ctPlaybackControls {
    background-color: #e8f4fd;
    border: 1px solid #3498db;
    border-radius: 5px;
    padding: 8px;
    align-items: center;
}

#ctPlaybackControls .toolButton {
    background-color: #3498db;
    color: white;
    border: 1px solid #2980b9;
}

#ctPlaybackControls .toolButton:hover {
    background-color: #2980b9;
}

#ctPlaybackControls .toolButton.active {
    background-color: #27ae60;
    border-color: #229954;
}

.ct-speed-control {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0 10px;
}

.ct-speed-control label {
    font-weight: bold;
    color: #2c3e50;
}

#ctSpeedSlider {
    background: #ddd;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#ctSpeedSlider::-webkit-slider-thumb {
    appearance: none;
    width: 15px;
    height: 15px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
}

#ctSpeedSlider::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.ct-slice-info {
    background-color: rgba(52, 152, 219, 0.1);
    padding: 4px 8px;
    border-radius: 3px;
    font-weight: bold;
    color: #2c3e50;
}

/* CT Scan Single Slice Display */
/* Sidebar should remain visible for CT to show stackWrapper with 1 thumbnail */
.ct-single-slice .viewer-container {
    /* Keep normal width to accommodate sidebar */
}

.ct-single-slice .main-content {
    flex-direction: row;
}

/* Hide series container and frames sidebar for CT scans */
.series-container[style*="display: none"],
.frames-sidebar[style*="display: none"] {
    display: none !important;
}

/* CT Progress Bar */
.ct-progress-container {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

#ctProgressBar {
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

/* CT Slice Info Overlay */
#topleft {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
}

#ctSliceInfo {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-size: 14px;
}

/* Keyboard Help Styling */
.ct-keyboard-help {
    background-color: rgba(52, 152, 219, 0.1);
    padding: 4px 8px;
    border-radius: 3px;
    border-left: 3px solid #3498db;
}

#ctKeyboardHelp {
    font-family: 'Courier New', monospace;
}

/* Animation for CT playback */
@keyframes ctSliceTransition {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

.ct-playing #dicomImage {
    animation: ctSliceTransition 0.5s ease-in-out;
}

/* CT Controls responsive behavior */
@media (max-width: 1200px) {
    #ctPlaybackControls {
        flex-wrap: wrap;
        gap: 3px;
    }
    
    .ct-speed-control {
        margin: 5px 0;
    }
    
    #ctSpeedSlider {
        width: 60px;
    }
}

@media (max-width: 768px) {
    #ctPlaybackControls {
        display: none !important;
    }
    
    .ct-progress-container {
        height: 6px;
    }
    
    #ctSliceInfo {
        font-size: 12px;
    }
}

/* CT Series Thumbnail Styling */
.ct-series-thumbnail {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px solid #2196f3;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.2);
    position: relative;
}

.ct-series-thumbnail:hover {
    box-shadow: 0 6px 12px rgba(33, 150, 243, 0.3);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.ct-series-thumbnail .thumbnail-label {
    background-color: rgba(33, 150, 243, 0.1);
    color: #1976d2;
    font-weight: bold;
    padding: 8px;
    border-radius: 0 0 6px 6px;
    font-size: 0.85em;
}

.ct-series-thumbnail::before {
    content: "CT";
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #2196f3;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: bold;
    z-index: 1;
}

/* General Series Thumbnail Styling for Non-CT Modalities */
.general-series-thumbnail {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border: 2px solid #9c27b0;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(156, 39, 176, 0.2);
    position: relative;
}

.general-series-thumbnail:hover {
    box-shadow: 0 6px 12px rgba(156, 39, 176, 0.3);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.general-series-thumbnail .thumbnail-label {
    background-color: rgba(156, 39, 176, 0.1);
    color: #7b1fa2;
    font-weight: bold;
    padding: 8px;
    border-radius: 0 0 6px 6px;
    font-size: 0.85em;
}

.general-series-thumbnail::before {
    content: "IMG";
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #9c27b0;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: bold;
    z-index: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 30vh;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .frames-sidebar {
        width: 100px;
    }
}