/* ============================================
   aaMultiViewer - Unified Viewer Styles
   Mobile-Optimized Version
   ============================================ */

/* ============================================
   CONTAINER
   ============================================ */
.aamv-viewer-container {
    margin: 2rem 0;
    background: #111;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    color: #fff;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* ============================================
   HEADER BAR
   ============================================ */
.aamv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
    padding: 0 1rem;
    height: 47px;
    position: relative;
}

.aamv-counter {
    display: flex;
    align-items: center;
    color: #999;
    font-size: 16px;
    z-index: 10;
}

.aamv-header-buttons {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    z-index: 10;
    position: relative;
}

/* HEADER TOOLBAR BUTTONS */
.aamv-header .aamv-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    margin-left: 2px;
}

.aamv-header .aamv-icon i {
    font-size: 24px;
    line-height: 1;
}

.aamv-header .aamv-icon:hover,
.aamv-header .aamv-icon:active {
    background: var(--primary-dark, #0066cc);
    color: #fff;
}

.aamv-header .aamv-icon:active {
    transform: scale(0.95);
}


/* ============================================
   TOOLS PANEL
   ============================================ */

/* Tools toggle button active state */
.aamv-tools-toggle.active {
    background: var(--primary-dark, #0066cc);
    color: #fff;
}

/* Tools Panel Container */
.aamv-tools-panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: #1a1a1a;
    border: 2px solid #444;
    border-radius: 6px;
    padding: 12px;
    padding-top: 38px; /* Increased top padding to clear the close button */
    width: 200px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

.aamv-tools-panel.active {
    display: block !important;
}

/* Close button in top-right corner */
.aamv-tools-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 3px;
}

.aamv-tools-close i {
    font-size: 18px;
}

.aamv-tools-close:hover {
    background: #333;
    color: #fff;
}

/* Section Structure - Tightened margins */
.aamv-tools-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #333;
}

.aamv-tools-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* New Zoom Row Container */
.aamv-zoom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Zoom Input Wrapper */
.aamv-zoom-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative; /* Relative for absolute positioning of unit */
}

.aamv-zoom-value {
    width: 60px;
    background: #2a2a2a;
    border: 1px solid #555;
    color: #fff;
    padding: 10px 5px !important; 
    padding-right: 20px !important; /* Space for the % sign */
    border-radius: 4px;
    text-align: right;
    font-size: 15px;
    font-weight: bold;
    -moz-appearance: textfield;
    margin-bottom: 1px !important; /* Force override of theme styles */
}

.aamv-zoom-value:focus {
    outline: none;
    border-color: var(--primary-dark, #0066cc);
    background: #333;
}

.aamv-zoom-value::-webkit-outer-spin-button,
.aamv-zoom-value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.aamv-zoom-unit {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none; /* Allow clicks to pass through to input */
}

.aamv-tool-btn {
    flex: 1;
    padding: 10px;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
}

.aamv-tool-btn i {
    font-size: 18px;
}

.aamv-tool-btn:hover {
    background: #333;
    color: #fff;
    border-color: #999;
}

.aamv-tool-btn:active, .aamv-tool-btn.active {
    transform: scale(0.97);
    background: var(--primary-dark, #0066cc);
    color: #fff;
    border-color: var(--primary-dark, #0066cc);
}

/* PDF Presets */
.aamv-pdf-presets {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Matching the gap of transform buttons */
    margin-top: 10px; /* Space from zoom row */
}

.aamv-preset-btn {
    width: 100%;
    padding: 10px;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
}

.aamv-preset-btn i {
    font-size: 16px;
}

.aamv-preset-btn:hover {
    background: #333;
    color: #fff;
    border-color: #999;
}

.aamv-preset-btn:active {
    transform: scale(0.97);
}

/* Transform Buttons - full width with gap like zoom section */
.aamv-transform-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Ensure this matches PDF preset gap */
}

.aamv-transform-buttons .aamv-tool-btn {
    width: 100%;
}

/* Reset Section - no border at bottom */
.aamv-reset-section {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* IIIF Indicator */
.aamv-iiif-indicator {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4caf50; /* Green color for active state */
    font-size: 13px;
    font-weight: 600;
    justify-content: center;
}

.aamv-iiif-indicator i {
    font-size: 16px;
}

/* Move right navigation arrow below tools panel when panel is open */
.aamv-side-right .aamv-nav {
    transition: margin-top 0.3s ease;
    margin-top: 0;
}

.aamv-viewer-container.tools-panel-open .aamv-side-right .aamv-nav {
    /* Value updated by JS, fallback here */
    margin-top: 260px;
}

/* Hide navigation and counter when only one item */
.aamv-viewer-container.single-item .aamv-side {
    display: none;
}

.aamv-viewer-container.single-item .aamv-counter {
    display: none;
}

/* When single item, give full width to viewer */
.aamv-viewer-container.single-item .aamv-viewer-wrapper {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Keep header buttons right-aligned when single item */
.aamv-viewer-container.single-item .aamv-header-buttons {
    margin-left: auto;
}

/* CENTERED FILENAME */
.aamv-filename {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: 47px;
    display: flex;
    align-items: center;
    color: #ccc;
    font-size: 16px;
    max-width: 50%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.25s ease-in-out;
    cursor: default;
}

.aamv-filename.fade-out {
    opacity: 0;
}

/* ============================================
   MAIN VIEWER AREA
   ============================================ */
.aamv-main {
    position: relative;
    background: #000;
    -webkit-overflow-scrolling: touch;
}

.aamv-viewer-wrapper {
    width: calc(100% - 94px);
    margin-left: 47px;
    margin-right: 47px;
    background: #000;
    position: relative;
    touch-action: manipulation;
}

.aamv-viewer {
    width: 100%;
    height: 60vh;
    min-height: 300px;
    background: #000;
}

/* OpenSeadragon image viewer - browser native grab cursor */
.aamv-viewer .openseadragon-canvas {
    cursor: grab !important;
}

.aamv-viewer .openseadragon-canvas:active {
    cursor: grabbing !important;
}

/* Placeholder Image Styles */
.aamv-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
    z-index: 5; /* Sit on top of OSD canvas (usually z-index 0 or 1) */
    opacity: 1;
    transition: opacity 0.6s ease-out; /* Smooth cross-fade */
    pointer-events: none; /* Allow clicks to pass through to OSD while fading */
}

.aamv-placeholder.fade-out {
    opacity: 0;
}

.aamv-office-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #f5f5f5;
}

/* ============================================
   AUDIO PLAYER STYLES
   ============================================ */
.aamv-audio-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    padding: 20px;
    box-sizing: border-box;
}

.aamv-audio-player {
    width: 100%;
    max-width: 750px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.aamv-audio-visual {
    height: 240px;
    background: linear-gradient(135deg, #222 0%, #111 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 1.5rem;
    text-align: center;
}

.aamv-audio-icon {
    font-size: 72px;
    color: #444;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.aamv-audio-container.playing .aamv-audio-icon {
    color: var(--primary-dark, #0066cc);
    text-shadow: 0 0 20px rgba(0, 102, 204, 0.4);
    transform: scale(1.1);
    animation: pulse-audio 2s infinite;
}

.aamv-audio-title {
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aamv-audio-type {
    color: #888;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

/* Audio Center Timer - 28px */
.aamv-audio-visual .aamv-media-time {
    font-size: 28px;
    color: #fff;
    font-weight: bold;
    background: rgba(0,0,0,0.4);
    padding: 8px 20px;
    border-radius: 24px;
    margin-top: 15px;
    display: inline-block;
    min-width: auto;
}

@keyframes pulse-audio {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   VIDEO PLAYER STYLES
   ============================================ */
.aamv-video-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.aamv-video {
    width: 100%;
    height: 100%;
    max-height: calc(100% - 80px);
    object-fit: contain;
}

/* ============================================
   SHARED MEDIA CONTROLS
   ============================================ */
.aamv-video-controls,
.aamv-audio-controls {
    height: 80px; 
    background: #111;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
    z-index: 20;
}

.aamv-video-btn, 
.aamv-audio-btn {
    background: transparent;
    border: none;
    color: #ccc;
    cursor: pointer;
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.aamv-video-btn:hover,
.aamv-audio-btn:hover {
    background: #333;
    color: #fff;
}

.aamv-video-btn.active,
.aamv-audio-btn.active {
    color: var(--primary-dark, #0066cc);
}

.aamv-video-btn i,
.aamv-audio-btn i {
    font-size: 36px;
}

/* Standardized Progress Bar */
.aamv-media-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    margin: 0;
    position: relative;
    height: 40px;
    cursor: pointer;
}

.aamv-media-progress {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    background: #333;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    padding: 10px 0px !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    border: none;
}

.aamv-audio-progress { 
    background: #333;
    margin: 0 !important;
    margin-bottom: 0 !important;
}

.aamv-video-progress {
    margin: 0 !important;
    margin-bottom: 0 !important;
}

.aamv-media-progress::-webkit-slider-runnable-track {
    width: 100%;
    height: 10px;
    background: #333;
    border-radius: 5px;
    margin: 0;
    padding: 0;
}

.aamv-media-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.1s;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    margin-top: -7px;
}

.aamv-media-progress::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #fff;
}

.aamv-media-progress::-moz-range-track {
    width: 100%;
    height: 10px;
    background: #333;
    border-radius: 5px;
}

.aamv-media-progress::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* 28px Control Text (Time Display and Speed Button) */
.aamv-media-time,
.aamv-speed-btn {
    font-size: 28px;
    font-weight: bold;
    color: #ccc;
    font-variant-numeric: tabular-nums;
    min-width: 160px;
    text-align: center;
    line-height: 1;
}

.aamv-speed-btn {
    min-width: 80px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 10px;
}

/* Volume Container */
.aamv-volume-container {
    display: flex;
    align-items: center;
    width: 54px;
    overflow: hidden;
    transition: width 0.3s ease;
}

.aamv-volume-container:hover {
    width: 180px;
}

.aamv-volume-slider {
    width: 100px;
    height: 6px;
    margin-left: 10px;
    cursor: pointer;
}

/* Speed Popup Menu */
.aamv-speed-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.aamv-speed-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 15px;
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 8px 0;
    display: none;
    flex-direction: column;
    min-width: 100px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    z-index: 100;
}

.aamv-speed-menu.active {
    display: flex;
}

.aamv-speed-opt {
    background: transparent;
    border: none;
    color: #ccc;
    padding: 10px 20px;
    text-align: center;
    cursor: pointer;
    font-size: 18px;
    width: 100%;
}

.aamv-speed-opt:hover {
    background: #333;
    color: #fff;
}

.aamv-speed-opt.selected {
    color: var(--primary-dark, #0066cc);
    font-weight: bold;
}

/* Video Overlay Play Button */
.aamv-video-overlay-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: none;
    opacity: 0;
}

.aamv-video-container.paused .aamv-video-overlay-play {
    opacity: 1;
}

.aamv-video-overlay-play i {
    font-size: 40px;
    color: #fff;
    margin-left: 5px;
}

#aamv-viewer.openseadragon {
    background: #000 !important;
}

.openseadragon-canvas {
    background: #000 !important;
}

/* ============================================
   SIDE NAVIGATION PANELS
   ============================================ */
.aamv-side {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 47px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    cursor: pointer;
}

.aamv-side-left { left: 0; }
.aamv-side-right { right: 0; }

.aamv-nav {
    width: 40px;
    height: 40px;
    color: #999;
    background: rgba(0,0,0,0.35);
    border-radius: 4px;
    padding: 0;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    pointer-events: none;
}

.aamv-nav i {
    font-size: 32px;
}

.aamv-side:hover .aamv-nav {
    color: #fff;
    background: var(--primary-dark, #0066cc);
}

.aamv-side:active .aamv-nav {
    transform: scale(0.95);
}

/* ============================================
   THUMBNAIL RIBBON - Updated for Centering
   ============================================ */
.aamv-ribbon-thumbs {
    display: flex;
    justify-content: flex-start; /* Aligned to start to support scrolling logic */
    position: relative;          /* Support offset calculations in JS */
    gap: 8px;
    padding: 10px;
    background: #111;
    border-top: 1px solid #333;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #666 #222;
}

/* Add spacers before and after content to center it when not overflowing */
.aamv-ribbon-thumbs::before,
.aamv-ribbon-thumbs::after {
    content: '';
    margin: auto;
}

.aamv-thumb-item {
    width: 80px;
    height: 80px;
    background: #222;
    border-radius: 4px;
    border: 4px solid transparent;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
    min-width: 80px;
    min-height: 80px;
    -webkit-tap-highlight-color: transparent;
}

.aamv-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.4);
    display: block;
    pointer-events: none;
}

.aamv-thumb-item:hover {
    border-color: var(--primary);
    background: #333;
}

.aamv-thumb-item.active {
    border-color: var(--primary-dark, #0066cc);
    background: #222;
    border-width: 6px;
}

.aamv-thumb-item:active {
    transform: scale(0.95);
}

/* ============================================
   FULLSCREEN MODE
   ============================================ */
.aamv-viewer-container.fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    border-radius: 0;
    margin: 0;
}

.aamv-viewer-container.fullscreen .aamv-viewer {
    height: calc(100vh - 140px);
}

/* ============================================
   NO MEDIA MESSAGE
   ============================================ */
.aamv-no-media-wrapper {
    margin: 2rem 0;
}

.aamv-no-media-content {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
}

.aamv-no-media-content p:last-child {
    margin-bottom: 0;
}

/* ============================================
   PDF VIEWER
   ============================================ */
.aamv-pdf-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #000;
}

.aamv-pdf-canvas {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    background: #000;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* Continuous Mode - Vertical layout for pages */
.aamv-pdf-canvas.continuous-mode {
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    cursor: default;
    overflow-y: auto !important; /* Force scrollbar */
    /* In continuous mode, scroll is handled natively */
}

/* Individual page wrapper for continuous view */
.pdf-page-container {
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    background: #fff; /* Loading placeholder color */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Prevent canvas from exceeding container */
}

.aamv-pdf-canvas:active {
    cursor: grabbing;
}

/* Restore default cursor for continuous mode */
.aamv-pdf-canvas.continuous-mode:active {
    cursor: default;
}

.aamv-pdf-canvas canvas {
    max-width: none;
    max-height: none;
    display: block;
    margin: 0 auto;
    pointer-events: none;
}

.aamv-pdf-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #111;
    border-top: 1px solid #333;
    min-height: 50px;
}

.aamv-pdf-btn {
    padding: 0.5rem 1rem;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    height: 36px;
}

.aamv-pdf-btn i {
    font-size: 18px;
    line-height: 1;
}

.aamv-pdf-btn:hover {
    background: var(--primary-dark, #0066cc);
    border-color: #ccc;
}

.aamv-pdf-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #222;
    border-color: #444;
}

.aamv-pdf-page-info {
    color: #ccc;
    font-size: 14px;
    background: #222;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #333;
    margin: 0 0.5rem;
    white-space: nowrap;
}

/* ============================================
   ARCHIVE VIEWER (ZIP)
   ============================================ */
.aamv-archive-container {
    width: 100%;
    height: 100%;
    background: #000;
    padding: 2rem;
    overflow-y: auto;
    box-sizing: border-box;
}

.aamv-archive-header {
    text-align: center;
    margin-bottom: 2rem;
}

.aamv-archive-icon {
    font-size: 64px;
    margin-bottom: 1rem;
    color: #999;
}

.aamv-archive-title {
    color: #fff;
    font-size: 20px;
    margin-bottom: 0.5rem;
}

.aamv-archive-subtitle {
    color: #999;
    font-size: 16px;
    margin-bottom: 1.5rem;
}

.aamv-archive-message {
    color: #ccc;
    font-size: 14px;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.aamv-archive-files {
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    max-width: 800px;
    margin: 0 auto 2rem;
}

.aamv-archive-file {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #222;
    color: #ccc;
    transition: background 0.15s ease;
}

.aamv-archive-file:last-child {
    border-bottom: none;
}

.aamv-archive-file:hover {
    background: #1a1a1a;
}

.aamv-archive-folder {
    font-weight: bold;
    color: #ccc;
    cursor: pointer;
    user-select: none;
}

.aamv-archive-folder:hover {
    background: #222;
}

.aamv-archive-folder.collapsed {
    opacity: 0.7;
}

.aamv-archive-toggle {
    display: inline-block;
    width: 20px;
    margin-right: 0.25rem;
    text-align: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.aamv-archive-toggle i {
    font-size: 16px;
    vertical-align: middle;
}

.aamv-archive-file-icon {
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.aamv-archive-file-icon i {
    font-size: 18px;
    vertical-align: middle;
}

.aamv-archive-file-name {
    flex: 1;
    font-size: 14px;
    word-break: break-word;
    min-width: 0;
}

.aamv-archive-file-size {
    color: #666;
    font-size: 12px;
    margin-left: 1rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.aamv-archive-file-count {
    color: #666;
    font-size: 12px;
    margin-left: 0.5rem;
    font-weight: normal;
    white-space: nowrap;
    flex-shrink: 0;
}

.aamv-archive-children {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.aamv-archive-children.collapsed {
    max-height: 0 !important;
    opacity: 0;
}

.aamv-archive-download {
    text-align: center;
}

.aamv-archive-download-btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--primary-dark, #0066cc);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.aamv-archive-download-btn:hover {
    background: #0052a3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

/* ============================================
   SCROLLBAR IMPROVEMENTS
   ============================================ */
.aamv-ribbon-thumbs::-webkit-scrollbar {
    height: 16px; 
}

.aamv-ribbon-thumbs::-webkit-scrollbar-track {
    background: #222;
    border-radius: 6px;
}

.aamv-ribbon-thumbs::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 6px;
    border: 2px solid #222;
}

.aamv-ribbon-thumbs::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.aamv-archive-container::-webkit-scrollbar {
    width: 16px;
}

.aamv-archive-container::-webkit-scrollbar-track {
    background: #111;
}

.aamv-archive-container::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 6px;
    border: 2px solid #111;
}

.aamv-archive-container::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.aamv-archive-container {
    scrollbar-width: thin;
    scrollbar-color: #666 #111;
}

/* ============================================
   UNSUPPORTED VIEWER
   ============================================ */
.aamv-unsupported-container {
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-sizing: border-box;
}

.aamv-unsupported-content {
    text-align: center;
    max-width: 500px;
}

.aamv-unsupported-icon {
    font-size: 80px;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.aamv-unsupported-icon i {
    font-size: 80px;
}

.aamv-unsupported-title {
    color: #fff;
    font-size: 24px;
    margin-bottom: 1rem;
}

.aamv-unsupported-message {
    color: #999;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.aamv-unsupported-details {
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 2rem;
    text-align: left;
}

.aamv-unsupported-detail {
    color: #ccc;
    font-size: 14px;
    margin: 0.5rem 0;
}

.aamv-unsupported-detail strong {
    color: #fff;
    margin-right: 0.5rem;
}

.aamv-unsupported-download {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--primary-dark, #0066cc);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.aamv-unsupported-download:hover {
    background: #0052a3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

/* ============================================
   SPINNER - DUAL RING SVG (For PDF & Others)
   ============================================ */
.aamv-spinner-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    z-index: 50; /* Above placeholder (5) */
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.aamv-spinner-container.active {
    opacity: 1;
    visibility: visible;
}

.aamv-spinner-svg {
    width: 100%;
    height: 100%;
    animation: aamv-spin 2s linear infinite;
}

.aamv-spinner-circle {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    animation: aamv-dash 1.5s ease-in-out infinite;
}

/* Updated to use requested dark primary color */
.aamv-spinner-circle-1 {
    stroke: var(--primary-dark, #0066cc);
    opacity: 0.9;
}

.aamv-spinner-circle-2 {
    stroke: #ffffff;
    opacity: 0.4;
    animation-direction: reverse;
}

@keyframes aamv-spin {
    100% { transform: rotate(360deg); }
}

@keyframes aamv-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* ============================================
   PROGRESS BAR - BOTTOM (For Images)
   ============================================ */
.aamv-progress-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
}

.aamv-progress-bar-container.active {
    opacity: 1;
    visibility: visible;
}

.aamv-progress-fill {
    height: 100%;
    width: 0%;
    /* Use requested dark primary color */
    background: var(--primary-dark, #0066cc);
    position: relative;
    transition: width 0.2s linear;
}

/* The Shine Effect (Pseudo-element) */
@keyframes aamv-progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.aamv-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(
        90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.5) 50%, 
        transparent 100%
    );
    transform: translateX(-100%);
    animation: aamv-progress-shine 1.5s infinite linear;
}


/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) and (min-width: 600px) {
    .aamv-viewer {
        height: 55vh;
        min-height: 280px;
    }
    .aamv-filename {
        max-width: 40%;
        font-size: 14px;
    }
    .aamv-thumb-item {
        width: 70px;
        height: 70px;
        min-width: 70px;
        min-height: 70px;
    }
}

@media (max-width: 599px) {
    .aamv-viewer-container {
        margin: 1rem 0;
        border-radius: 4px;
    }
    .aamv-header {
        height: 44px;
        padding: 0 0.5rem;
    }
    .aamv-filename {
        height: 44px;
        font-size: 13px;
        max-width: 30%;
    }
    .aamv-side {
        width: 44px;
    }
    .aamv-viewer-wrapper {
        width: calc(100% - 88px);
        margin-left: 44px;
        margin-right: 44px;
    }
    .aamv-nav {
        width: 40px;
        height: 40px;
        min-width: 44px;
        min-height: 44px;
    }
    .aamv-nav i {
        font-size: 28px;
    }
    .aamv-viewer {
        height: 50vh;
        min-height: 280px;
    }
    .aamv-thumb-item {
        width: 64px;
        height: 64px;
        min-width: 64px;
        min-height: 64px;
        border-width: 8px;
    }
    .aamv-thumb-item:hover,
    .aamv-thumb-item.active {
        border-width: 5px;
    }
    .aamv-header .aamv-icon {
        width: 40px;
        height: 40px;
        min-width: 44px;
        min-height: 44px;
    }
    .aamv-header .aamv-icon i {
        font-size: 24px;
    }
    .aamv-header-buttons {
        gap: 0.15rem;
    }
    .aamv-ribbon-thumbs {
        padding: 8px;
        gap: 6px;
    }
    .aamv-audio-wrapper {
        padding: 0.5rem;
    }
    .aamv-zoom-dropdown {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }
    .aamv-viewer-container.fullscreen .aamv-viewer {
        height: calc(100vh - 120px);
    }
}

@media (max-width: 400px) {
    .aamv-filename {
        display: none;
    }
    .aamv-counter {
        font-size: 13px;
    }
    .aamv-viewer {
        min-height: 240px;
    }
    .aamv-thumb-item {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
    }
    .aamv-pdf-btn span {
        display: none;
    }
}

@media (max-width: 896px) and (orientation: landscape) {
    .aamv-viewer {
        height: 70vh;
    }
    .aamv-viewer-container.fullscreen .aamv-viewer {
        height: calc(100vh - 90px);
    }
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .aamv-zoom-label {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .aamv-viewer-container,
    .aamv-viewer-container * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.aamv-viewer-wrapper::-webkit-scrollbar {
    width: 16px;
}
.aamv-viewer-wrapper::-webkit-scrollbar-track {
    background: #111;
}
.aamv-viewer-wrapper::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 8px;
    border: 2px solid #111;
}
.aamv-viewer-wrapper::-webkit-scrollbar-thumb:hover {
    background: #888;
}
/* ============================================
   TOOLS PANEL - MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .aamv-tools-panel {
        width: 180px;
    }
    
    .aamv-zoom-row .aamv-tool-btn {
        display: none; /* Hide zoom in/out buttons on mobile - use pinch-to-zoom */
    }
}

@media (max-width: 599px) {
    .aamv-tools-panel {
        right: 0;
        width: min(280px, calc(100vw - 40px));
        max-width: 90vw;
    }
}

@media (max-width: 400px) {
    .aamv-tools-panel {
        width: calc(100vw - 20px);
        left: 10px;
        right: 10px;
    }
}