/*!
 * FileViewer.js styles
 * Class names are prefixed "fv-" to avoid colliding with Bootstrap/AdminLTE.
 */

.fv-lock-scroll {
    overflow: hidden;
}

.fv-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10600; /* above AdminLTE navbars/modals */
    background: rgba(17, 20, 24, 0.85);
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.fv-overlay.fv-open {
    display: flex;
}

.fv-modal {
    position: relative;
    background: #fff;
    width: min(1000px, 100%);
    height: min(80vh, 100%);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.fv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e4e8;
    flex-shrink: 0;
}

.fv-title {
    font-weight: 600;
    font-size: 14px;
    color: #212529;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

.fv-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fv-action-download,
.fv-action-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: #495057;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.fv-action-download:hover,
.fv-action-close:hover {
    background: #e9ecef;
    color: #111;
}

.fv-body {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #525659;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fv-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin: auto;
}

.fv-pdf-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

.fv-media {
    max-width: 100%;
    max-height: 100%;
}

.fv-text {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 16px;
    background: #fff;
    color: #212529;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
    box-sizing: border-box;
}

.fv-docx {
    width: 100%;
    height: 100%;
    overflow: auto;
    background: #fff;
    padding: 32px;
    box-sizing: border-box;
    color: #212529;
    align-self: stretch;
}

.fv-docx img {
    max-width: 100%;
}

.fv-sheet-tabs {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 2px;
    padding: 6px 8px 0;
    background: #f1f3f5;
    border-bottom: 1px solid #dee2e6;
    overflow-x: auto;
    z-index: 1;
}

.fv-sheet-tab {
    border: 1px solid #dee2e6;
    border-bottom: none;
    background: #e9ecef;
    color: #495057;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    white-space: nowrap;
}

.fv-sheet-tab.active {
    background: #fff;
    color: #111;
    font-weight: 600;
}

.fv-sheet-table-wrap {
    width: 100%;
    height: 100%;
    overflow: auto;
    background: #fff;
    padding: 36px 12px 12px;
    box-sizing: border-box;
    align-self: stretch;
}

.fv-sheet-table {
    border-collapse: collapse;
    font-size: 12px;
    width: max-content;
    min-width: 100%;
}

.fv-sheet-table td,
.fv-sheet-table th {
    border: 1px solid #dee2e6;
    padding: 4px 8px;
    white-space: nowrap;
}

.fv-sheet-note {
    padding: 8px 4px 0;
    font-size: 12px;
    color: #868e96;
}

.fv-fallback,
.fv-error {
    text-align: center;
    color: #f1f3f5;
    padding: 32px;
}

.fv-fallback-icon,
.fv-error-icon {
    font-size: 56px;
    color: #adb5bd;
    margin-bottom: 16px;
    display: block;
}

.fv-fallback-name {
    font-weight: 600;
    word-break: break-all;
    margin-bottom: 4px;
}

.fv-fallback-hint {
    font-size: 13px;
    color: #adb5bd;
    margin-bottom: 16px;
}

.fv-download-link {
    display: inline-block;
    padding: 8px 18px;
    background: #339af0;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
}

.fv-download-link:hover {
    background: #1c7ed6;
    color: #fff;
}

.fv-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #f1f3f5;
    background: #525659;
}

.fv-spinner-icon {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fv-spin 0.8s linear infinite;
    margin-bottom: 10px;
}

.fv-spinner-text {
    font-size: 13px;
}

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

.fv-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fv-nav:hover {
    background: rgba(0, 0, 0, 0.65);
}

.fv-nav-prev {
    left: 12px;
}

.fv-nav-next {
    right: 12px;
}

.fv-counter {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
}

@media (max-width: 576px) {
    .fv-overlay {
        padding: 0;
    }
    .fv-modal {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    .fv-title {
        max-width: 55%;
    }
}
