﻿
.select-invoice-product-container {
    width: 850px;
    height: 300px;
    overflow-x: auto;
    padding: 5px;
}

.select-invoice-product-subcolumn1 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 0.75fr;
    gap: 15px;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(0,0,0,0.4);
    padding-right: 10px;
    padding-left: 10px;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.select-invoice-product-subcolumn2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(0,0,0,0.4);
    padding-right: 10px;
    padding-left: 10px;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.select-invoice-product-details-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.sub-billing-details-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.select-invoice-product-classification {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.select-invoice-product-extra-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.select-invoice-detail-header {
    color: #0078d4;
    font-weight: bold;
    margin-bottom: 15px;
    margin-top: 15px;
    font-size: 14px;
}

.product-sub-detail-grid {
    margin-top: 15px;
    display: grid;
    grid-template-columns: auto 30px 1fr;
    row-gap: 5px;
    font-size: 12px;
}

.select-invoice-custom-modal-footer {
    display: flex;
    justify-content: center;
    gap: 30px;
    position: sticky;
    bottom: 0;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.select-invoice-custom-modal-footer button {
    flex-basis: 130px;
    font-weight: bold;
}

.form-input-itemwise-none {
    display: none;
}

.taxpaidrate-mode {
    position: relative;
    width: 100%;
    height: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #0078d4;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.taxpaidrate-mode button {
    border: none;
    background: transparent;
    font-size: 12px;
    cursor: pointer;
    color: #0078d4;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* divider between tabs */
.taxpaidrate-mode button + button {
    border-left: 1px solid #0078d4;
}

/* active tab */
.taxpaidrate-mode button.active {
    background-color: #0078d4;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

/* hover */
.taxpaidrate-mode button:not(.active):hover {
    background-color: rgba(0, 120, 212, 0.01);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
}

/*================================ Tablet / mobile =====================================*/
/* Opened from both Create Sale Invoice and Edit Sale Invoice, for adding a line and for editing
   one, so all four routes are covered here.

   The body is a fixed 850px wide and 300px tall, laid out as four columns across and two below.
   The modal itself is ModalSize.Automatic — it sizes to this body — so on a phone the fixed width
   is what pushes the popup off the screen. Below the widths where a column stops being readable
   the body gives up its fixed size and the columns fold. */

@media (max-width: 900px) {
    .select-invoice-product-container {
        /* Blazored keeps a 1.75rem margin on each side of the dialog; that is what's left. */
        width: auto;
        max-width: calc(100vw - 3.5rem);
        /* The fixed 300px is a desktop four-column figure. Folded into fewer columns the same
           fields are taller, so the body scrolls to a share of the viewport instead. */
        height: auto;
        max-height: 70vh;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .select-invoice-product-subcolumn1 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 700px) {
    .select-invoice-product-container {
        /* app.css already forces .size-automatic to calc(100vw - 1.5rem) at this width, so the
           body just fills whatever the dialog ends up being. */
        max-width: 100%;
        max-height: 65vh;
        padding: 2px;
    }

    .select-invoice-product-subcolumn1,
    .select-invoice-product-subcolumn2 {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }

    .select-invoice-detail-header {
        margin-top: 10px;
        margin-bottom: 10px;
    }

    .product-sub-detail-grid {
        grid-template-columns: auto 20px 1fr;
        margin-top: 10px;
    }

    /* Two buttons sharing the row rather than a pair of 130px islands with 30px between them. */
    .select-invoice-custom-modal-footer {
        gap: 12px;
        padding-top: 12px;
    }

    .select-invoice-custom-modal-footer button {
        flex-basis: 50%;
    }
}