/* Main Wrapper */
.mpv-wrapper {
    display: flex;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* External TOC Panel */
.mpv-toc-panel-external {
    width: 280px;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: 80vh;
    position: sticky;
    top: 20px;
}

.mpv-toc-panel-external .mpv-toc-container {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
}

.mpv-toc-panel-external.hidden {
    display: none;
}

.mpv-viewer-container {
    flex: 1;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.mpv-viewer-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    border-radius: 0;
    z-index: 999999;
    margin: 0;
}

.mpv-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #2d2d2d 0%, #252525 100%);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-wrap: wrap;
    gap: 12px;
}

.mpv-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    backdrop-filter: blur(10px);
}

.mpv-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

.mpv-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mpv-btn svg {
    display: block;
}

.mpv-page-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.mpv-page-input {
    width: 60px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #fff;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s ease;
}

.mpv-page-input:focus {
    outline: none;
    border-color: #4a9eff;
    background: rgba(74,158,255,0.1);
    box-shadow: 0 0 0 3px rgba(74,158,255,0.2);
}

.mpv-zoom-level {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    background: rgba(255,255,255,0.05);
    padding: 8px 12px;
    border-radius: 6px;
}

.mpv-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.15);
    margin: 0 4px;
}

.mpv-content-wrapper {
    display: flex;
    position: relative;
    height: 842px;
    background: #121212;
}

.mpv-viewer-container.fullscreen .mpv-content-wrapper {
    height: calc(100vh - 73px);
}

/* TOC Panel Styles - Internal (for thumbnails) */
.mpv-toc-panel {
    width: 0;
    background: #1a1a1a;
    border-right: 1px solid rgba(255,255,255,0.1);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.mpv-toc-panel.active {
    width: 280px;
}

.mpv-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: #1f1f1f;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mpv-toc-close-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.mpv-toc-close-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.mpv-toc-close-btn svg {
    display: block;
}

.mpv-toc-header span {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mpv-toc-container {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mpv-toc-empty {
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.mpv-toc-item {
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mpv-toc-item:hover {
    background: rgba(255,255,255,0.1);
    border-left-color: #4a9eff;
    transform: translateX(4px);
}

.mpv-toc-item.active {
    background: rgba(74,158,255,0.2);
    border-left-color: #4a9eff;
}

.mpv-toc-item-title {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.4;
}

.mpv-toc-item-page {
    color: rgba(255,255,255,0.6);
    font-size: 11px;
}

.mpv-thumbnails-panel {
    width: 0;
    background: #1a1a1a;
    border-right: 1px solid rgba(255,255,255,0.1);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.mpv-thumbnails-panel.active {
    width: 200px;
}

.mpv-thumbnails-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: #1f1f1f;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mpv-thumbnails-header span {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mpv-thumbnails-container {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mpv-thumbnail {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #252525;
    position: relative;
}

.mpv-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mpv-thumbnail:hover::before {
    opacity: 1;
}

.mpv-thumbnail:hover {
    border-color: rgba(255,255,255,0.3);
    transform: translateX(4px);
}

.mpv-thumbnail.active {
    border-color: #4a9eff;
    box-shadow: 0 0 0 3px rgba(74,158,255,0.3);
}

.mpv-thumbnail canvas {
    display: block;
    width: 100%;
    height: auto;
}

.mpv-thumbnail-number {
    text-align: center;
    padding: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    background: #1f1f1f;
    font-weight: 600;
}

.mpv-canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #121212;
    position: relative;
    padding: 20px;
}

.mpv-canvas-wrapper.zoom-active {
    overflow: auto;
}

.mpv-canvas {
    display: block;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    background: white;
}

.mpv-loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    z-index: 100;
}

.mpv-loading-indicator.hidden {
    display: none;
}

.mpv-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: mpv-spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes mpv-spin {
    to { transform: rotate(360deg); }
}

.mpv-loading-indicator p {
    margin: 0;
    font-size: 15px;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}

@media (max-width: 1024px) {
    .mpv-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    .mpv-toc-panel-external {
        width: 100%;
        max-height: 300px;
        position: relative;
        top: auto;
        order: -1; /* TOC'u üstte göster */
    }
    
    .mpv-toc-panel-external .mpv-toc-container {
        max-height: 200px; /* Mobilde daha kompakt */
    }
    
    .mpv-toc-panel.active {
        width: 240px;
    }
    
    .mpv-thumbnails-panel.active {
        width: 160px;
    }
}

@media (max-width: 768px) {
    .mpv-toolbar {
        padding: 12px 15px;
        gap: 8px;
    }
    
    .mpv-btn {
        padding: 8px 10px;
        min-width: 36px;
        height: 36px;
    }
    
    .mpv-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .mpv-page-input {
        width: 50px;
        padding: 6px 8px;
        font-size: 13px;
    }
    
    .mpv-zoom-level,
    .mpv-page-info {
        font-size: 13px;
    }
    
    .mpv-toc-panel.active {
        width: 200px;
    }
    
    .mpv-thumbnails-panel.active {
        width: 140px;
    }
    
    .mpv-content-wrapper {
        height: 600px;
    }
    
    .mpv-canvas-wrapper {
        padding: 15px;
    }
    
    .mpv-toc-panel-external {
        max-height: 250px;
    }
    
    .mpv-toc-panel-external .mpv-toc-container {
        max-height: 150px; /* Küçük ekranlarda daha kompakt */
    }
}

@media (max-width: 480px) {
    .mpv-toolbar {
        padding: 10px;
        gap: 6px;
    }
    
    .mpv-divider {
        display: none;
    }
    
    .mpv-zoom-level {
        font-size: 12px;
        min-width: 45px;
        padding: 6px 8px;
    }
    
    .mpv-toc-panel.active {
        position: absolute;
        z-index: 20;
        height: 100%;
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
        width: 200px;
    }
    
    .mpv-thumbnails-panel.active {
        position: absolute;
        z-index: 20;
        height: 100%;
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
        width: 140px;
    }
    
    .mpv-content-wrapper {
        height: 500px;
    }
    
    .mpv-canvas-wrapper {
        padding: 10px;
    }
    
    .mpv-toc-panel-external {
        max-height: 200px;
    }
    
    .mpv-toc-panel-external .mpv-toc-container {
        max-height: 120px; /* Çok küçük ekranlarda minimum yükseklik */
    }
}

.mpv-toc-panel::-webkit-scrollbar,
.mpv-toc-panel-external::-webkit-scrollbar,
.mpv-toc-panel-external .mpv-toc-container::-webkit-scrollbar,
.mpv-thumbnails-panel::-webkit-scrollbar {
    width: 8px;
}

.mpv-toc-panel::-webkit-scrollbar-track,
.mpv-toc-panel-external::-webkit-scrollbar-track,
.mpv-toc-panel-external .mpv-toc-container::-webkit-scrollbar-track,
.mpv-thumbnails-panel::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.mpv-toc-panel::-webkit-scrollbar-thumb,
.mpv-toc-panel-external::-webkit-scrollbar-thumb,
.mpv-toc-panel-external .mpv-toc-container::-webkit-scrollbar-thumb,
.mpv-thumbnails-panel::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.mpv-toc-panel::-webkit-scrollbar-thumb:hover,
.mpv-toc-panel-external::-webkit-scrollbar-thumb:hover,
.mpv-toc-panel-external .mpv-toc-container::-webkit-scrollbar-thumb:hover,
.mpv-thumbnails-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

.mpv-canvas-wrapper::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.mpv-canvas-wrapper::-webkit-scrollbar-track {
    background: #121212;
}

.mpv-canvas-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
}

.mpv-canvas-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}