/* ===========================================
   Viewer Page — PDF iframe + Office Online preview
   =========================================== */

.viewer-body {
    margin: 0;
    background: var(--bg-light);
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */

.viewer-header {
    background: var(--primary-blue);
    color: var(--text-light);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.viewer-header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 0;
}

.viewer-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.viewer-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewer-type-badge {
    display: inline-block;
    width: fit-content;
    padding: 2px 10px;
    background: var(--secondary-gold);
    color: var(--primary-blue);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* --- Buttons --- */

.btn-back,
.btn-download,
.btn-back-mini {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-back {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-download {
    background: var(--secondary-gold);
    color: var(--primary-blue);
}

.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(254, 180, 1, 0.4);
}

.btn-back-mini {
    background: var(--primary-blue);
    color: var(--text-light);
    margin-top: 12px;
}

.btn-back-mini:hover {
    background: #001e35;
}

/* --- Content area --- */

.viewer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #525659;
    min-height: calc(100vh - 80px);
    position: relative;
}

.viewer-pdf-frame,
.viewer-office-frame {
    flex: 1;
    width: 100%;
    border: none;
    min-height: calc(100vh - 80px);
}

/* --- States --- */

.viewer-loading,
.viewer-error {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 600;
    padding: 60px 20px;
    text-align: center;
}

.viewer-loading i {
    font-size: 3rem;
    color: var(--secondary-gold);
}

.viewer-error i {
    font-size: 3rem;
    color: #ef4444;
}

/* --- Responsive --- */

@media (max-width: 640px) {
    .viewer-header {
        padding: 12px 16px;
        gap: 12px;
    }

    .viewer-header-left {
        gap: 12px;
    }

    .viewer-title {
        font-size: 0.95rem;
    }

    .btn-back,
    .btn-download {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}
