/* PathPresenter-Inspired Virtual Slide Viewer */
/* Based on PathPresenter design with Persian/Farsi RTL support */

:root {
    --vl-primary: #007bff;
    --vl-primary-hover: #0056b3;
    --vl-light-bg: #f8f9fa;
    --vl-dark-text: #212529;
    --vl-border: #dee2e6;
    --vl-success: #28a745;
    --vl-danger: #dc3545;
    --vl-warning: #ffc107;
}

/* Main Container */
.vl-display-viewer {
    background: transparent;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Viewer Section: Contains Navbar + Viewer Canvas */
.vl-viewer-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
    overflow: hidden;
}

.vl-viewer-section > .container-fluid {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Slides Section: Contains Header + Slider + View All Link */
.vl-slides-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 20px 0;
}

/* Top Navigation Bar - PathPresenter Style */
.vl-navbar {
    background: transparent;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    z-index: 999;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Fullscreen mode - fix to top */
.fullscreen-mode .vl-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10001;
}

.vl-navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vl-navbar-brand img {
    height: 40px;
    width: auto;
}

/* Toolbar - PathPresenter Style */
.vl-viewer-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 5px 0;
}

/* PathPresenter Button Styling */
.vl-btn {
    background: #fff;
    border: 1px solid var(--vl-primary);
    color: var(--vl-primary);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.vl-btn:hover {
    background: var(--vl-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.vl-btn:active {
    transform: translateY(0);
}

.vl-btn.active {
    background: var(--vl-primary);
    color: #fff;
}

.vl-btn i {
    font-size: 14px;
}

/* Primary filled buttons */
.vl-btn-primary {
    background: var(--vl-primary);
    color: #fff;
    border-color: var(--vl-primary);
}

.vl-btn-primary:hover {
    background: var(--vl-primary-hover);
    border-color: var(--vl-primary-hover);
}

/* Button groups */
.vl-btn-group {
    display: inline-flex;
    gap: 4px;
    background: #fff;
    padding: 4px;
    border-radius: 50px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.vl-btn-group .vl-btn {
    margin: 0;
}

/* Slide Info Display */
.vl-slide-info-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.vl-slide-diagnosis {
    font-size: 14px;
    font-weight: 600;
    color: var(--vl-dark-text);
}

.vl-slide-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--vl-primary);
}

/* Viewer Container */
.vl-viewer-container {
    position: relative;
    width: 80%;
    background: #1a1a1a;
    padding: 20px 40px;
    box-sizing: border-box;
    border-radius: 50px;
    margin: auto;
    min-height: 0;
}

.vl-viewer-canvas {
    position: relative;
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    height: calc(100vh - 250px);
    min-height: 400px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* Fullscreen viewer */
.fullscreen-mode .vl-viewer-canvas {
    height: 100vh;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
}

/* OpenSeadragon Canvas */
#vl-openseadragon {
    width: 100%;
    height: 100%;
    background: #000;
}

/* Circular Rotation Slider - PathPresenter Style */
.vl-rotation-slider {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 100px;
    height: 100px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.vl-rotation-slider.active {
    opacity: 1;
    pointer-events: auto;
}

/* Round Slider Styles */
.vl-round-slider {
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.95);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.vl-rotation-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 600;
    color: var(--vl-dark-text);
}

/* Drawing Canvas Overlay */
.vl-drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
}

.vl-drawing-canvas.active {
    pointer-events: auto;
    cursor: crosshair;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Slide Information Panel */
.vl-slide-info-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 100;
    min-width: 280px;
    max-width: 350px;
}

.vl-slide-info-panel h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--vl-dark-text);
    border-bottom: 2px solid var(--vl-primary);
    padding-bottom: 10px;
}

.vl-slide-info-item {
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.vl-slide-info-label {
    color: #6c757d;
    font-weight: 500;
}

.vl-slide-info-value {
    color: var(--vl-dark-text);
    font-weight: 600;
}

/* Zoom Level Display */
.vl-zoom-display {
    background: #fff;
    padding: 6px 12px;
    border-radius: 50px;
    border: 1px solid var(--vl-primary);
    color: var(--vl-primary);
    font-weight: 600;
    font-size: 13px;
    min-width: 40px;
    text-align: center;
}

/* Filter Panel - PathPresenter Style */
.vl-filter-panel {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1000;
    max-width: 320px;
    display: none;
}

.vl-filter-panel.active {
    display: block;
    animation: slideInLeft 0.3s ease;
}

.vl-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--vl-border);
}

.vl-filter-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.vl-filter-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.vl-filter-close:hover {
    background: var(--vl-light-bg);
    color: var(--vl-dark-text);
}

.vl-filter-control {
    margin-bottom: 20px;
}

.vl-filter-control label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--vl-dark-text);
}

.vl-filter-value {
    color: var(--vl-primary);
    font-weight: 600;
}

.vl-filter-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

.vl-filter-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--vl-primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.vl-filter-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--vl-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Slider Wrapper with Arrows */
.vl-slider-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
    padding: 0 10px;
}

.vl-slider-arrow {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--vl-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: all 0.3s ease;
    opacity: 0.9;
}

.vl-slider-arrow:hover {
    background: linear-gradient(135deg, #ed0874 0%, #c4065d 100%);
    opacity: 1;
    transform: scale(1.1);
}

.vl-slider-arrow:active {
    transform: scale(0.95);
}

.vl-slider-arrow i {
    font-size: 18px;
}

/* Sidebar for slides - Positioned below canvas */
.vl-slide-sidebar {
    flex: 1;
    background: transparent;
    padding: 30px 15px;
    overflow-x: auto;
    overflow-y: hidden;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.vl-slides-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding-bottom: 10px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Horizontal Scrollbar Styling */
.vl-slide-sidebar::-webkit-scrollbar {
    display: none;
}

.vl-sidebar-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    text-align: center;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.vl-sidebar-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--vl-dark-text);
}

/* Slide Cards - Horizontal Layout */
.vl-slide-card {
    background: #fff;
    border: 2px solid var(--vl-border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
    max-width: 250px;
    flex-shrink: 0;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.vl-slide-card:hover {
    border-color: var(--vl-primary);
    box-shadow: 0 4px 12px rgba(0,123,255,0.2);
    transform: translateY(-3px);
}

.vl-slide-card.active {
    border-color: var(--vl-primary);
    box-shadow: 0 6px 16px rgba(0,123,255,0.4);
    transform: scale(1.05);
}

.vl-slide-card.active::before {
    content: '✓';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    background: var(--vl-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    z-index: 10;
}

.vl-slide-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

.vl-slide-content {
    padding: 15px;
}

.vl-slide-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--vl-dark-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vl-slide-meta {
    margin: 0;
    font-size: 11px;
    color: #6c757d;
    line-height: 1.6;
}

/* Loading Overlay */
.vl-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.vl-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: var(--vl-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%);
    }
}

/* Fullscreen Mode */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    background: #000;
    overflow: hidden;
}

.fullscreen-mode .vl-slide-sidebar {
    display: none;
}

.fullscreen-mode .vl-viewer-container {
    height: 100vh;
    padding: 0;
    background: #000;
}

/* Responsive Design */
@media (min-width: 601px) and (max-width: 768px) {
    .vl-navbar {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .vl-viewer-toolbar {
        justify-content: center;
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
    }
}

@media (max-width: 600px) {
    .vl-display-viewer {
        flex-direction: column;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .vl-viewer-section {
        flex-direction: row;
        align-items: flex-start;
        max-width: 100vw;
        overflow-x: hidden;
        height: auto;
        max-height: none;
    }

    .vl-slides-section {
        flex-direction: column;
        width: 100%;
        padding: 10px 0;
    }

    .vl-navbar {
        position: relative;
        width: 50px;
        min-width: 50px;
        max-width: 50px;
        height: auto;
        min-height: 600px;
        flex-direction: column;
        align-items: center;
        padding: 8px 4px;
        overflow-y: visible;
        overflow-x: hidden;
        order: 2;
        flex-shrink: 0;
    }

    .vl-navbar-brand {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        margin-bottom: 20px;
    }

    .vl-navbar-brand span {
        font-size: 16px !important;
    }

    .vl-viewer-toolbar {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        gap: 6px;
        overflow-x: hidden;
        overflow-y: auto;
        flex-wrap: nowrap;
    }

    .vl-viewer-toolbar .vl-btn {
        width: 35px;
        height: 35px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        font-size: 14px;
    }

    .vl-btn-group {
        flex-direction: column;
        width: 35px;
        border-radius: 20px;
    }

    .vl-zoom-display {
        font-size: 10px;
        padding: 2px 3px;
    }

    .vl-slide-info-top {
        display: none;
    }

    .vl-viewer-section > .container-fluid {
        flex: 1;
        order: 1;
        width: calc(100% - 50px);
        max-width: calc(100vw - 50px);
        overflow-x: hidden;
    }

    .vl-viewer-container {
        padding: 20px;
        max-width: 100%;
    }

    .vl-viewer-canvas {
        height: 600px;
        min-height: 400px;
    }

    .vl-slide-info-panel {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .vl-filter-panel {
        left: 10px;
        right: 10px;
        max-width: none;
        transform: translateY(-50%);
    }

    .vl-rotation-slider {
        bottom: 10px;
        right: 10px;
        width: 80px;
        height: 80px;
    }

    .vl-slide-card {
        min-width: 180px;
        max-width: 180px;
    }

    .vl-slide-img {
        height: 120px;
    }

    .vl-slide-sidebar {
        padding: 20px 10px;
    }

    .vl-slider-wrapper {
        gap: 5px;
        padding: 0 5px;
    }

    .vl-slider-arrow {
        width: 35px;
        height: 35px;
    }

    .vl-slider-arrow i {
        font-size: 14px;
    }

    .vl-sidebar-header h3 {
        font-size: 16px;
    }
}

/* RTL Support */
[dir="rtl"] .vl-slide-info-panel {
    right: auto;
    left: 20px;
}

[dir="rtl"] .vl-filter-panel {
    left: auto;
    right: 20px;
}

[dir="rtl"] .vl-rotation-slider {
    right: auto;
    left: 20px;
}

[dir="rtl"] .vl-slides-container {
    direction: rtl;
}

/* View All Images Button - Well-Formed CTA Button */
.vl-view-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #00b3fe 0%, #2eafe6 100%);
    color: #fff;
    padding: 18px 50px;
    border-radius: 12px;
    font-size: 19px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 179, 254, 0.35),
                0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
    font-family: 'Vazirmatn', sans-serif;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    letter-spacing: 0.5px;
    min-width: 350px;
}

.vl-view-all-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #2eafe6 0%, #00b3fe 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.vl-view-all-btn:hover::before {
    opacity: 1;
}

.vl-view-all-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(0, 179, 254, 0.5),
                0 8px 20px rgba(0, 0, 0, 0.2);
    color: #fff;
    text-decoration: none;
}

.vl-view-all-btn:active {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 179, 254, 0.4),
                0 4px 15px rgba(0, 0, 0, 0.15);
}

.vl-view-all-btn i {
    font-size: 22px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.vl-view-all-btn span {
    position: relative;
    z-index: 1;
}

.vl-view-all-btn:hover i:first-child {
    transform: scale(1.1);
}

.vl-view-all-btn:hover i:last-child {
    transform: translateX(-5px);
}

/* Responsive */
@media (max-width: 992px) {
    .vl-view-all-btn {
        padding: 14px 30px;
        font-size: 15px;
        min-width: 260px;
        gap: 10px;
    }

    .vl-view-all-btn i {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .vl-view-all-btn {
        padding: 12px 25px;
        font-size: 13px;
        min-width: 220px;
        gap: 8px;
    }

    .vl-view-all-btn i {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .vl-view-all-btn {
        padding: 10px 20px;
        font-size: 12px;
        min-width: auto;
        width: 90%;
        max-width: 280px;
        gap: 6px;
    }

    .vl-view-all-btn i {
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    .vl-navbar,
    .vl-slide-sidebar,
    .vl-filter-panel,
    .vl-slide-info-panel,
    .vl-rotation-slider,
    .vl-view-all-btn {
        display: none !important;
    }
}
