.gb-doc-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.gb-doc-modal.is-open {
    display: flex;
}

.gb-doc-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(43, 40, 43, 0.72);
}

.gb-doc-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 860px;
    height: min(85vh, 900px);
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gb-doc-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #eee;
    flex: 0 0 auto;
}

.gb-doc-modal__title {
    font-family: var(--agriox-font, 'Poppins', sans-serif);
    font-weight: 700;
    font-size: 16px;
    color: var(--agriox-primary, #2b282b);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gb-doc-modal__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.gb-doc-modal__download,
.gb-doc-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-cream, #f7f3ec);
    color: var(--agriox-primary, #2b282b);
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background 180ms ease, color 180ms ease;
}

.gb-doc-modal__download:hover,
.gb-doc-modal__close:hover {
    background: var(--agriox-secondary, #567a3d);
    color: #ffffff;
}

.gb-doc-modal__body {
    flex: 1 1 auto;
    overflow: auto;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gb-doc-modal__body iframe,
.gb-doc-modal__body embed {
    width: 100%;
    height: 100%;
    border: none;
}

.gb-doc-modal__body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin: auto;
}

.gb-doc-modal__fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    max-width: 360px;
    padding: 30px;
    margin: auto;
    font-family: var(--agriox-font, 'Poppins', sans-serif);
    color: var(--agriox-color-1, #5c5a5a);
}

.gb-doc-modal__fallback i {
    font-size: 42px;
    color: var(--agriox-secondary, #567a3d);
}

.gb-doc-modal__fallback p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.6;
}

@media (max-width: 575px) {
    .gb-doc-modal {
        padding: 0;
    }

    .gb-doc-modal__dialog {
        max-width: none;
        height: 100%;
        border-radius: 0;
    }
}
