﻿/* receipt-review-popup.css */

/* Algemene basis */
.rrp, .rrp * {
    box-sizing: border-box;
}

.rrp {
    width: 100%;
    max-width: 1650px;
    margin: 0 auto;
    max-height: calc(86vh - 60px);
}

/* Layout links/rechts */
.rrp__grid {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    gap: 1rem;
    width: 100%;
    height: 100%;
    min-width: 0;
}

.rrp__left,
.rrp__right {
    min-width: 0;
    min-height: 0;
    padding-bottom: 35px;
}

.rrp__imageWrap {
    height: 100%;
    overflow: auto;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: .75rem;
}

.rrp__image {
    width: 100%;
    height: auto;
    display: block;
}

.rrp__pdf {
    width: 100%;
    height: 100%;
    border: 0;
}

/* Rechterkolom */
.rrp__right {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.rrp__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.rrp__title {
    margin: 0;
}

.rrp__actions {
    display: flex;
    gap: .5rem;
}

/* Meta velden */
.rrp__meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem 1rem;
    margin-top: .75rem;
}

.rrp__meta--invoice {
    margin-top: .75rem;
}

.rrp__field {
    /* geen margin hier; grid gap regelt spacing */
}

    .rrp__field label {
        display: block;
        font-size: .85rem;
        opacity: .75;
        margin-bottom: .25rem;
    }

.rrp__field input {
    width: 100%;
    padding: .55rem .65rem;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
}

.rrp__field select {
    width: 100%;
    padding: .55rem .65rem;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #fff;
}

.rrp__field--error input,
.rrp__field--error select {
    border-color: #d9534f;
}

.rrp__error {
    font-size: .8rem;
    color: #d9534f;
    margin-top: .25rem;
    display: none;
}

.rrp__error.is-visible {
    display: block;
}

/* Items header (boven lijst) */
.rrp__itemsHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
}

/* ===== Items "table-like" layout ===== */

.rrp__items {
    margin-top: .5rem;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: auto;
    background: #fff;
    /* voorkomt header/rows offset door verticale scrollbar */
    scrollbar-gutter: stable;
    /*
    1 bron van waarheid voor je kolommen:

    - Omschrijving: flexibel, mag afkappen
    - Aantal: min 80px
    - Eenheid: min 80px
    - Regelbedrag: min 110px
    - Acties: vast 120px (knoppen)
  */
    --rrp-cols: minmax(0, 1.4fr) minmax(80px, .55fr) minmax(80px, .55fr) minmax(110px, .65fr) 120px;
}

.rrp__row {
    display: grid;
    grid-template-columns: var(--rrp-cols);
    column-gap: .5rem;
    align-items: center;
    padding: .6rem .7rem;
    border-bottom: 1px solid #f0f0f0;
}

    .rrp__row:last-child {
        border-bottom: none;
    }

.rrp__row--header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #fff;
    font-weight: 600;
    font-size: .85rem;
    opacity: .85;
    border-bottom: 1px solid #eaeaea;
}

/* Cells */
.rrp__cell {
    min-width: 0;
}

.rrp__cell--truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rrp__cell--right {
    text-align: right;
}

/* Acties kolom (knoppen rechts) */
.rrp__cell--actions {
    display: flex;
    justify-content: flex-end;
    gap: .35rem;
}

/* Pills */
.rrp__pill {
    font-size: .85rem;
    padding: .2rem .5rem;
    border: 1px solid #eee;
    border-radius: 999px;
    background: #fff;
}

.rrp__pill--disabled {
    border-color: #ddd;
    background: #f4f4f4;
    color: #666;
}
/* Inputs in edit mode */
.rrp__row input {
    width: 100%;
    padding: .45rem .55rem;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
}

/* Footer */
.rrp__footer {
    margin-top: .75rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 1rem;
}

.rrp__sum {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    justify-content: space-between;
    width: 100%;
}

.rrp__sum span {
    flex: 1 1 auto;
    min-width: 0;
}

.rrp__sum strong {
    flex: 0 0 auto;
    white-space: nowrap;
}

.rrp__sums {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.rrp__hint {
    opacity: .75;
    font-size: .9rem;
}

.rrp__iconBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #eee;
    background: #fff;
    border-radius: 10px;
    padding: .35rem .55rem;
    cursor: pointer;
    text-decoration: none; /* 🔥 belangrijk */
    color: inherit;
}

    .rrp__iconBtn:hover {
        background: #f7f7f7;
    }

    .rrp__iconBtn svg {
        width: 18px;
        height: 18px;
        stroke-width: 2;
    }

.rrp__row--disabled {
    opacity: .55;
}

.rrp__row--disabled .rrp__descText {
    text-decoration: line-through;
}

/* Select hetzelfde als inputs */
.rrp__field select {
    width: 100%;
    padding: .55rem .65rem;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #fff;
    color: inherit;
}

/* (Optioneel) consistente dropdown pijl */
.rrp__field select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.2rem; /* ruimte voor arrow */
    background-image: linear-gradient(45deg, transparent 50%, #888 50%), linear-gradient(135deg, #888 50%, transparent 50%);
    background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

    /* Focus consistent */
    .rrp__field input:focus,
    .rrp__field select:focus {
        outline: none;
        border-color: #d0d0d0;
    }


@media (max-width: 768px) {
    .rrp__grid {
        grid-template-columns: 1fr;
    }

    .rrp__left {
        display: none;
    }

    .rrp__right {
        width: 100%;
        min-width: 0;
    }

    .rrp__meta--invoice {
        grid-template-columns: 1fr;
    }
        .rrp__row--header {
            display: none;
        }

        .rrp__items {
            overflow-x: hidden;
        }

        /* 2 kolommen: content + actions */
        .rrp__row {
            grid-template-columns: 1fr auto !important;
            grid-template-areas:
                "desc actions"
                "meta actions";
            row-gap: .25rem;
            column-gap: .75rem;
            align-items: center;
        }

            /* desc */
            .rrp__row > .rrp__cell:nth-child(1) {
                grid-area: desc;
                font-weight: 600;
            }

            /* qty links onder + 'stuks' */
            .rrp__row > .rrp__cell:nth-child(2) {
                grid-area: meta;
                justify-self: start;
                text-align: left;
                opacity: .9;
            }

                .rrp__row > .rrp__cell:nth-child(2)::after {
                    content: " stuks";
                    opacity: .7;
                }

            /* total rechts onder */
            .rrp__row > .rrp__cell:nth-child(3) {
                grid-area: meta;
                justify-self: end;
                text-align: right;
            }

            /* actions rechts gecentreerd */
            .rrp__row > .rrp__cell:nth-child(4) {
                grid-area: actions;
                align-self: center;
            }

        .rrp__cell--actions {
            display: flex;
            flex-direction: column; /* of row als je wil */
            justify-content: center;
            gap: .4rem;
        }

    .rrp__row.rrp__row--editing {
        grid-template-columns: 1fr !important;
        grid-template-areas: none !important;
        row-gap: .5rem;
    }

        /* Inputs nemen de volle breedte */
        .rrp__row.rrp__row--editing .rrp__cell {
            width: 100%;
        }

            .rrp__row.rrp__row--editing .rrp__cell input {
                width: 100%;
            }

        /* Actions (save/cancel) onderaan naast elkaar */
        .rrp__row.rrp__row--editing .rrp__cell--actions {
            display: flex;
            flex-direction: row;
            justify-content: flex-end;
            gap: .5rem;
            margin-top: .25rem;
        }

    /* Edit mode: velden onder elkaar */
    .rrp__mEdit {
        display: flex;
        flex-direction: column;
        gap: .6rem;
        width: 100%;
    }

    .rrp__mField {
        display: flex;
        flex-direction: column;
        gap: .25rem;
    }

    .rrp__mLabel {
        font-size: .85rem;
        opacity: .75;
    }

    /* Actions in edit mode: naast elkaar, rechts uitlijnen */
    .rrp__mActions--edit {
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        gap: .5rem;
        margin-top: .25rem;
    }
    }
