/**
 * View Receipts
 *
 * Follows the portal's existing look: #212121 borders with a ridged silver
 * outline, olive radial-gradient panels, silver body text and #b8a680 labels,
 * matching status-change, new_vendor and funds_received.
 *
 * Note the portal page already forces some globals that this works with rather
 * than against: `input` is transparent/silver/centered !important, `select` is
 * width:100%, and `.page-id-15 li` carries a 20px bottom margin.
 */

/* Responsive adjustments for smaller screens */
/* Media query for smaller screens */
@media (max-width: 750px) and (orientation: portrait) {
    div.viewrec-wrap {
        zoom: 70%;
        -moz-transform: scale(100%);/* Firefox Property */
        -moz-transform-origin: 0 0;
        -o-transform: scale(100%);/* Opera Property */
        -o-transform-origin: 0 0;
        -webkit-transform: scale(100%);/* Safari Property */
        -webkit-transform-origin: 0 0;
        transform: scale(100%); /* Standard Property */
        transform-origin: 0 0;  /* Standard Property */
        float: left
    }
}

/* ---------- Outer panel ---------- */

.viewrec-wrap {
    display: inline-block;
    border:
    5px solid #212121;
    outline: 2px ridge silver;
    padding: 15px;
    color: silver;
    background: rgb(61,54,30);
    background: radial-gradient(circle, rgba(61,54,30,0.9868123933167017) 0%, rgba(47,43,35,1) 75%);
    width: 980px;
    max-width: 100%;
    text-align: left;
    /* Makes the native date picker render dark instead of white-on-dark. */
    color-scheme: dark;
}

.viewrec-title {
    margin: 0 0 15px;
    color: #b8a680;
    font-size: 26px;
    text-align: center;
}

.viewrec-denied {
    color: #b8a680;
    font-size: 20px;
    text-align: center;
}

/* ---------- Filter bar ---------- */

/* Fixed grid so the row layout cannot shift between the disabled and enabled
   states (enabled date inputs are wider, which used to wrap the row).
   Row 1: Job | Trans ID | Vendor.  Row 2: Date span, buttons right. */
.viewrec-filters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 15px;
    align-items: end;
    padding-bottom: 15px;
    border-bottom: 2px solid #4c4b4b;
}

/* Row 1: Client | Job | Trans ID | Vendor.  Row 2: Date span, buttons right. */
.viewrec-field-dates {
    grid-column: 1 / 4;
}

.viewrec-actions {
    grid-column: 4;
    justify-self: end;
}

.viewrec-field {
    display: flex;
    flex-direction: column;
    min-width: 190px;
}

/* 20px matches the portal's `.page-id-15 p` label text and its `select` rule. */
.viewrec-field label {
    display: block;
    margin-bottom: 5px;
    color: #b8a680;
    font-size: 20px;
}

.viewrec-field select {
    background-color: transparent;
    color: silver;
    border-radius: 4px;
    border: 1px solid black;
    outline: 2px ridge rgb(84, 84, 84);
    margin-top: 3px;
    margin-bottom: 10px;
    text-align: center;
    width: 100%;
    height: 38px;
    font-size: 20px;
}

.viewrec-field select option {
    background-color: #3d3c32;
    color: silver;
    padding: 8px 12px;
    font-size: 20px;
    text-align: center;
}

/* Beat `.page-id-15 select:disabled` so disabled boxes stay in the palette. */
.page-id-15 .viewrec-field select:disabled,
.viewrec-field select:disabled {
    background-color: #2f2b23;
    color: #7d7666;
    cursor: not-allowed;
}


/* Matches the select's own 3px/10px margins so all four filters share a baseline. */
.viewrec-daterow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    margin-bottom: 10px;
    height: 38px;
}

.viewrec-daterow span {
    color: #b8a680;
    font-size: 20px;
    flex: 0 0 auto;
}

/* The global `input` rule is !important, so only layout is set here.
   18px matches the portal's global `input { font-size: 18px }`. */
.viewrec-daterow input[type="date"] {
    flex: 1 1 auto;
    min-width: 0;
    height: 38px;
    font-size: 18px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.viewrec-daterow input[type="date"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.viewrec-actions {
    display: flex;
    gap: 10px;
    padding-bottom: 10px;
}

/* Matches the portal's submit buttons. */
.viewrec-btn {
    background-color: #212121;
    color: silver;
    border-radius: 4px;
    border: 1px solid black;
    outline: 2px ridge rgb(84, 84, 84);
    cursor: pointer;
    height: 38px;
    width: 110px;
    font-size: 18px;
}

.viewrec-btn:hover:not(:disabled) {
    background-color: #7e7853;
    -webkit-box-shadow: 0px 0px 17px 5px rgba(97,93,73,0.9);
    -moz-box-shadow: 0px 0px 17px 5px rgba(97,93,73,0.9);
    box-shadow: 0px 0px 17px 5px rgba(97,93,73,0.9);
}

.viewrec-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---------- Status line ---------- */

.viewrec-wrap p.viewrec-message {
    margin: 12px 0;
    color: #b8a680;
    font-size: 20px;
    text-align: center;
}

.viewrec-wrap p.viewrec-message.viewrec-error {
    color: #d99a8f;
}

/* ---------- Results and viewer ---------- */

.viewrec-body {
    display: flex;
    border: 2px solid silver;
    min-height: 600px;
}

/* `display: flex` beats the browser's own [hidden] rule, so restate it. */
.viewrec-body[hidden] {
    display: none;
}

.viewrec-listpane {
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    border-right: 2px solid silver;
    min-width: 0;
}

.viewrec-count {
    padding: 8px 10px;
    border-bottom: 2px solid #4c4b4b;
    color: #b8a680;
    font-size: 18px;
    min-height: 18px;
    text-align: center;
}

.viewrec-list {
    flex: 1;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    max-height: 600px;
}

/* Beats `.page-id-15 li { margin-bottom: 20px }` so rows sit tight. */
.viewrec-list li.viewrec-item {
    margin-bottom: 0;
    padding: 9px 10px;
    border-bottom: 1px solid #4c4b4b;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: silver;
    font-size: 18px;
    text-align: left;
}

.viewrec-list li.viewrec-item:hover {
    background-color: rgba(126, 120, 83, 0.25);
}

.viewrec-list li.viewrec-item:focus {
    outline: 2px ridge rgb(163, 151, 107);
    outline-offset: -2px;
}

.viewrec-list li.viewrec-item-active {
    background-color: rgba(126, 120, 83, 0.45);
    box-shadow: inset 3px 0 0 #b8a680;
}

.viewrec-item-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    color: #b8a680;
}

.viewrec-item-date {
    color: silver;
    font-size: 17px;
}

.viewrec-item-vendor {
    color: silver;
    font-size: 17px;
    overflow-wrap: anywhere;
}

/* Shown when a result set spans jobs, or no single job is pinned. */
.viewrec-item-job {
    color: #b8a680;
    font-size: 15px;
    overflow-wrap: anywhere;
}

.viewrec-viewpane {
    flex: 1;
    position: relative;
    min-width: 0;
    background-color: rgba(17, 17, 17, 0.74);
}

.viewrec-viewer-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    color: #a4936b;
    font-size: 20px;
}

.viewrec-viewer {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 600px;
    border: 0;
    background-color: #2f2b23;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 860px) {
    .viewrec-filters {
        grid-template-columns: 1fr;
    }

    .viewrec-field-dates,
    .viewrec-actions {
        grid-column: 1;
        justify-self: stretch;
    }

    .viewrec-body {
        flex-direction: column;
        min-height: 0;
    }

    .viewrec-listpane {
        flex: 1 1 auto;
        border-right: 0;
        border-bottom: 2px solid silver;
    }

    .viewrec-list {
        max-height: 260px;
    }

    .viewrec-viewer {
        min-height: 480px;
    }
}
