/**
 * ND Document Converter - Player Styles
 */

:root {
    --nd-player-bg: #0a0a0a;
    --nd-player-ui: rgba(255,255,255,0.9);
    --nd-player-ui-hover: #fff;
    --nd-player-accent: #f97316;
    --nd-player-radius: 8px;
}

/* Player Container */
.nd-slideshow {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: var(--nd-player-bg);
    border-radius: var(--nd-player-radius);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.nd-slideshow.fullscreen {
    position: fixed;
    inset: 0;
    max-width: none;
    border-radius: 0;
    z-index: 999999;
}

/* Slides Container */
.nd-slides-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
}

.nd-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nd-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.nd-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* Loading state */
.nd-slide-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.8);
}

.nd-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--nd-player-accent);
    border-radius: 50%;
    animation: nd-spin 1s linear infinite;
}

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

/* Controls */
.nd-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.3s;
}

.nd-slideshow:hover .nd-controls,
.nd-slideshow.show-controls .nd-controls {
    opacity: 1;
}

.nd-btn {
    background: none;
    border: none;
    color: var(--nd-player-ui);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nd-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--nd-player-ui-hover);
}

.nd-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nd-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Progress bar */
.nd-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nd-progress {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
}

.nd-progress-bar {
    height: 100%;
    background: var(--nd-player-accent);
    border-radius: 2px;
    transition: width 0.2s;
}

.nd-progress-dots {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 6px;
}

.nd-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.nd-progress-dot:hover {
    background: rgba(255,255,255,0.6);
    transform: scale(1.2);
}

.nd-progress-dot.active {
    background: var(--nd-player-accent);
}

.nd-progress-dot.viewed {
    background: rgba(255,255,255,0.5);
}

.nd-slide-count {
    color: var(--nd-player-ui);
    font-size: 13px;
    min-width: 60px;
    text-align: center;
}

/* Navigation arrows (overlay) */
.nd-nav-overlay {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.nd-slideshow:hover .nd-nav-overlay {
    opacity: 1;
}

.nd-nav-prev { left: 15px; }
.nd-nav-next { right: 15px; }

.nd-nav-btn {
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.5);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.nd-nav-btn:hover {
    background: rgba(0,0,0,0.8);
    transform: scale(1.1);
}

.nd-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.nd-nav-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Sync indicator */
.nd-sync-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nd-sync-indicator.synced {
    background: rgba(34, 197, 94, 0.8);
}

.nd-sync-indicator.controlled {
    background: rgba(239, 68, 68, 0.8);
}

.nd-sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: nd-pulse 1.5s infinite;
}

@keyframes nd-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Interactive elements */
.nd-interactive-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.nd-hotspot {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    background: rgba(249, 115, 22, 0.3);
    border: 2px solid var(--nd-player-accent);
    border-radius: 4px;
    transition: background 0.2s;
}

.nd-hotspot:hover {
    background: rgba(249, 115, 22, 0.5);
}

.nd-hotspot-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    margin-bottom: 8px;
}

.nd-hotspot:hover .nd-hotspot-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Quiz overlay */
.nd-quiz-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: auto;
}

.nd-quiz-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.nd-quiz-question {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 25px;
}

.nd-quiz-answers {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nd-quiz-answer {
    padding: 15px 20px;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: left;
}

.nd-quiz-answer:hover {
    border-color: var(--nd-player-accent);
}

.nd-quiz-answer.selected {
    border-color: var(--nd-player-accent);
    background: #fff7ed;
}

.nd-quiz-answer.correct {
    border-color: #22c55e;
    background: #dcfce7;
}

.nd-quiz-answer.incorrect {
    border-color: #ef4444;
    background: #fee2e2;
}

.nd-quiz-submit {
    margin-top: 20px;
    padding: 12px 30px;
    background: var(--nd-player-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.nd-quiz-submit:hover {
    background: #ea580c;
}

.nd-quiz-submit:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.nd-quiz-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    font-size: 15px;
}

.nd-quiz-result.correct {
    background: #dcfce7;
    color: #166534;
}

.nd-quiz-result.incorrect {
    background: #fee2e2;
    color: #991b1b;
}

.nd-quiz-continue {
    margin-top: 15px;
    padding: 10px 25px;
    background: #374151;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Thumbnails strip */
.nd-thumbnails {
    display: flex;
    gap: 8px;
    padding: 10px 15px;
    background: rgba(0,0,0,0.9);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.nd-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.nd-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.nd-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.nd-thumb {
    flex-shrink: 0;
    width: 80px;
    aspect-ratio: 16/9;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    opacity: 0.6;
}

.nd-thumb:hover {
    opacity: 0.9;
}

.nd-thumb.active {
    border-color: var(--nd-player-accent);
    opacity: 1;
}

.nd-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Error state */
.nd-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: #fee2e2;
    color: #991b1b;
    text-align: center;
    padding: 30px;
    border-radius: var(--nd-player-radius);
}

/* Responsive */
@media (max-width: 768px) {
    .nd-controls {
        padding: 10px 15px;
    }
    
    .nd-nav-overlay {
        display: none;
    }
    
    .nd-thumbnails {
        display: none;
    }
    
    .nd-slide-count {
        font-size: 12px;
    }
    
    .nd-quiz-content {
        padding: 20px;
    }
    
    .nd-quiz-question {
        font-size: 16px;
    }
}

/* Touch friendly */
@media (pointer: coarse) {
    .nd-controls {
        opacity: 1;
    }
    
    .nd-btn {
        padding: 12px;
    }
    
    .nd-nav-btn {
        width: 56px;
        height: 56px;
    }
}

/* Embed mode */
.nd-slideshow.embed {
    border-radius: 0;
}

.nd-slideshow.embed .nd-controls {
    opacity: 1;
    background: rgba(0,0,0,0.9);
}

/* Print */
@media print {
    .nd-slideshow {
        break-inside: avoid;
    }
    
    .nd-controls,
    .nd-nav-overlay,
    .nd-sync-indicator {
        display: none !important;
    }
}
