﻿/* ===================================================================
           DOCUMENT PANEL
           One frame only. The card header IS the document title bar, and the
           PDF sits directly inside it — no gray tray, no inner card, no
           nested rounded box around the browser's own viewer.
        =================================================================== */
.doc-panel {
    border: 1px solid #d3dae4;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 10px rgba(23, 63, 122, .07);
}

.doc-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #173F7A;
    color: #fff;
    padding: 12px 18px;
    font-family: Arial, Helvetica, sans-serif;
}

    .doc-panel-header .doc-panel-title {
        display: flex;
        align-items: center;
        gap: 9px;
        font-size: 15px;
        font-weight: 600;
        letter-spacing: .2px;
    }

        .doc-panel-header .doc-panel-title i {
            font-size: 17px;
            opacity: .9;
        }

.doc-panel-file {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,.75);
    max-width: 38%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-panel-download {
    display: none; /* shown by script once the file is ready */
    align-items: center;
    gap: 7px;
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 6px;
    padding: 6px 13px;
    font-size: 12.5px;
    font-weight: 600;
    color: #fff !important;
    text-decoration: none;
    white-space: nowrap;
}

    .doc-panel-download:hover {
        background: rgba(255,255,255,.14);
    }

.doc-panel-body {
    position: relative;
    width: 100%;
    height: 78vh;
    min-height: 480px;
    max-height: 1000px;
    /* matches the built-in PDF viewer background so the two blend */
    background: #f2f4f7;
}

.doc-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.doc-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: Arial, Helvetica, sans-serif;
    color: #445064;
}

    .doc-loading .spinner {
        width: 34px;
        height: 34px;
        border: 3px solid #d7dde6;
        border-top-color: #173F7A;
        border-radius: 50%;
        animation: doc-spin .8s linear infinite;
    }

    .doc-loading p {
        margin: 0;
        font-size: 13.5px;
    }

@keyframes doc-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .doc-loading .spinner {
        animation-duration: 2.4s;
    }
}

.doc-fallback {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
    color: #445064;
}

    .doc-fallback i {
        font-size: 40px;
        color: #173F7A;
    }

    .doc-fallback p {
        margin: 0;
        font-size: 14px;
        max-width: 360px;
    }

    .doc-fallback a {
        color: #173F7A;
        font-weight: 600;
        text-decoration: underline;
    }

/* ===================================================================
           MOBILE DOCUMENT VIEW
           Mobile browsers (Android Chrome, Safari, etc.) do not render a
           blob: PDF inline inside an <iframe> the way desktop Chrome does —
           they show a bare native "can't preview / Open" placeholder with a
           random object id. Rather than let that ugly, unbranded box show,
           mobile devices get this clean card instead, with a button that
           hands the PDF to the device's own viewer/app in a new tab (which
           mobile handles perfectly well).
        =================================================================== */
.doc-mobile-view {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 32px 24px;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
    background: #f2f4f7;
}

    .doc-mobile-view .doc-mobile-icon {
        width: 62px;
        height: 62px;
        border-radius: 16px;
        background: #173F7A;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 26px;
        box-shadow: 0 4px 14px rgba(23, 63, 122, .25);
    }

    .doc-mobile-view .doc-mobile-title {
        font-size: 15px;
        font-weight: 700;
        color: #1c2530;
        margin: 0;
    }

    .doc-mobile-view .doc-mobile-file {
        font-size: 12.5px;
        color: #6b7686;
        margin: -6px 0 0;
        max-width: 280px;
        overflow-wrap: anywhere;
    }

    .doc-mobile-view .doc-mobile-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: #173F7A;
        color: #fff !important;
        border: none;
        border-radius: 8px;
        padding: 12px 24px;
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
        margin-top: 4px;
    }

        .doc-mobile-view .doc-mobile-btn:hover,
        .doc-mobile-view .doc-mobile-btn:active {
            background: #12315F;
        }

    .doc-mobile-view .doc-mobile-hint {
        font-size: 11.5px;
        color: #8892a0;
        margin: 0;
    }

/* Status value inside the details table, so an open application reads
       clearly without needing a separate panel below the card. */
.status-pill {
    display: inline-block;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.6;
    background: #eef3fb;
    color: #173F7A;
    border: 1px solid #d6e1f2;
}

    .status-pill.is-issued {
        background: #eaf7ef;
        color: #1c6b3c;
        border-color: #cfe9da;
    }

@media (max-width: 576px) {
    .doc-panel-body {
        height: 68vh;
        min-height: 400px;
    }

    .doc-panel-file {
        display: none; /* the header already names the document */
    }
}

@media (max-width: 576px) {

    #applicationDetailsTable,
    #applicationDetailsTable tbody,
    #applicationDetailsTable tr,
    #applicationDetailsTable th,
    #applicationDetailsTable td {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    #applicationDetailsTable {
        border: 0 !important;
        margin: 0 !important;
    }

        #applicationDetailsTable thead {
            display: none !important;
        }

        #applicationDetailsTable tr {
            border: 1px solid #e2e7ee !important;
            border-radius: 10px;
            background: #fff;
            box-shadow: 0 1px 3px rgba(23, 63, 122, .06);
            margin-bottom: 10px;
            padding: 10px 14px;
            overflow: hidden;
        }

            #applicationDetailsTable tr:last-child {
                margin-bottom: 0;
            }

        #applicationDetailsTable th {
            border: 0 !important;
            background: transparent !important;
            padding: 0 0 3px !important;
            font-size: 10.5px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: .06em;
            color: #8892a0;
            line-height: 1.3;
        }

        #applicationDetailsTable td {
            border: 0 !important;
            padding: 0 !important;
            font-size: 14.5px;
            font-weight: 600;
            color: #173F7A;
            line-height: 1.4;
            overflow-wrap: anywhere;
        }
}

@media print {
    .card-header, form, .doc-panel {
        display: none !important;
    }
}
