/* =============================================
   INVOICE WEB VIEW — PDF Template Design
   Colors: orange #fa7121, navy #1a406c
   ============================================= */

/* --- Invoice Card --- */
.invoice-wrapper {
    position: relative;
    background: #ffffff;
    border: none !important;
    border-radius: 12px;
    overflow: hidden;
}
/* Left orange accent bar */
.invoice-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: #fa7121;
    z-index: 1;
}

/* --- Header Row (logo + company + pill) --- */
.inv-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 0 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.inv-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.inv-header-logo {
    max-height: 50px;
    width: auto;
    object-fit: contain;
}
.inv-header-company {
    display: flex;
    flex-direction: column;
}
.inv-header-company-name {
    font-size: 20px;
    font-weight: 800;
    color: #1a406c;
    line-height: 1.2;
}
.inv-header-doc-id {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}
.inv-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.inv-doc-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fa7121;
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    padding: 8px 28px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}
.inv-status-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}
.inv-status-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 12px;
    border-radius: 4px;
}

/* --- Company + Client Addresses --- */
.inv-addresses-row {
    display: flex;
    justify-content: space-between;
    padding: 20px 24px;
    flex-wrap: wrap;
    gap: 20px;
}
.inv-address-block {
    max-width: 50%;
}
.inv-address-block.inv-address-client {
    text-align: right;
}
.inv-to-pill {
    display: inline-block;
    background: #fa7121;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    padding: 4px 20px 4px 14px;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    margin-bottom: 8px;
}
.inv-company-name-label {
    font-size: 16px;
    font-weight: 700;
    color: #1a406c;
}
.inv-address-text {
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
    margin-top: 4px;
}

/* --- Dates & Payments Row --- */
.inv-meta-row {
    display: flex;
    justify-content: space-between;
    padding: 0 24px 16px 24px;
    flex-wrap: wrap;
    gap: 16px;
}
.inv-dates-table,
.inv-payments-table {
    border-collapse: collapse;
}
.inv-dates-table td,
.inv-payments-table td {
    padding: 3px 12px 3px 0;
    font-size: 13px;
    color: #334155;
}
.inv-dates-table td:first-child,
.inv-payments-table td:first-child {
    color: #64748b;
    font-weight: 500;
}
.inv-balance-label {
    display: inline-block;
    background: #dc3545;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    padding: 4px 16px;
    border-radius: 6px;
}
.inv-balance-label.inv-balance-paid {
    background: #28a745;
}

/* --- Invoice Table (items-grid with orange header) --- */
.invoice-table-wrapper .items-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.invoice-table-wrapper .items-grid thead th {
    background: #fa7121;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 12px;
    border: none;
    text-align: left;
}
.invoice-table-wrapper .items-grid thead th:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}
.invoice-table-wrapper .items-grid thead th:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    text-align: right;
}
.invoice-table-wrapper .items-grid thead th.x-quantity,
.invoice-table-wrapper .items-grid thead th.x-rate {
    text-align: center;
}
.invoice-table-wrapper .items-grid td {
    padding: 10px 12px;
    font-size: 13px;
    color: #1e293b;
    border-bottom: 1.5px solid #e2e8f0;
    vertical-align: top;
}
.invoice-table-wrapper .items-grid td.x-quantity,
.invoice-table-wrapper .items-grid td.x-rate {
    text-align: center;
}
.invoice-table-wrapper .items-grid td.x-total {
    text-align: right;
}
.invoice-table-wrapper .items-grid td.x-description {
    text-align: left;
}
/* editing mode item rows */
.invoice-table-wrapper .items-grid td.form-group {
    margin-bottom: 0;
    padding: 6px 6px;
}

/* --- Totals Table --- */
.inv-totals-section {
    display: flex;
    justify-content: space-between;
    padding: 12px 24px;
    flex-wrap: wrap;
    gap: 20px;
}
.inv-attachments {
    font-size: 13px;
}
.inv-attachments h6 {
    font-size: 14px;
    font-weight: 700;
    color: #1a406c;
    margin: 0 0 6px 0;
}
.inv-totals-table {
    border-collapse: collapse;
    min-width: 260px;
}
.inv-totals-table td {
    padding: 5px 0;
    font-size: 14px;
    color: #334155;
}
.inv-totals-table td:first-child {
    text-align: right;
    padding-right: 20px;
}
.inv-totals-table td:last-child {
    text-align: right;
    font-weight: 600;
    min-width: 100px;
}
.inv-total-row td {
    padding: 4px 0 !important;
}
.inv-total-label {
    display: inline-block;
    background: #fa7121;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    padding: 6px 20px;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}
.inv-total-value {
    display: inline-block;
    background: #fa7121;
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    padding: 6px 20px;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* --- Terms & Footer --- */
.inv-terms-section {
    padding: 12px 24px;
}
.inv-terms-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a406c;
    margin-bottom: 6px;
}
.inv-terms-body {
    font-size: 12px;
    color: #475569;
    line-height: 1.5;
}
.inv-thanks-msg {
    font-size: 22px;
    font-weight: 800;
    color: #1a406c;
    margin-top: 24px;
    line-height: 1.2;
}

/* --- Thank You + Signature (viewing mode) --- */
.inv-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 24px 20px 24px;
    flex-wrap: wrap;
    gap: 20px;
}
.inv-signature-box {
    text-align: center;
}
.inv-signature-svg {
    width: 120px;
    height: auto;
}
.inv-signature-name {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin-top: 2px;
}
.inv-signature-title {
    font-size: 12px;
    color: #64748b;
}

/* --- Buttons (viewing mode) --- */
.inv-buttons-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    flex-wrap: wrap;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .inv-header-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .inv-header-right {
        align-items: flex-start;
        width: 100%;
    }
    .inv-doc-type-pill {
        font-size: 16px;
        padding: 6px 20px;
    }
    .inv-addresses-row {
        flex-direction: column;
    }
    .inv-address-block {
        max-width: 100%;
    }
    .inv-address-block.inv-address-client {
        text-align: left;
    }
    .inv-meta-row {
        flex-direction: column;
    }
    .inv-totals-section {
        flex-direction: column;
    }
    .inv-totals-table {
        min-width: auto;
        width: 100%;
    }
    .inv-footer-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .inv-signature-box {
        text-align: left;
    }
}

/* --- Preserve editing mode form controls --- */
#invoice-wrapper .form-control-sm {
    font-size: 13px;
}