/* ======== PDF System - Технічний редизайн з авіаційно-кібернетичною тематикою (v5.0) ======== */
/* Додано: Схемотехнічні елементи, градієнти, анімації, адаптивність */

/* ======== Статуси системи (для налагодження) ======== */
/* ======== Налагоджувальний режим ======== */
[data-pdf-system="enhanced"] {
    border: 1px solid transparent;
}

/* ======== Блок превʼю PDF ======== */
.pdf-preview-block {
    position: relative;
}

/* ======== Статус: thumbnail / fallback ======== */
.pdf-preview-block[data-preview-status="thumbnail"]::after,
.pdf-preview-block[data-preview-status="fallback"]::after {
    content: "🖼️"; /* або 🔄 */
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    right: 6px;
    width: 20px;
    height: 20px;
    color: #000;
    font-weight: bold;
    border-radius: 4px;
    z-index: 30;
    pointer-events: none;
    font-size: 14px;
    line-height: 1;
}

/* Індивідуальні стилі контенту та фону */
.pdf-preview-block[data-preview-status="thumbnail"]::after {
    content: "🖼️";
    background: rgba(0, 255, 150, 0.9);
    padding: 1px 2px 1px 2px;
}

.pdf-preview-block[data-preview-status="fallback"]::after {
    content: "🔄";
    background: rgba(255, 165, 0, 0.9);
    padding: 1px 2px 1px 2px;
}

/* Сховати в продакшені */
.production .pdf-preview-block[data-preview-status]::after {
    display: none !important;
}

.pdf-loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #00f5ff;
    background: rgba(20, 20, 40, 0.75);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    padding: 8px 16px;
    z-index: 1000;
    box-shadow:
            0 0 4px rgba(0, 255, 255, 0.6),
            0 0 8px rgba(0, 255, 255, 0.4) inset;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    backdrop-filter: blur(6px);
}

.pdf-loading-indicator i {
    font-size: 18px;
    animation: pulse-glow 1.2s infinite ease-in-out;
    color: #00e6e6;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}


.preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    border-radius: 14px;
    background: rgba(60, 0, 0, 0.65);
    color: #ffcccc;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    border: 1px solid rgba(255, 0, 0, 0.2);
    box-shadow:
            0 0 6px rgba(255, 60, 60, 0.3),
            inset 0 0 10px rgba(255, 0, 0, 0.2);
    padding: 18px;
    text-align: center;
    backdrop-filter: blur(4px);
}

.preview-error i {
    font-size: 28px;
    margin-bottom: 8px;
    color: #ff4d4d;
    animation: flicker 1.5s infinite alternate;
}

@keyframes flicker {
    0% { opacity: 1; }
    25% { opacity: 0.7; }
    50% { opacity: 0.3; }
    100% { opacity: 0.8; }
}




/* ======== Базові стилі системи ======== */
.pdf-thumbnail-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    box-shadow:
            0 8px 32px rgba(0, 100, 200, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 200, 255, 0.3);
}

.pdf-thumbnail-img {
    width: 100%;
    height: auto;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 12px;
    display: block;
    filter: brightness(1.1) contrast(1.05);
}

.pdf-thumbnail-img:hover {
    transform: scale(1.03) rotateY(2deg);
    filter: brightness(1.2) contrast(1.1);
}

.pdf-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border: 2px dashed rgba(0, 200, 255, 0.5);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.4s ease;
    min-height: 160px;
    color: #ecf0f1;
    position: relative;
}

.pdf-placeholder::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #00ff96 0%, #00cc77 100%);
    border-radius: 50%;
    animation: pulse-tech 2s ease-in-out infinite;
}

@keyframes pulse-tech {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.pdf-placeholder:hover {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    border-color: #00ff96;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 255, 150, 0.2);
}

.pdf-placeholder-icon {
    font-size: 48px;
    margin-bottom: 8px;
    opacity: 0.8;
    color: #00d4ff;
}

.pdf-placeholder-text {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    font-family: 'Courier New', monospace;
}

.pdf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    padding: 20px;
    min-height: 160px;
    position: relative;
}

.pdf-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: linear-gradient(45deg, transparent, rgba(0, 200, 255, 0.1), transparent);
    animation: scan-line 2s linear infinite;
}

@keyframes scan-line {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.pdf-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 200, 255, 0.2);
    border-top: 3px solid #00d4ff;
    border-right: 3px solid #00ff96;
    border-radius: 50%;
    animation: pdf-spin-tech 1s linear infinite;
    z-index: 1;
}

@keyframes pdf-spin-tech {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ======== Сітка та блоки прев'ю PDF ======== */
.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin: 24px 0;
    justify-items: center;
    align-items: start;
    padding: 0 12px;
}

/* === Блок превʼю одного PDF === */
.pdf-preview-block {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    padding: 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2a2a45 0%, #26314e 50%, #1c4278 100%);
    border: 1px solid rgba(0, 200, 255, 0.2);
    box-shadow:
            0 6px 20px rgba(0, 0, 0, 0.15),
            0 1px 4px rgba(0, 200, 255, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.08);

    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 100%;
    max-width: 360px;
    height: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

/* Технічні декоративні элементи */
.pdf-preview-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg,
    transparent,
    #00ff96 20%,
    #00d4ff 50%,
    #0099ff 80%,
    transparent
    );
    animation: circuit-flow 3s ease-in-out infinite;
}



@keyframes circuit-flow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.pdf-preview-block:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
            0 20px 60px rgba(0, 0, 0, 0.4),
            0 8px 25px rgba(0, 200, 255, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(0, 255, 150, 0.6);
}

.pdf-preview-block:hover::before {
    animation-duration: 1s;
}

/* === Заголовок === */
.pdf-preview-block h3 {
    font-size: 15px;
    font-weight: 600;
    color: #ecf0f1;
    padding: 12px 8px;
    margin: 0 0 18px 0;
    height: 100px;
    overflow: hidden;
    border-bottom: 2px dashed rgba(0, 200, 255, 0.3);
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    position: relative;
}

.pdf-preview-block h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #00ff96, #00d4ff);
    border-radius: 1px;
}

/* === Превʼю як <canvas> або <img> === */

.pdf-canvas-preview,
.pdf-preview-block img[class*="pdf-canvas"] {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto !important; /* ключовий момент */
    aspect-ratio: unset; /* або видалити повністю */
    object-fit: contain;
    object-position: center;
    background: linear-gradient(135deg, #2c3e50 0%, #275786 100%);
    border: 2px solid rgba(0, 200, 255, 0.4);
    border-radius: 12px;
    box-shadow:
            0 8px 24px rgba(0, 0, 0, 0.3),
            0 2px 8px rgba(0, 200, 255, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    margin-bottom: 18px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}



.pdf-canvas-preview::before,
.pdf-preview-block img[class*="pdf-canvas"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
    transparent,
    rgba(0, 212, 255, 0.1) 50%,
    transparent
    );
    transition: left 0.6s ease;
    pointer-events: none;
}

.pdf-canvas-preview:hover::before,
.pdf-preview-block img[class*="pdf-canvas"]:hover::before {
    left: 100%;
}

.pdf-canvas-preview:hover,
.pdf-preview-block img[class*="pdf-canvas"]:hover {
    transform: scale(1.05) rotateX(5deg);
    border-color: rgba(0, 255, 150, 0.8);
    box-shadow:
            0 12px 35px rgba(0, 0, 0, 0.4),
            0 4px 15px rgba(0, 255, 150, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
}


/* ======== Кнопки та навігація ======== */
.nav-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.nav-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
    );
    transition: left 0.4s ease;
}

.nav-button:hover::before {
    left: 100%;
}

.nav-button i {
    margin-right: 5px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.nav-button:focus {
    outline: 2px solid #00ff96;
    outline-offset: 2px;
}

.nav-button:hover {
    transform: scale(1.05) translateY(-2px);
}

.pdf-preview-block .preview-buttons-container {
    display: flex;
    justify-content: center;
    gap: clamp(8px, 2.5vw, 12px);
    margin-top: auto;
    padding-top: 18px;
    flex-wrap: nowrap;
    align-items: center;
}

/* Адаптивні кнопки */
.pdf-preview-block .nav-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    font-size: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: clamp(40px, 12vw, 50px);
    height: clamp(40px, 12vw, 50px);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.pdf-preview-block .nav-button i {
    font-size: clamp(16px, 4vw, 20px);
    line-height: 1;
    margin: 0;
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
    z-index: 1;
}

.pdf-preview-block .nav-button:hover {
    transform: scale(1.1) translateY(-3px);
}

/* Специфічні стилі кнопок з технічними градієнтами */
.pdf-preview-block .open-modal {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.pdf-preview-block .open-modal:hover {
    background: linear-gradient(135deg, #f7931e 0%, #ff6b35 100%);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.pdf-preview-block .copy-link-button {
    background: linear-gradient(135deg, #00d4aa 0%, #00a085 100%);
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.3);
}

.pdf-preview-block .copy-link-button:hover {
    background: linear-gradient(135deg, #00a085 0%, #00d4aa 100%);
    box-shadow: 0 6px 20px rgba(0, 212, 170, 0.4);
}

.pdf-preview-block .download-button {
    background: linear-gradient(135deg, #0099ff 0%, #0066cc 100%);
    box-shadow: 0 4px 15px rgba(0, 153, 255, 0.3);
}

.pdf-preview-block .download-button:hover {
    background: linear-gradient(135deg, #0066cc 0%, #0099ff 100%);
    box-shadow: 0 6px 20px rgba(0, 153, 255, 0.4);
}

.pdf-preview-block .open-tab-button {
    background: linear-gradient(135deg, #00c4ff 0%, #0099cc 100%);
    box-shadow: 0 4px 15px rgba(0, 196, 255, 0.3);
}

.pdf-preview-block .open-tab-button:hover {
    background: linear-gradient(135deg, #0099cc 0%, #00c4ff 100%);
    box-shadow: 0 6px 20px rgba(0, 196, 255, 0.4);
}

.pdf-preview-block .regen-thumb-button {
    background: linear-gradient(135deg, #ff9500 0%, #cc7700 100%);
    box-shadow: 0 4px 15px rgba(255, 149, 0, 0.3);
}

.pdf-preview-block .regen-thumb-button:hover {
    background: linear-gradient(135deg, #cc7700 0%, #ff9500 100%);
    box-shadow: 0 6px 20px rgba(255, 149, 0, 0.4);
}


/* ======== Анімації завантаження та статусів ======== */
@keyframes data-stream {
    0% { opacity: 0; transform: translateX(-20px); }
    50% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(20px); }
}

.pdf-preview-block[data-preview-status="loading"] {
    animation: data-stream 2s ease-in-out infinite;
}

/* ======== Додаткові технічні ефекти ======== */
.pdf-preview-block:nth-child(odd)::before {
    background: linear-gradient(90deg,
    transparent,
    #00ff96 20%,
    #0099ff 50%,
    #00d4ff 80%,
    transparent
    );
}

.pdf-preview-block:nth-child(even)::before {
    background: linear-gradient(90deg,
    transparent,
    #ff6b35 20%,
    #f7931e 50%,
    #00d4aa 80%,
    transparent
    );
}

/* Глітч-ефект при завантаженні */
@keyframes glitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-1px, 1px); }
    40% { transform: translate(-1px, -1px); }
    60% { transform: translate(1px, 1px); }
    80% { transform: translate(1px, -1px); }
}

.pdf-preview-block[data-preview-status="fallback"] {
    animation: glitch 0.3s ease-in-out;
}

/* ======== МОДАЛЬНЕ ВІКНО - ОПТИМІЗОВАНЕ ======== */
.modal.hidden {
    display: none;
}

.modal {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    overflow: hidden;
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #1a1a1a;
    border-radius: 12px;
    width: 90vw;
    height: 90vh;
    max-width: 1400px;
    max-height: 950px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.7);
    border: 1px solid #333;
}

/* ======== КНОПКА ЗАКРИТТЯ ======== */
.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 16px;
    z-index: 1003;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.close-button i {
    font-size: 1.6rem;
}

.close-button:hover {
    background: #ff4444;
    transform: rotate(90deg);
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.6);
}

/* ======== PDF CONTAINER ======== */
#pdf-container-modal {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 160px;
    scroll-padding-bottom: 160px;
    background: #1c2530;
    scrollbar-width: thin;
    scrollbar-color: #00eaff #1c2530;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 35px;
}

#pdf-container-modal::-webkit-scrollbar {
    width: 10px;
}

#pdf-container-modal::-webkit-scrollbar-track {
    background: #2b3b4a;
    border-radius: 6px;
    margin-bottom: 140px; /* Щоб скролбар не йшов до низу */
    box-shadow: inset 0 0 5px rgba(0, 255, 255, 0.1);
}

#pdf-container-modal::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00fff7, #00a0ff);
    border-radius: 6px;
    box-shadow: 0 0 8px #00eaff;
}

#pdf-container-modal::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00ffff, #0077ff);
    box-shadow: 0 0 12px #00eaff;
}


/* ======== ПОКРАЩЕНЕ ВІДОБРАЖЕННЯ СТОРІНОК ======== */
.page-wrapper {
    display: block;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 35px auto;
    position: relative;
    box-sizing: border-box;
}

.pdf-canvas {
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease;
    background: white;
    border: 1px solid #ddd;
    max-width: none !important;
    height: auto;
}

.pdf-canvas[data-orientation="portrait"],
.pdf-canvas[data-orientation="landscape"] {
    max-width: 100%;
    width: auto;
    height: auto;
}

/* ======== СКЕЛЕТОНИ ДЛЯ СТОРІНОК ======== */
.skeleton-wrapper {
    display: block;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 15px auto;
    position: relative;
}

.page-skeleton {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid #ddd;
    padding: 40px;
    min-height: 600px;
    position: relative;
    overflow: hidden;
}

.page-skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%);
    animation: skeleton-shimmer 2s infinite;
}

@keyframes skeleton-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.skeleton-header {
    height: 60px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    border-radius: 8px;
    margin-bottom: 30px;
    animation: skeleton-wave 2s infinite ease-in-out;
}

.skeleton-lines {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.skeleton-line {
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-wave 2s infinite ease-in-out;
}

.skeleton-line.short {
    width: 70%;
}

.skeleton-line.medium {
    width: 85%;
}

.skeleton-page-number {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

@keyframes skeleton-wave {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-lines.mobile .skeleton-line {
    height: 10px;
    margin-bottom: 6px;
}

.skeleton-lines.desktop .skeleton-line {
    height: 14px;
    margin-bottom: 8px;
}


/* ======== НАВІГАЦІЙНА ПАНЕЛЬ PDF ======== */
/* Основний стиль панелі */
.navigation-panel {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1002;
    background: #0a0e17;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    border-top: 1px solid #2a3a5a;
    font-family: 'Courier New', 'Consolas', monospace;
    box-shadow: 0 -4px 20px rgba(0, 20, 80, 0.6), inset 0 0 0 1px rgba(80, 180, 255, 0.1);
}


/* Текстурна плата */
.circuit-board {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(0, 231, 255, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(0, 231, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: -1;
}

/* Стилі для прогрес-бару */
.progress-embed-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: transparent;
    z-index: 1;
    pointer-events: none;
}

.progress-bar {
    width: 100%;
    height: 100%;
    background: transparent;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00c6ff, #00ff95);
    box-shadow: 0 0 8px rgba(0, 255, 170, 0.5);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: #00e7ff;
    text-align: center;
    text-shadow: 0 0 3px rgba(0, 231, 255, 0.7);
}

/* Секції панелі */
.nav-section {
    display: flex;
    align-items: center;
    margin-top: 16px;
    gap: 8px;
    flex: 1;
}

.zoom-section {
    justify-content: flex-start;
}

.page-section {
    justify-content: center;
}

.actions-section {
    justify-content: flex-end;
}

/* Кнопки у стилі мікроелектроніки */
.nav-btn {
    background: rgba(20, 40, 80, 0.4);
    border: 1px solid #2a5a9c;
    border-radius: 6px;
    color: #80d0ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 1px 3px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(30, 70, 140, 0.5);
    border-color: #3a8aff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 10px rgba(58, 138, 255, 0.4);
    transform: translateY(-1px);
}

.nav-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.nav-btn i {
    text-shadow: 0 0 5px rgba(128, 208, 255, 0.7);
}

.page-nav-btn i {
    line-height: 1;
    font-size: 14px;
    margin: 0 auto;
}

.page-nav-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
    cursor: default;
    filter: grayscale(100%);
}


/* Розміри кнопок */
.zoom-btn, .page-nav-btn {
    width: 38px;
    height: 38px;
    font-size: 14px;
    flex-shrink: 0;
}

.reset-btn,
.refresh-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-btn i {
    transition: transform 0.4s ease;
}

#refresh-modal:hover i {
    transform: rotate(360deg) !important;
}

.render-mode-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin-left: 12px;
    background: rgba(0, 10, 20, 0.7);
    border: 1px solid #00ffaa88;
    border-radius: 6px;
    color: #00ffaa;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 0 5px rgba(0, 255, 170, 0.5);
    box-shadow: inset 0 0 5px rgba(0, 255, 170, 0.2);
}

.pulse-indicator {
    width: 10px;
    height: 10px;
    background: #00ffaa;
    border-radius: 50%;
    box-shadow: 0 0 6px #00ffaa;
    animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.5);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.6;
    }
}

.auto-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 9px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 4px rgba(0, 255, 170, 0.2);
    font-weight: 700;
    letter-spacing: 0.5px;
    height: 100%;
}

.auto-badge.hidden {
    display: none;
}


/* Індикатор зума */
.zoom-display {
    background: rgba(10, 25, 50, 0.6);
    color: #00ffaa;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
    border: 1px solid #2a7a6d;
    box-shadow: inset 0 0 8px rgba(0, 200, 150, 0.2);
}

/* Стилі для лічильника сторінок */
.page-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 200px;
}

.digital-display {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 14px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    border: 1px solid rgba(0, 231, 255, 0.3);
    box-shadow: inset 0 0 5px rgba(0, 231, 255, 0.2),
    0 0 5px rgba(0, 231, 255, 0.1);
}

.current-page-num {
    font-size: 20px;
    font-weight: bold;
    color: #00ff9d;
    text-shadow: 0 0 5px rgba(0, 255, 157, 0.5);
}

.page-divider {
    font-size: 16px;
    color: #00e7ff;
    font-weight: 500;
}

.total-pages-num {
    font-size: 16px;
    font-weight: bold;
    color: #00e7ff;
}

/* Поле введення */
.page-controls {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
}

.input-wrapper {
    position: relative;
}

.page-input-field {
    background: rgba(0, 10, 20, 0.8);
    border: 1px solid rgba(0, 231, 255, 0.3);
    border-radius: 8px;
    color: #00ff9d;
    padding: 8px 12px 8px 32px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    width: 140px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 5px rgba(0, 231, 255, 0.2);
}

.page-input-field:focus {
    outline: none;
    border-color: #00ff9d;
    background: rgba(0, 20, 30, 0.9);
    box-shadow: inset 0 0 10px rgba(0, 255, 157, 0.3),
    0 0 10px rgba(0, 255, 157, 0.2);
}


.page-input-field::placeholder {
    color: #00e7ff;
    font-size: 13px;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 4px rgba(0, 231, 255, 0.5);
}

.input-indicators {
    position: absolute;
    left: 12px;
    top: 14px;
    width: 8px;
    height: 8px;
    pointer-events: none;
}

.input-led {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff003c;
    box-shadow: 0 0 5px #ff003c;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Анімація для кнопок */
.nav-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(30deg);
    transition: all 0.6s ease;
    pointer-events: none;
}

.nav-btn:hover::after {
    top: 120%;
    left: 120%;
}

/* ======== SAC KAI TECHNOLOGY - ЕЛЕКТРОННИЙ ДИСПЛЕЙ ======== */
.modal-tech-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 20px;
    padding: 12px 18px;
    background:
            radial-gradient(circle at center, #001122 0%, #000811 100%),
            linear-gradient(145deg, rgba(0, 40, 20, 0.3), rgba(0, 20, 40, 0.3));
    border: 2px solid #003366;
    border-radius: 6px;
    box-shadow:
            0 0 15px rgba(0, 255, 100, 0.3),
            inset 0 0 20px rgba(0, 0, 0, 0.8),
            inset 0 1px 0 rgba(0, 255, 150, 0.1),
            inset 0 -1px 0 rgba(0, 100, 50, 0.2);
    transition: all 0.3s ease;
    overflow: hidden;
    font-family: 'Courier New', 'Lucida Console', monospace;
}

/* Сканлінії як на ЕПТ */
.modal-tech-brand::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
            90deg,
            transparent 0px,
            rgba(0, 255, 100, 0.03) 1px,
            transparent 2px,
            transparent 4px
    );
    pointer-events: none;
    z-index: 1;
}

/* Основний контейнер для тексту */
.modal-brand-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    z-index: 2;
    position: relative;
    padding: 4px 8px;
    background: rgba(0, 30, 10, 0.6);
    border: 1px solid rgba(0, 255, 100, 0.2);
    border-radius: 3px;
    box-shadow: inset 0 0 10px rgba(0, 255, 100, 0.1);
}

/* Основний текст - як на дисплеї приладу */
.modal-brand-primary {
    font-family: 'Courier New', 'Lucida Console', 'Consolas', monospace;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #00ff66;
    text-transform: uppercase;
    text-shadow:
            0 0 5px #00ff66,
            0 0 10px #00cc55,
            0 0 15px #009944,
            0 0 20px #006633;
    animation: modal-display-flicker 4s ease-in-out infinite;
    position: relative;
}

/* Вторинний текст */
.modal-brand-secondary {
    font-family: 'Courier New', 'Lucida Console', 'Consolas', monospace;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 2px;
    color: #66ff99;
    text-transform: uppercase;
    margin-top: 2px;
    opacity: 0.8;
    text-shadow:
            0 0 3px #66ff99,
            0 0 6px #44cc77;
}

/* Схемотехнічні елементи */
.modal-brand-circuit {
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background:
        /* Вертикальні лінії сітки */
            linear-gradient(90deg, transparent 0%, rgba(0, 255, 100, 0.1) 50%, transparent 100%),
                /* Горизонтальні лінії сітки */
            linear-gradient(0deg, transparent 0%, rgba(0, 255, 100, 0.05) 50%, transparent 100%),
                /* Точки як на схемі */
            radial-gradient(circle at 25% 25%, rgba(0, 255, 100, 0.2) 1px, transparent 1px),
            radial-gradient(circle at 75% 75%, rgba(0, 255, 100, 0.2) 1px, transparent 1px);
    background-size: 8px 100%, 100% 6px, 16px 16px, 16px 16px;
    pointer-events: none;
    z-index: 0;
    animation: modal-circuit-scan 3s linear infinite;
}

/* Індикаторні світлодіоди */
.modal-tech-brand::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: #00ff66;
    border-radius: 50%;
    box-shadow:
            0 0 4px #00ff66,
            0 0 8px #00cc55,
            inset 0 0 2px rgba(255, 255, 255, 0.3);
    animation: modal-led-blink 2s ease-in-out infinite;
}

/* Анімації */
@keyframes modal-display-flicker {
    0%, 98% {
        opacity: 1;
        text-shadow:
                0 0 5px #00ff66,
                0 0 10px #00cc55,
                0 0 15px #009944,
                0 0 20px #006633;
    }
    99% {
        opacity: 0.95;
        text-shadow:
                0 0 3px #00ff66,
                0 0 6px #00cc55;
    }
    100% {
        opacity: 1;
        text-shadow:
                0 0 5px #00ff66,
                0 0 10px #00cc55,
                0 0 15px #009944,
                0 0 20px #006633;
    }
}

@keyframes modal-circuit-scan {
    0% {
        background-position: 0px 0px, 0px 0px, 0px 0px, 8px 8px;
    }
    100% {
        background-position: 8px 0px, 0px 6px, 16px 16px, 24px 24px;
    }
}

@keyframes modal-led-blink {
    0%, 50% {
        opacity: 1;
        box-shadow:
                0 0 4px #00ff66,
                0 0 8px #00cc55,
                inset 0 0 2px rgba(255, 255, 255, 0.3);
    }
    75% {
        opacity: 0.3;
        box-shadow:
                0 0 2px #00ff66,
                0 0 4px #00cc55;
    }
    100% {
        opacity: 1;
        box-shadow:
                0 0 4px #00ff66,
                0 0 8px #00cc55,
                inset 0 0 2px rgba(255, 255, 255, 0.3);
    }
}

/* Hover ефект - як включення приладу */
.modal-tech-brand:hover {
    border-color: #00ff66;
    box-shadow:
            0 0 20px rgba(0, 255, 100, 0.5),
            inset 0 0 25px rgba(0, 0, 0, 0.9),
            inset 0 1px 0 rgba(0, 255, 150, 0.2),
            inset 0 -1px 0 rgba(0, 150, 75, 0.3);
    transform: translateY(-1px);
}

.modal-tech-brand:hover .modal-brand-primary {
    color: #66ff99;
    text-shadow:
            0 0 8px #66ff99,
            0 0 15px #44cc77,
            0 0 20px #22aa55,
            0 0 25px #008833;
    animation: modal-display-boost 0.5s ease-in-out;
}

.modal-tech-brand:hover .modal-brand-secondary {
    color: #99ffcc;
    opacity: 1;
    text-shadow:
            0 0 5px #99ffcc,
            0 0 8px #77cc99;
}

@keyframes modal-display-boost {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Режим помилки/діагностики */
.modal-tech-brand:active {
    border-color: #ff6600;
    box-shadow:
            0 0 15px rgba(255, 100, 0, 0.4),
            inset 0 0 20px rgba(0, 0, 0, 0.9);
}

.modal-tech-brand:active .modal-brand-primary {
    color: #ffaa00;
    text-shadow:
            0 0 5px #ffaa00,
            0 0 10px #cc8800;
}

/* Респонсивність */
@media (max-width: 768px) {
    .modal-tech-brand {
        margin-right: 12px;
        padding: 8px 12px;
    }

    .modal-brand-primary {
        font-size: 13px;
        letter-spacing: 2px;
    }

    .modal-brand-secondary {
        font-size: 8px;
        letter-spacing: 1px;
    }

    .modal-tech-brand::after {
        width: 4px;
        height: 4px;
        top: 3px;
        right: 3px;
    }
}

/* ======== MODAL LOADING ======== */
.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #333;
    gap: 20px;
}

.modal-loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #007bff;
    border-radius: 50%;
    animation: modal-spin 1s linear infinite;
}

@keyframes modal-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.modal-loading-text {
    font-size: 18px;
    font-weight: 500;
}

.modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #dc3545;
    text-align: center;
    gap: 15px;
}

.modal-error i {
    font-size: 48px;
}

.modal-error h3 {
    margin: 0;
    font-size: 24px;
}

.modal-error p {
    margin: 0;
    font-size: 16px;
    opacity: 0.8;
}

/* ======== НОТИФІКАЦІЇ ======== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 1;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.success-notification {
    background-color: #28a745;
}

.error-notification {
    background-color: #dc3545;
}

.notification i {
    font-size: 16px;
}





/* ========= МОБІЛЬНА АДАПТАЦІЯ (768px та менше) ========= */
@media (max-width: 768px) {
    .pdf-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 8px;
    }

    .pdf-preview-block {
        padding: 16px;
        max-width: 100%;
    }

    .pdf-preview-block h3 {
        font-size: 14px;
        height: 90px;
        -webkit-line-clamp: 5;
    }

    .pdf-preview-block .preview-buttons-container {
        gap: clamp(6px, 2vw, 10px);
    }

    .pdf-preview-block .nav-button {
        width: clamp(35px, 10vw, 45px);
        height: clamp(35px, 10vw, 45px);
    }

    .pdf-preview-block .nav-button i {
        font-size: clamp(14px, 3.5vw, 18px);
    }

    .pdf-canvas-preview,
    .pdf-preview-block img[class*="pdf-canvas"] {
        height: auto;
        max-height: 80vh;

    }

    .modal-content {
        width: 95vw;
        height: 95vh;
    }

    #pdf-container-modal {
        padding: 15px 10px 130px 10px;
        gap: 25px;
    }

    .navigation-panel {
        flex-direction: column;
        padding: 10px 12px;
        min-height: auto;
        gap: 10px;
    }

    .nav-section {
        margin-top: 0;
        width: 100%;
        justify-content: center !important;
    }

    .page-section {
        order: 1;
    }

    .zoom-section {
        order: 2;
        justify-content: center !important;
    }

    .actions-section {
        order: 3;
        justify-content: center !important;
    }

    .page-stack {
        width: 100%;
        max-width: 400px;
        margin-top: 4vw;
    }

    .page-controls {
        margin-top: 8px;
        flex-wrap: nowrap;
    }

    .input-wrapper {
        flex-grow: 1;
    }

    .page-input-field {
        width: 100%;
        padding: 8px 12px 8px 32px;
        box-sizing: border-box;
    }

    .digital-display {
        padding: 5px 12px;
    }

    .current-page-num {
        font-size: 18px;
    }

    .nav-btn {
        transform: scale(0.9);
    }

    .zoom-btn, .page-nav-btn {
        width: 34px;
        height: 34px;
    }

    .reset-btn, .refresh-btn {
        width: 36px;
        height: 36px;
    }

    .zoom-display {
        padding: 5px 10px;
        min-width: 55px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .pdf-preview-block {
        padding: 12px;
        border-radius: 12px;
    }

    .pdf-preview-block h3 {
        font-size: 13px;
        height: 80px;
        -webkit-line-clamp: 5;
        padding: 8px 4px;
    }

    .pdf-canvas-preview,
    .pdf-preview-block img[class*="pdf-canvas"] {
        border-radius: 8px;
        margin-bottom: 12px;
    }

    .page-controls {
        gap: 5px;
    }

    .page-input-field {
        font-size: 13px;
        padding-left: 28px;
    }

    .input-led {
        width: 6px;
        height: 6px;
        left: 8px;
    }

    .digital-display {
        padding: 4px 10px;
    }

    .current-page-num {
        font-size: 16px;
    }
}

/* ======== ПОКРАЩЕННЯ ДЛЯ ВИСОКИХ DPI ЕКРАНІВ ======== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .pdf-canvas,
    .pdf-canvas-preview,
    .pdf-preview-block img[class*="pdf-canvas"] {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ======== УТІЛІТИ ======== */
.hidden {
    display: none !important;
}

.loading {
    opacity: 0.7;
}

.error {
    border-color: #dc3545 !important;
    background-color: #f8d7da !important;
}

/* ======== RIPPLE-АНІМАЦІЯ ======== */
@keyframes ripple-effect {
    to {
        transform: scale(2);
        opacity: 0;
    }
}
