﻿/* ============================================================================
   Order viewer and editor dialog
   ----------------------------------------------------------------------------
   Order summary, alerts, detail grids, totals, history, actions, item table,
   footer, hover treatment, and responsive layouts.

   Source: Pasted text (3)(1).txt:1556-2346.
   ============================================================================ */

.store-order-editor-dialog {
    width: min(94rem, calc(100vw - 2rem));
    max-width: 94rem;
    max-height: calc(100dvh - 1rem);
}

    .store-order-editor-dialog .mud-dialog-content {
        max-height: calc(100dvh - 7.5rem);
        padding: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    .store-order-editor-dialog .store-order-editor-content {
        padding: clamp(1rem, 2vw, 1.5rem);
    }

    .store-order-editor-dialog .store-order-editor-card {
        min-width: 0;
        padding: 0;
    }

    .store-order-editor-dialog .store-order-editor-layout, .store-order-editor-dialog .store-order-editor-column {
        display: grid;
        min-width: 0;
    }

    .store-order-editor-dialog .store-order-editor-layout {
        gap: 1.25rem;
    }

    .store-order-editor-dialog .store-order-editor-column {
        align-content: start;
        gap: 1rem;
    }

    .store-order-editor-dialog .store-order-editor-header {
        display: grid;
        gap: 1rem;
        min-width: 0;
        padding: 1.1rem 1.2rem;
        background: var(--store-white);
        border: 1px solid var(--store-border);
        border-radius: var(--store-radius-sm);
        box-shadow: var(--store-shadow-sm);
    }

        .store-order-editor-dialog .store-order-editor-header.is-transaction-missing {
            border-color: color-mix(in srgb, var(--store-danger) 48%, var(--store-border));
            box-shadow: inset 0.25rem 0 0 var(--store-danger), var(--store-shadow-sm);
        }

    .store-order-editor-dialog .store-order-editor-header-main {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1.25rem;
        min-width: 0;
    }

    .store-order-editor-dialog .store-order-editor-title-group {
        display: flex;
        align-items: flex-start;
        gap: 0.85rem;
        min-width: 0;
    }

    .store-order-editor-dialog .store-order-editor-title-icon, .store-order-editor-dialog .store-order-editor-section-icon {
        display: grid;
        place-items: center;
        flex: 0 0 auto;
        color: var(--store-main-color);
        background: color-mix(in srgb, var(--store-main-color) 9%, var(--store-white));
        border: 1px solid color-mix(in srgb, var(--store-main-color) 20%, var(--store-border));
    }

    .store-order-editor-dialog .store-order-editor-title-icon {
        width: 2.75rem;
        height: 2.75rem;
        border-radius: 0.8rem;
    }

    .store-order-editor-dialog .store-order-editor-heading, .store-order-editor-dialog .store-order-editor-section-copy, .store-order-editor-dialog .store-order-editor-alert-copy, .store-order-editor-dialog .store-order-editor-history-copy {
        min-width: 0;
    }

    .store-order-editor-dialog .store-order-editor-title {
        margin: 0;
        color: var(--store-text-main);
        font-size: clamp(1.35rem, 2vw, 1.7rem);
        font-weight: 800;
        line-height: 1.2;
        letter-spacing: -0.025em;
        overflow-wrap: anywhere;
    }

    .store-order-editor-dialog .store-order-editor-description {
        max-width: 46rem;
        margin-top: 0.3rem;
        color: var(--store-text-secondary);
        font-size: 0.86rem;
        line-height: 1.5;
    }

    .store-order-editor-dialog .store-order-editor-header-meta {
        display: flex;
        align-items: stretch;
        gap: 0.65rem;
        flex: 0 0 auto;
    }

    .store-order-editor-dialog .store-order-editor-meta-item {
        display: grid;
        align-content: center;
        gap: 0.1rem;
        min-width: 8.5rem;
        padding: 0.55rem 0.7rem;
        background: var(--store-surface-subtle);
        border: 1px solid var(--store-divider);
        border-radius: 0.65rem;
    }

    .store-order-editor-dialog .store-order-editor-meta-label, .store-order-editor-dialog .store-order-editor-detail-label {
        color: var(--store-text-muted);
        font-size: 0.68rem;
        font-weight: 800;
        line-height: 1.3;
        text-transform: uppercase;
        letter-spacing: 0.045em;
    }

    .store-order-editor-dialog .store-order-editor-meta-value, .store-order-editor-dialog .store-order-editor-status-value {
        color: var(--store-text-main);
        font-size: 0.8rem;
        font-weight: 700;
        line-height: 1.4;
    }

    .store-order-editor-dialog .store-order-editor-status-value {
        color: var(--store-main-color);
    }

    .store-order-editor-dialog .store-order-editor-alert {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: flex-start;
        gap: 0.7rem;
        padding: 0.75rem 0.85rem;
        border: 1px solid transparent;
        border-radius: 0.7rem;
    }

    .store-order-editor-dialog .store-order-editor-alert-danger {
        color: var(--store-danger);
        background: var(--store-danger-soft);
        border-color: color-mix(in srgb, var(--store-danger) 34%, var(--store-border));
    }

    .store-order-editor-dialog .store-order-editor-alert-warning {
        color: var(--store-text-main);
        background: color-mix(in srgb, var(--store-warning, #ed6c02) 10%, var(--store-white));
        border-color: color-mix(in srgb, var(--store-warning, #ed6c02) 36%, var(--store-border));
    }

    .store-order-editor-dialog .store-order-editor-alert-icon {
        margin-top: 0.05rem;
        color: currentColor;
    }

    .store-order-editor-dialog .store-order-editor-alert-title {
        margin: 0;
        color: currentColor;
        font-weight: 800;
        line-height: 1.35;
    }

    .store-order-editor-dialog .store-order-editor-alert-description {
        margin-top: 0.15rem;
        color: var(--store-text-secondary);
        font-size: 0.8rem;
        line-height: 1.45;
    }

    .store-order-editor-dialog .store-order-editor-main-grid {
        display: grid;
        grid-template-columns: minmax(0, 1.16fr) minmax(24rem, 0.84fr);
        align-items: start;
        gap: 1rem;
        min-width: 0;
    }

    .store-order-editor-dialog .store-order-editor-section {
        min-width: 0;
        padding: 1rem;
        background: var(--store-white);
        border: 1px solid var(--store-border);
        border-radius: var(--store-radius-sm);
    }

    .store-order-editor-dialog .store-order-editor-section-heading {
        display: flex;
        align-items: flex-start;
        gap: 0.7rem;
        min-width: 0;
        margin-bottom: 1rem;
    }

    .store-order-editor-dialog .store-order-editor-section-heading-compact {
        margin-bottom: 0;
    }

    .store-order-editor-dialog .store-order-editor-section-icon {
        width: 2.2rem;
        height: 2.2rem;
        border-radius: 0.65rem;
    }

        .store-order-editor-dialog .store-order-editor-section-icon .mud-icon-root {
            font-size: 1.2rem;
        }

    .store-order-editor-dialog .store-order-editor-section-title {
        margin: 0;
        color: var(--store-text-main);
        font-size: 1rem;
        font-weight: 800;
        line-height: 1.35;
    }

    .store-order-editor-dialog .store-order-editor-section-description {
        display: block;
        margin-top: 0.15rem;
        color: var(--store-text-muted);
        font-size: 0.76rem;
        line-height: 1.45;
    }

    .store-order-editor-dialog .store-order-editor-summary-layout {
        display: grid;
        grid-template-columns: minmax(0, 1.15fr) minmax(15rem, 0.85fr);
        align-items: start;
        gap: 1rem;
        min-width: 0;
    }

    .store-order-editor-dialog .store-order-editor-detail-list {
        display: grid;
        min-width: 0;
    }

    .store-order-editor-dialog .store-order-editor-detail-row {
        display: grid;
        grid-template-columns: minmax(8.75rem, 0.72fr) minmax(0, 1.28fr);
        align-items: center;
        gap: 0.75rem;
        min-width: 0;
        min-height: 2.7rem;
        padding: 0.55rem 0;
        border-bottom: 1px solid var(--store-divider);
    }

        .store-order-editor-dialog .store-order-editor-detail-row:first-child {
            padding-top: 0;
        }

        .store-order-editor-dialog .store-order-editor-detail-row:last-child {
            padding-bottom: 0;
            border-bottom: 0;
        }

    .store-order-editor-dialog .store-order-editor-detail-row-control {
        align-items: start;
    }

    .store-order-editor-dialog .store-order-editor-detail-value, .store-order-editor-dialog .store-order-editor-detail-control {
        min-width: 0;
        color: var(--store-text-secondary);
        font-size: 0.82rem;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .store-order-editor-dialog .store-order-editor-detail-value-strong {
        color: var(--store-text-main);
        font-weight: 800;
    }

    .store-order-editor-dialog .store-order-editor-inline-field {
        width: 100%;
        margin: 0 !important;
    }

    .store-order-editor-dialog .store-order-editor-totals-card {
        display: grid;
        min-width: 0;
        padding: 0.35rem 0.85rem;
        background: var(--store-surface-subtle);
        border: 1px solid var(--store-divider);
        border-radius: 0.75rem;
    }

    .store-order-editor-dialog .store-order-editor-total-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        min-height: 2.5rem;
        color: var(--store-text-secondary);
        font-size: 0.82rem;
        border-bottom: 1px solid var(--store-divider);
    }

        .store-order-editor-dialog .store-order-editor-total-row:last-child {
            border-bottom: 0;
        }

        .store-order-editor-dialog .store-order-editor-total-row strong {
            color: var(--store-text-main);
            font-weight: 800;
            white-space: nowrap;
        }

    .store-order-editor-dialog .store-order-editor-total-row-savings strong {
        color: var(--store-main-color);
    }

    .store-order-editor-dialog .store-order-editor-total-row-grand {
        min-height: 3rem;
        color: var(--store-text-main);
        font-size: 0.95rem;
        font-weight: 800;
    }

        .store-order-editor-dialog .store-order-editor-total-row-grand strong {
            font-size: 1.05rem;
        }

    .store-order-editor-dialog .store-order-editor-field-grid, .store-order-editor-dialog .store-order-editor-refund-grid, .store-order-editor-dialog .store-order-editor-notes-grid {
        display: grid;
        min-width: 0;
        gap: 0.9rem;
    }

    .store-order-editor-dialog .store-order-editor-field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .store-order-editor-dialog .store-order-editor-field-full {
        grid-column: 1 / -1;
    }

    .store-order-editor-dialog .store-order-editor-refund-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .store-order-editor-dialog .store-order-editor-notes-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .store-order-editor-dialog .store-order-editor-refund-total {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        margin-top: 0.9rem;
        padding: 0.75rem 0.85rem;
        color: var(--store-text-main);
        background: color-mix(in srgb, var(--store-main-color) 7%, var(--store-white));
        border-left: 3px solid var(--store-main-color);
        border-radius: 0.2rem 0.7rem 0.7rem 0.2rem;
        font-size: 0.9rem;
        font-weight: 750;
    }

        .store-order-editor-dialog .store-order-editor-refund-total strong {
            font-size: 1rem;
            font-weight: 850;
            white-space: nowrap;
        }

    .store-order-editor-dialog .store-order-editor-history {
        display: grid;
        gap: 0.55rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--store-divider);
    }

    .store-order-editor-dialog .store-order-editor-history-item {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: flex-start;
        gap: 0.6rem;
        padding: 0.65rem 0.7rem;
        background: var(--store-surface-subtle);
        border: 1px solid var(--store-divider);
        border-radius: 0.65rem;
    }

    .store-order-editor-dialog .store-order-editor-history-icon {
        display: grid;
        place-items: center;
        width: 1.75rem;
        height: 1.75rem;
        color: var(--store-main-color);
    }

    .store-order-editor-dialog .store-order-editor-history-item-danger .store-order-editor-history-icon {
        color: var(--store-danger);
    }

    .store-order-editor-dialog .store-order-editor-history-title {
        margin: 0;
        color: var(--store-text-main);
        font-size: 0.8rem;
        font-weight: 800;
        line-height: 1.35;
    }

    .store-order-editor-dialog .store-order-editor-history-description {
        display: block;
        margin-top: 0.1rem;
        color: var(--store-text-muted);
        font-size: 0.72rem;
        line-height: 1.4;
    }

    .store-order-editor-dialog .store-order-editor-actions-section {
        background: var(--store-surface-subtle);
    }

    .store-order-editor-dialog .store-order-editor-action-buttons {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.55rem;
    }

    .store-order-editor-dialog .store-order-editor-action-button {
        min-height: 2.35rem;
        padding-right: 0.8rem;
        padding-left: 0.8rem;
        text-transform: none;
    }

    .store-order-editor-dialog .store-order-editor-refund-partial {
        background: var(--store-white);
    }

    .store-order-editor-dialog .store-order-editor-items-section {
        padding: 0;
        overflow: hidden;
    }

    .store-order-editor-dialog .store-order-editor-items-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        min-width: 0;
        padding: 1rem;
        background: var(--store-white);
        border-bottom: 1px solid var(--store-border);
    }

    .store-order-editor-dialog .store-order-editor-loading {
        margin: 0;
    }

    .store-order-editor-dialog .store-order-editor-items-table-wrap {
        max-height: min(34rem, 48vh);
        overflow: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    .store-order-editor-dialog .store-order-editor-items-table {
        width: 100%;
        min-width: 82rem;
        border-collapse: separate;
        border-spacing: 0;
        table-layout: fixed;
    }

        .store-order-editor-dialog .store-order-editor-items-table th, .store-order-editor-dialog .store-order-editor-items-table td {
            padding: 0.75rem;
            text-align: left;
            vertical-align: top;
            border-bottom: 1px solid var(--store-divider);
        }

        .store-order-editor-dialog .store-order-editor-items-table th {
            position: sticky;
            top: 0;
            z-index: 2;
            color: var(--store-text-secondary);
            background: var(--store-surface-subtle);
            font-size: 0.7rem;
            font-weight: 850;
            line-height: 1.3;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            white-space: nowrap;
        }

        .store-order-editor-dialog .store-order-editor-items-table td {
            color: var(--store-text-secondary);
            background: var(--store-white);
            font-size: 0.8rem;
        }

        .store-order-editor-dialog .store-order-editor-items-table tbody tr:last-child td {
            border-bottom: 0;
        }

        .store-order-editor-dialog .store-order-editor-items-table th:nth-child(1), .store-order-editor-dialog .store-order-editor-items-table td:nth-child(1) {
            width: 12%;
        }

        .store-order-editor-dialog .store-order-editor-items-table th:nth-child(2), .store-order-editor-dialog .store-order-editor-items-table td:nth-child(2) {
            width: 10%;
        }

        .store-order-editor-dialog .store-order-editor-items-table th:nth-child(3), .store-order-editor-dialog .store-order-editor-items-table td:nth-child(3) {
            width: 6%;
        }

        .store-order-editor-dialog .store-order-editor-items-table th:nth-child(4), .store-order-editor-dialog .store-order-editor-items-table td:nth-child(4) {
            width: 10%;
        }

        .store-order-editor-dialog .store-order-editor-items-table th:nth-child(5), .store-order-editor-dialog .store-order-editor-items-table td:nth-child(5) {
            width: 17%;
        }

        .store-order-editor-dialog .store-order-editor-items-table th:nth-child(6), .store-order-editor-dialog .store-order-editor-items-table td:nth-child(6) {
            width: 12%;
        }

        .store-order-editor-dialog .store-order-editor-items-table th:nth-child(7), .store-order-editor-dialog .store-order-editor-items-table td:nth-child(7) {
            width: 7%;
        }

        .store-order-editor-dialog .store-order-editor-items-table th:nth-child(8), .store-order-editor-dialog .store-order-editor-items-table td:nth-child(8) {
            width: 12%;
        }

        .store-order-editor-dialog .store-order-editor-items-table th:nth-child(9), .store-order-editor-dialog .store-order-editor-items-table td:nth-child(9) {
            width: 14%;
        }

    .store-order-editor-dialog .store-order-editor-number-column {
        text-align: right !important;
    }

    .store-order-editor-dialog .store-order-editor-item-primary, .store-order-editor-dialog .store-order-editor-item-price {
        color: var(--store-text-main);
        font-weight: 750;
        line-height: 1.4;
    }

    .store-order-editor-dialog .store-order-editor-item-price {
        white-space: nowrap;
    }

    .store-order-editor-dialog .store-order-editor-item-secondary, .store-order-editor-dialog .store-order-editor-item-status {
        display: block;
        margin-top: 0.2rem;
        color: var(--store-text-muted);
        font-size: 0.7rem;
        line-height: 1.4;
        overflow-wrap: anywhere;
    }

    .store-order-editor-dialog .store-order-editor-wrap-text {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .store-order-editor-dialog .store-order-editor-item-cancelled {
        margin-top: 0.45rem;
        padding-top: 0.45rem;
        color: var(--store-danger);
        border-top: 1px solid color-mix(in srgb, var(--store-danger) 30%, var(--store-divider));
    }

    .store-order-editor-dialog .store-order-editor-item-status-title {
        color: var(--store-danger);
        font-size: 0.7rem;
        font-weight: 800;
        line-height: 1.35;
    }

    .store-order-editor-dialog .store-order-editor-item-actions {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.35rem;
        min-width: 0;
    }

    .store-order-editor-dialog .store-order-editor-item-action {
        max-width: 100%;
        height: auto;
        min-height: 1.8rem;
        white-space: normal;
    }

    .store-order-editor-dialog .mud-dialog-actions {
        position: relative;
        z-index: 3;
        flex: 0 0 auto;
        padding: 0;
        background: var(--store-white);
        border-top: 1px solid var(--store-border);
    }

    .store-order-editor-dialog .store-order-editor-footer {
        width: 100%;
        padding: 0.9rem clamp(1rem, 2vw, 1.5rem);
    }

    .store-order-editor-dialog .store-order-editor-receipt-button {
        margin-right: auto;
    }

@media (hover: hover) and (pointer: fine) {
    .store-order-editor-dialog .store-order-editor-items-table tbody tr:hover td {
        background: color-mix(in srgb, var(--store-main-color) 3%, var(--store-white));
    }
}

@media screen and (max-width: 1199.98px) {
    .store-order-editor-dialog .store-order-editor-main-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .store-order-editor-dialog .store-order-editor-refund-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media screen and (max-width: 899.98px) {
    .store-order-editor-dialog .store-order-editor-header-main {
        align-items: stretch;
        flex-direction: column;
    }

    .store-order-editor-dialog .store-order-editor-header-meta {
        width: 100%;
    }

    .store-order-editor-dialog .store-order-editor-meta-item {
        flex: 1 1 0;
    }

    .store-order-editor-dialog .store-order-editor-summary-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media screen and (max-width: 600px) {
    .store-order-editor-dialog {
        width: 100vw;
        max-width: 100vw;
        max-height: 100dvh;
        margin: 0;
        border: 0;
        border-radius: 0;
    }

        .store-order-editor-dialog .mud-dialog-content {
            max-height: calc(100dvh - 11rem);
        }

        .store-order-editor-dialog .store-order-editor-content {
            padding: 0.85rem;
        }

        .store-order-editor-dialog .store-order-editor-card {
            padding: 0;
        }

        .store-order-editor-dialog .store-order-editor-header, .store-order-editor-dialog .store-order-editor-section {
            padding: 0.9rem;
        }

        .store-order-editor-dialog .store-order-editor-title-group {
            gap: 0.65rem;
        }

        .store-order-editor-dialog .store-order-editor-title-icon {
            width: 2.4rem;
            height: 2.4rem;
        }

        .store-order-editor-dialog .store-order-editor-title {
            font-size: 1.25rem;
        }

        .store-order-editor-dialog .store-order-editor-header-meta {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
        }

        .store-order-editor-dialog .store-order-editor-detail-row {
            grid-template-columns: minmax(0, 1fr);
            gap: 0.25rem;
        }

        .store-order-editor-dialog .store-order-editor-field-grid, .store-order-editor-dialog .store-order-editor-refund-grid {
            grid-template-columns: minmax(0, 1fr);
        }

        .store-order-editor-dialog .store-order-editor-field-full {
            grid-column: auto;
        }

        .store-order-editor-dialog .store-order-editor-items-heading {
            align-items: flex-start;
            flex-direction: column;
        }

        .store-order-editor-dialog .store-order-editor-action-buttons {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
        }

        .store-order-editor-dialog .store-order-editor-action-button {
            width: 100%;
        }

        .store-order-editor-dialog .store-order-editor-footer {
            gap: 0.55rem;
            padding: 0.75rem 0.85rem;
        }

        .store-order-editor-dialog .store-order-editor-receipt-button {
            margin-right: 0;
        }
}
