/* 2026-08-30: попап предпросмотра Word-документа.
   Стили «листа» перенесены из компонента document-preview ИС «Гранты Главы РД»
   (resources/views/components/admin/document-preview.blade.php).
   Все классы с префиксом dpv- — не конфликтуют с чужим CSS. */

.dpv-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(15, 23, 42, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 12px;
    opacity: 0;
    transition: opacity .18s ease;
}
.dpv-overlay.dpv-open { opacity: 1; }

.dpv-modal {
    background: #e5e7eb;
    border-radius: 10px;
    width: min(920px, 100%);
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    transform: translateY(12px) scale(.985);
    transition: transform .18s ease;
}
.dpv-overlay.dpv-open .dpv-modal { transform: translateY(0) scale(1); }

/* Шапка попапа */
.dpv-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 10px 10px 0 0;
}
.dpv-title {
    flex: 1;
    font: 600 14px/1.3 Arial, sans-serif;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dpv-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 6px;
    padding: 6px 12px;
    font: 500 12.5px/1 Arial, sans-serif;
    cursor: pointer;
}
.dpv-btn:hover { background: #f1f5f9; }
.dpv-download {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.dpv-close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
}
.dpv-close:hover { color: #0f172a; }

/* Прокручиваемая область с «листом» */
.dpv-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
}
.dpv-body::-webkit-scrollbar { width: 8px; }
.dpv-body::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
.dpv-body::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }
.dpv-body::-webkit-scrollbar-thumb:hover { background: #64748b; }

.dpv-sheet {
    background: #ffffff;
    padding: 40px 50px;
    min-height: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .10);
    margin: 0 auto;
    max-width: 800px;
    border-radius: 4px;
}

/* Типографика документа (как в ИС Гранты) */
.dpv-content {
    font-family: 'Times New Roman', Times, serif;
    font-size: 12pt;
    line-height: 1.5;
    color: #1e293b;
    word-wrap: break-word;
}
.dpv-content h1, .dpv-content h2, .dpv-content h3 {
    font-family: 'Times New Roman', Times, serif;
    color: #0f172a;
    margin: 1em 0 .5em;
}
.dpv-content center { display: block; text-align: center; }
.dpv-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 15px 0;
}
.dpv-content table td, .dpv-content table th {
    border: 1px solid #334155;
    padding: 10px 12px;
    vertical-align: top;
}
.dpv-content p { margin: 0 0 12px 0; }
.dpv-content img { max-width: 100%; height: auto; }
.dpv-content hr {
    border: none;
    border-top: 1px solid #cbd5e1;
    margin: 20px 0;
}

/* Состояния загрузки / ошибки */
.dpv-state {
    text-align: center;
    padding: 60px 20px;
    font: 400 14px/1.5 Arial, sans-serif;
    color: #64748b;
}
.dpv-state.dpv-error { color: #b91c1c; }
.dpv-spinner {
    width: 28px;
    height: 28px;
    margin: 0 auto 14px;
    border: 3px solid #e2e8f0;
    border-top-color: #64748b;
    border-radius: 50%;
    animation: dpv-spin .8s linear infinite;
}
@keyframes dpv-spin { to { transform: rotate(360deg); } }

.dpv-sheet--pdf {
    padding: 0;
    background: #525659;
}
.dpv-pdf-frame {
    display: block;
    width: 100%;
    min-height: 75vh;
    border: 0;
    background: #525659;
}

@media (max-width: 768px) {
    .dpv-sheet { padding: 20px; }
    .dpv-content { font-size: 11pt; }
}
