/* Обгортка для файлу-документа */
.doc-file-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    margin: 8px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f9f9f9;
}

.doc-file-name {
    flex: 1;
    font-size: 15px;
    color: #333;
    word-break: break-word;
}

.doc-type-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin-right: 10px;
    vertical-align: middle;
    border-radius: 4px;
}

.doc-file-text {
    vertical-align: middle;
}

.doc-file-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.doc-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none !important;
    display: inline-block;
    transition: box-shadow 0.2s, background 0.2s;
    line-height: 1.4;
}

/* Кнопка "Завантажити" — текст завжди білий, незалежно від стилів теми */
.doc-btn-download,
.doc-btn-download:link,
.doc-btn-download:visited,
.doc-btn-download:hover,
.doc-btn-download:focus,
.doc-btn-download:active {
    background: #2c7be5;
    color: #ffffff !important;
    text-decoration: none !important;
}

.doc-btn-download:hover {
    background: #2c7be5 !important;
    box-shadow: 0 3px 10px rgba(44, 123, 229, 0.45);
}

/* Кнопка "Переглянути" */
.doc-btn-preview {
    background: #f0f4ff;
    color: #2c7be5;
    border: 1px solid #2c7be5;
}

.doc-btn-preview:hover {
    box-shadow: 0 3px 10px rgba(44, 123, 229, 0.25);
    background: #e6eeff;
}

/* Модальне вікно */
.doc-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.doc-modal-overlay.active {
    display: flex;
}

.doc-modal {
    background: #fff;
    border-radius: 10px;
    width: 90vw;
    height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.doc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f5f5f5;
}

.doc-modal-title {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.doc-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #666;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.doc-modal-close:hover {
    background: #e0e0e0;
}

.doc-modal-body {
    flex: 1;
    overflow: hidden;
}

.doc-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Мобільна адаптація */
@media (max-width: 600px) {
    .doc-file-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }

    .doc-modal {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
}

/* Статус завантаження всередині модалки */
.doc-modal-status {
    position: absolute;
    inset: 60px 0 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #fff;
    z-index: 2;
}

.doc-modal-body {
    position: relative;
}

.doc-status-text {
    font-size: 15px;
    color: #555;
    margin: 0;
}

.doc-btn-retry {
    background: #fff;
    color: #2c7be5;
    border: 1px solid #2c7be5;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.doc-btn-retry:hover {
    background: #f0f4ff;
}

/* Спінер */
.doc-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #2c7be5;
    border-radius: 50%;
    animation: doc-spin 0.8s linear infinite;
}

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