/* ==========================================================================
   Invoice Web View Stylesheet
   Loaded on the interactive (non-print) invoice page.
   ========================================================================== */

/* ── Shared invoice utility classes ── */
.invoice-label {
    font-size: 0.85em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 0.3em;
    font-weight: bold;
}

.invoice-edit-link {
    font-size: 0.8rem;
    text-decoration: underline;
    display: inline-block;
    margin-top: 0.3em;
}

.invoice-amount-due-box {
    background: #1b1c1d;
    color: #fff;
    padding: 0.8em 1em;
    margin-top: 1em;
    text-align: right;
    font-size: 1.1em;
}

/* ── Invoice totals (flexbox layout) ── */
.invoice-totals-section {
    margin-top: 1.5em;
    border-top: 1px solid #e0e0e0;
    padding-top: 0.8em;
    max-width: 360px;
    margin-left: auto;
}

.invoice-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.35em 0;
    font-size: 0.95em;
    color: #555;
}

.invoice-totals-row .invoice-totals-label {
    flex-shrink: 0;
    margin-right: 1em;
}

.invoice-totals-row .invoice-totals-value {
    text-align: right;
    white-space: nowrap;
}

.invoice-totals-due {
    border-top: 2px solid #333;
    margin-top: 0.3em;
    padding-top: 0.5em;
    font-weight: bold;
    font-size: 1.05em;
    color: #1b1c1d;
}

/* ── Mobile line-item cards ── */
.invoice-lines-mobile {
    display: none;
}

.invoice-line-card {
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 1em;
    margin-bottom: 0.75em;
    background: #fcfcfc;
}

.invoice-line-card-name {
    font-weight: 700;
    font-size: 1em;
    color: #222;
    margin-bottom: 0.6em;
    line-height: 1.4;
}

.invoice-line-card-descr {
    font-weight: 400;
    font-size: 0.88em;
    color: #666;
    margin-top: 0.25em;
    line-height: 1.5;
}

.invoice-line-card-numbers {
    display: flex;
    gap: 0.5em;
}

.invoice-line-card-detail {
    flex: 1;
    text-align: center;
    padding: 0.5em 0.25em;
    background: #f5f5f5;
    border-radius: 4px;
}

.invoice-line-card-subtotal {
    background: #eef6ee;
}

.invoice-line-card-label {
    display: block;
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
    font-weight: 600;
    margin-bottom: 0.2em;
}

.invoice-line-card-value {
    display: block;
    font-size: 1em;
    font-weight: 600;
    color: #333;
}

/* ── Payment cards (mobile) ── */
.payments-mobile {
    display: none;
}

.payment-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.9em 1em;
    margin-bottom: 0.6em;
    background: #fff;
}

.payment-card-verified {
    border-left: 3px solid #21ba45;
    background: #f9fff9;
}

.payment-card-top {
    display: flex;
    align-items: center;
    gap: 0.6em;
}

.payment-card-select {
    flex-shrink: 0;
    width: 22px;
}

.payment-card-header {
    flex: 1;
    min-width: 0;
}

.payment-card-header strong {
    display: block;
    font-size: 0.95em;
    color: #222;
}

.payment-card-date {
    font-size: 0.8em;
    color: #888;
}

.payment-card-amount {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 1.05em;
    white-space: nowrap;
}

.payment-debit {
    color: #db2828;
}

.payment-credit {
    color: #21ba45;
}

.payment-card-descr {
    font-size: 0.85em;
    color: #666;
    margin-top: 0.4em;
    padding-left: 28px;
    line-height: 1.4;
}

.payment-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5em;
    padding-top: 0.5em;
    border-top: 1px solid #f0f0f0;
    font-size: 0.82em;
    color: #777;
}

.payment-card-verified-badge {
    color: #21ba45;
    font-weight: 600;
}

.payment-card-verified-badge i.icon {
    margin-right: 0.15em;
}

/* ── Payments action bar (below table, left-aligned) ── */
.payments-action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    margin-top: 0.6em;
    margin-bottom: 0.5em;
}

.payments-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4em;
}

.payments-bulk-label {
    font-weight: 600;
    font-size: 0.9em;
    color: #555;
    margin-right: 0.3em;
}

.payments-primary-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.4em;
}

/* ── Payments page actions (bottom buttons) ── */
.payments-page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5em;
}

.payments-page-actions .ui.button {
    margin: 0;
}

/* ── VOID / PAID stamp ── */
.invoice-stamp {
    text-align: center;
    margin: 1.5em 0 0.5em;
}

.invoice-stamp img {
    max-height: 100px;
    width: auto;
    opacity: 0.3;
}

/* ── Action buttons ── */
.invoice-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.invoice-action-buttons .ui.button {
    margin: 0;
}

/* ── Mobile responsive ── */
@media only screen and (max-width: 767px) {
    .invoice-lines-desktop {
        display: none !important;
    }
    .invoice-lines-mobile {
        display: block;
    }
    .invoice-totals-section {
        max-width: 100%;
    }
    .invoice-totals-due {
        font-size: 1.1em;
    }

    /* Reorder: sidebar first on mobile, main content second */
    .invoice-web-layout {
        display: flex !important;
        flex-direction: column;
    }
    .invoice-web-layout > .mobile-order-first {
        order: -1 !important;
        margin-bottom: 1em;
    }
    .invoice-web-layout > .mobile-order-second {
        order: 1 !important;
    }

    /* Tighten padded segment on mobile */
    .ui.padded.segment {
        padding: 1em !important;
    }

    /* Action buttons: full-width stacked on mobile */
    .invoice-action-buttons {
        flex-direction: column;
    }
    .invoice-action-buttons .ui.button {
        width: 100%;
        text-align: center;
    }
    .invoice-action-buttons .ui.button > i.icon {
        display: none;
    }

    /* Payments: show cards, hide table */
    .payments-table-desktop {
        display: none !important;
    }
    .payments-mobile {
        display: block;
    }

    /* Payments summary full width on mobile */
    .payments-summary {
        max-width: 100%;
    }

    /* Payments action bar: stack on mobile */
    .payments-action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .payments-bulk-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .payments-bulk-actions .ui.button {
        width: 100%;
        text-align: center;
    }
    .payments-bulk-actions .payments-bulk-label {
        text-align: center;
        margin-bottom: 0.3em;
    }

    .payments-primary-actions {
        flex-direction: column;
        margin-left: 0;
    }
    .payments-primary-actions .ui.button {
        width: 100%;
        text-align: center;
    }
    .payments-primary-actions .ui.button > i.icon {
        display: none;
    }

    /* Payments page actions stack */
    .payments-page-actions {
        flex-direction: column;
    }
    .payments-page-actions .ui.button {
        width: 100%;
        text-align: center;
    }
    .payments-page-actions .ui.button > i.icon {
        display: none;
    }
}
