/* MaxDTF Mixed Upload 0.2.1-alpha — metraż i formatki na jednej karcie produktu. */

/* Do koszyka dodaje podsumowanie — przycisk i pole ilości WooCommerce znikają (klasa ustawiana przez mixed.js). */
.maxdtf-mixed-active form.cart .single_add_to_cart_button,
.maxdtf-mixed-active form.cart button[name="add-to-cart"],
.maxdtf-mixed-active form.cart .quantity {
    display: none !important;
}

.maxdtf-mixed-open {
    overflow: hidden;
}

/* ---------------------------------------------------------------- panel na karcie */

.maxdtf-mixed-panel {
    margin: 14px 0 16px;
    display: grid;
    gap: 10px;
}

.maxdtf-mixed-rule {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 9px;
    background: #f5f7fb;
    border: 1px solid rgba(15, 23, 42, .08);
    font-size: 13px;
    line-height: 1.45;
}

.maxdtf-mixed-rule strong {
    font-size: 14px;
}

.maxdtf-mixed-list[hidden],
.maxdtf-mixed-summary-open[hidden],
.maxdtf-mixed-notes[hidden],
.maxdtf-mixed-previews[hidden],
.maxdtf-mixed-errors[hidden],
.maxdtf-mixed-modal[hidden],
.maxdtf-mixed-probe[hidden] {
    display: none !important;
}

.maxdtf-mixed-list {
    display: grid;
    gap: 10px;
}

.maxdtf-mixed-list-group {
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 9px;
    padding: 10px 12px;
    background: #fff;
}

.maxdtf-mixed-list-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
}

.maxdtf-mixed-list-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.maxdtf-mixed-list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    font-size: 13px;
    line-height: 1.35;
    padding: 4px 0;
    border-top: 1px dashed rgba(15, 23, 42, .08);
}

.maxdtf-mixed-list-item:first-child {
    border-top: 0;
}

.maxdtf-mixed-list-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.maxdtf-mixed-list-meta {
    opacity: .75;
    grid-column: 1;
}

.maxdtf-mixed-list-state {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font-size: 12px;
    white-space: nowrap;
}

.maxdtf-mixed-list-item.is-error .maxdtf-mixed-list-state,
.maxdtf-mixed-list-item.is-changed .maxdtf-mixed-list-state {
    color: #b42318;
    font-weight: 600;
}

.maxdtf-mixed-list-item.is-done .maxdtf-mixed-list-state {
    color: #15803d;
}

.maxdtf-mixed-panel-status:empty {
    display: none;
}

.maxdtf-mixed-panel-status {
    font-size: 13px;
    color: #92400e;
}

.maxdtf-mixed-summary-open {
    width: 100%;
    min-height: 50px;
    font-size: 17px !important;
}

/* ---------------------------------------------------------------- okna uploaderów (tryb Mixed) */

.maxdtf-mixed-group-label {
    display: inline-block;
    margin: 0 0 6px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    background: #e0e7ff;
    color: #3730a3;
}

.maxdtf-mixed-group-label.is-formatki {
    background: #dcfce7;
    color: #166534;
}

.maxdtf-mixed-group-label[hidden],
.maxdtf-mixed-reroute-note[hidden] {
    display: none !important;
}

.maxdtf-mixed-reroute-note {
    margin-top: 10px;
    padding: 9px 11px;
    border-radius: 8px;
    background: #fff7e6;
    border: 1px solid #ead6a0;
    color: #5c3d00;
    font-size: 13px;
    line-height: 1.4;
}

/* ---------------------------------------------------------------- pomiar plików */

.maxdtf-mixed-probe {
    position: fixed;
    inset: 0;
    z-index: 2147483640;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .45);
    padding: 16px;
}

.maxdtf-mixed-probe-box {
    display: grid;
    justify-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 12px;
    padding: 22px 26px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}

.maxdtf-mixed-probe-text {
    font-size: 13px;
    opacity: .75;
    word-break: break-word;
}

.maxdtf-mixed-spinner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid rgba(15, 23, 42, .15);
    border-top-color: #2563eb;
    animation: maxdtf-mixed-spin .8s linear infinite;
}

@keyframes maxdtf-mixed-spin {
    to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------------- podsumowanie */

.maxdtf-mixed-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483640;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.maxdtf-mixed-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .55);
}

.maxdtf-mixed-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(920px, 100%);
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    background: #fff;
    color: #111827;
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
    overflow: hidden;
    outline: none;
}

.maxdtf-mixed-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, .06);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
}

.maxdtf-mixed-scroll {
    overflow: auto;
    padding: 22px 24px 12px;
}

.maxdtf-mixed-title {
    margin: 0 44px 6px 0;
    font-size: 22px;
    line-height: 1.25;
}

.maxdtf-mixed-lead {
    margin: 0 0 14px;
    font-size: 14px;
    opacity: .8;
}

.maxdtf-mixed-notes {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 9px;
    background: #fff7e6;
    border: 1px solid #ead6a0;
    color: #5c3d00;
    font-size: 13px;
}

.maxdtf-mixed-notes ul {
    margin: 6px 0 0 18px;
    padding: 0;
}

.maxdtf-mixed-section {
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 11px;
    margin: 0 0 14px;
    overflow: hidden;
}

.maxdtf-mixed-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    padding: 10px 14px;
    background: #eef2ff;
}

.maxdtf-mixed-section.is-formatki .maxdtf-mixed-section-head {
    background: #ecfdf3;
}

.maxdtf-mixed-section-head strong {
    font-size: 15px;
}

.maxdtf-mixed-section-head span {
    font-size: 13px;
    opacity: .7;
}

.maxdtf-mixed-rows {
    list-style: none;
    margin: 0;
    padding: 0;
}

.maxdtf-mixed-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto 110px 32px;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid rgba(15, 23, 42, .07);
}

.maxdtf-mixed-rows .maxdtf-mixed-row:first-child {
    border-top: 0;
}

.maxdtf-mixed-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, .1);
    background-color: #f2f3f5;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.maxdtf-mixed-row-main {
    min-width: 0;
}

.maxdtf-mixed-row-name {
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.maxdtf-mixed-row-meta {
    font-size: 12px;
    opacity: .75;
    margin-top: 2px;
}

.maxdtf-mixed-row-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-top: 4px;
    font-size: 12px;
}

.maxdtf-mixed-row-state progress {
    width: 110px;
    height: 7px;
}

.maxdtf-mixed-row.is-done .maxdtf-mixed-row-state-label {
    color: #15803d;
    font-weight: 600;
}

.maxdtf-mixed-row.is-error .maxdtf-mixed-row-state-label,
.maxdtf-mixed-row.is-changed .maxdtf-mixed-row-state-label,
.maxdtf-mixed-row-error {
    color: #b42318;
    font-weight: 600;
}

.maxdtf-mixed-copies {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.maxdtf-mixed-copy-btn {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(15, 23, 42, .18);
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: inherit;
}

.maxdtf-mixed-copy-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.maxdtf-mixed-copy-input {
    width: 60px !important;
    height: 30px;
    text-align: center;
    padding: 2px 4px !important;
}

.maxdtf-mixed-copy-unit {
    font-size: 12px;
    opacity: .7;
}

.maxdtf-mixed-row-price {
    display: grid;
    justify-items: end;
    gap: 2px;
    font-size: 12px;
}

.maxdtf-mixed-row-line {
    font-size: 14px;
}

.maxdtf-mixed-remove {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: rgba(180, 35, 24, .08);
    color: #b42318;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.maxdtf-mixed-remove:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.maxdtf-mixed-link {
    border: 0;
    background: none;
    padding: 0;
    color: #1d4ed8;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

.maxdtf-mixed-resume {
    margin: 10px 14px 0;
    padding: 10px 12px;
    border-radius: 9px;
    background: #fff7e6;
    border: 1px solid #ead6a0;
    font-size: 13px;
}

.maxdtf-mixed-resume p {
    margin: 0 0 8px;
}

.maxdtf-mixed-resume-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.maxdtf-mixed-section-foot {
    display: grid;
    gap: 3px;
    padding: 10px 14px 12px;
    border-top: 1px solid rgba(15, 23, 42, .07);
    background: #fafafa;
    font-size: 13px;
}

.maxdtf-mixed-section-line.is-error {
    color: #b42318;
    font-weight: 600;
}

.maxdtf-mixed-section-total {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 15px;
    margin-top: 4px;
}

.maxdtf-mixed-previews {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 13px;
    margin: 4px 0 6px;
    cursor: pointer;
}

.maxdtf-mixed-previews input {
    margin-top: 3px;
}

.maxdtf-mixed-footer {
    display: grid;
    gap: 8px;
    padding: 12px 24px 18px;
    border-top: 1px solid rgba(15, 23, 42, .1);
    background: #fff;
}

.maxdtf-mixed-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 16px;
}

.maxdtf-mixed-total strong {
    font-size: 22px;
    text-align: right;
}

/* 0.2.5: sklep z cenami bez podatku — suma netto, a kwota brutto mniejszym pismem pod spodem. */
.maxdtf-mixed-total-gross {
    display: block;
    font-size: 13px;
    font-weight: 400;
    opacity: .75;
}

.maxdtf-mixed-status {
    font-size: 13px;
    color: #92400e;
}

.maxdtf-mixed-status:empty {
    display: none;
}

.maxdtf-mixed-errors {
    padding: 9px 11px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 13px;
    display: grid;
    gap: 4px;
}

.maxdtf-mixed-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.maxdtf-mixed-add {
    min-height: 48px;
    font-size: 17px !important;
    flex: 1 1 260px;
}

.maxdtf-mixed-more {
    min-height: 48px;
}

.maxdtf-mixed-add:disabled {
    opacity: .55;
    cursor: not-allowed;
}

@media (max-width: 700px) {
    .maxdtf-mixed-modal {
        padding: 0;
        align-items: stretch;
    }

    .maxdtf-mixed-dialog {
        max-height: 100vh;
        max-height: 100dvh;
        height: 100%;
        border-radius: 0;
    }

    .maxdtf-mixed-scroll {
        padding: 16px 16px 10px;
    }

    .maxdtf-mixed-footer {
        padding: 10px 16px 14px;
    }

    /*
     * 0.2.5: cena wiersza dostaje całą resztę szerokości obok licznika kopii. Dotąd stała w kolumnie 32 px
     * przycisku „usuń” i wychodziła poza wiersz (ucięta z prawej) — przy dłuższym opisie („… / szt. netto”)
     * było to wyraźnie widać. Teraz dłuższy opis zawija się do prawej.
     */
    .maxdtf-mixed-row {
        grid-template-columns: 48px auto minmax(0, 1fr) 32px;
        grid-template-areas:
            "thumb main main remove"
            "copies copies price price";
        row-gap: 8px;
        padding: 10px 12px;
    }

    .maxdtf-mixed-thumb { grid-area: thumb; width: 48px; height: 48px; }
    .maxdtf-mixed-row-main { grid-area: main; }
    .maxdtf-mixed-remove { grid-area: remove; }
    .maxdtf-mixed-copies { grid-area: copies; justify-self: start; }
    .maxdtf-mixed-row-price { grid-area: price; min-width: 0; text-align: right; }

    .maxdtf-mixed-actions {
        flex-direction: column-reverse;
    }

    .maxdtf-mixed-add,
    .maxdtf-mixed-more {
        width: 100%;
        flex: 0 0 auto;
    }
}

/* 0.1.2: globalny pasek wysyłki (podsumowanie i karta produktu). */
.maxdtf-mixed-progress {
    display: grid;
    gap: 4px;
    padding: 9px 11px;
    border-radius: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    font-size: 13px;
}

.maxdtf-mixed-progress[hidden] {
    display: none;
}

.maxdtf-mixed-progress-title {
    font-weight: 600;
}

.maxdtf-mixed-progress progress {
    width: 100%;
    height: 10px;
    accent-color: #2563eb;
}

.maxdtf-mixed-progress-text {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2px 12px;
}

.maxdtf-mixed-progress-speed {
    font-variant-numeric: tabular-nums;
}

/* 0.1.3: pasek zapisu miniatur po kliknięciu „Dodaj do koszyka”. */
.maxdtf-mixed-progress.is-previews {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #14532d;
}

.maxdtf-mixed-progress.is-previews progress {
    accent-color: #16a34a;
}

.maxdtf-mixed-progress-slot {
    display: grid;
    gap: 8px;
}

.maxdtf-mixed-progress-slot:empty {
    display: none;
}

/* 0.1.4: liczba kopii wyśrodkowana względem −/+ — motyw sklepu dokłada polom margines i własną wysokość. */
.maxdtf-mixed-copies {
    align-items: center !important;
}

.maxdtf-mixed-copies > .maxdtf-mixed-copy-btn,
.maxdtf-mixed-copies > .maxdtf-mixed-copy-input {
    box-sizing: border-box !important;
    height: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    vertical-align: middle !important;
    align-self: center !important;
}

.maxdtf-mixed-copies > .maxdtf-mixed-copy-btn {
    width: 36px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.maxdtf-mixed-copies > .maxdtf-mixed-copy-input {
    line-height: 34px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* 0.1.4: pełna nazwa pliku — dymek po najechaniu (title), po dotknięciu nazwa się rozwija. */
.maxdtf-mixed-row-name,
.maxdtf-mixed-list-name {
    cursor: help;
}

.maxdtf-mixed-row-name.is-expanded,
.maxdtf-mixed-list-name.is-expanded {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* 0.1.4: zachęta progu w podsumowaniu (metraż i formatki) — pogrubiona, z przyciskiem. */
.maxdtf-mixed-tier {
    display: grid;
    gap: 8px;
    margin: 6px 0 4px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.maxdtf-mixed-tier.is-below {
    background-color: #fff7e6;
    border: 1px solid #ead6a0;
    color: #5c3d00;
}

.maxdtf-mixed-tier.is-best {
    background-color: #ecfdf3;
    border: 1px solid #a6e3bd;
    color: #14532d;
}

.maxdtf-mixed-tier-button {
    justify-self: start;
    margin: 0 !important;
    padding: 8px 14px !important;
    border-radius: 6px !important;
    background-color: #fff !important;
    border: 1px solid currentColor !important;
    color: inherit !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    cursor: pointer;
}

.maxdtf-mixed-tier-button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* 0.2.1: panel Mixed pod uploaderem na pełną szerokość — niezależnie od motywu (Betheme: form.cart { display:flex }). */
.woocommerce form.cart:has(> .maxdtf-mixed-panel) {
    flex-wrap: wrap;
    align-items: flex-start;
}

.woocommerce form.cart > .maxdtf-mixed-panel,
form.cart > .maxdtf-mixed-panel {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
}

/* 0.2.1: pliki dodane na innej karcie (punkt B). */
.maxdtf-mixed-foreign {
    display: grid;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background-color: #fff7e6;
    border: 1px solid #ead6a0;
    color: #5c3d00;
    font-size: 13px;
}

.maxdtf-mixed-foreign-text {
    margin: 0;
}

.maxdtf-mixed-foreign-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.maxdtf-mixed-foreign-actions .button {
    margin: 0 !important;
    padding: 7px 12px !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    border-radius: 6px !important;
}

/* 0.2.1: pytanie przy zamykaniu podsumowania z plikami (punkt A). */
.maxdtf-mixed-dialog {
    position: relative;
}

.maxdtf-mixed-confirm {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .45);
    border-radius: inherit;
}

.maxdtf-mixed-confirm[hidden] {
    display: none;
}

.maxdtf-mixed-confirm-box {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .25);
}

.maxdtf-mixed-confirm-title {
    margin: 0 0 6px;
    font-size: 18px;
}

.maxdtf-mixed-confirm-text {
    margin: 0 0 14px;
    font-size: 14px;
    opacity: .8;
}

.maxdtf-mixed-confirm-actions {
    display: grid;
    gap: 8px;
}

.maxdtf-mixed-confirm-actions .button {
    width: 100%;
    margin: 0 !important;
    text-align: center;
}

.maxdtf-mixed-confirm-drop {
    color: #b42318 !important;
    border-color: #f1b8b3 !important;
    background: #fff !important;
}
