﻿.apparel-receipt {
    --receipt-green: var(--apparel-green);
    --receipt-green-dark: #004d2a;
    --receipt-green-soft: #d5dfd5;
    --receipt-green-pale: #eef3ee;
    --receipt-tan: var(--apparel-tan);
    --receipt-tan-soft: #ece6da;
    --receipt-ink: #1d2a23;
    --receipt-muted: #667069;
    --receipt-border: #d8ddd8;
    --receipt-divider: var(--apparel-divider);
    width: 100%;
    min-width: 0;
    color: var(--receipt-ink);
    background: var(--apparel-surface);
}

    .apparel-receipt,
    .apparel-receipt * {
        box-sizing: border-box;
    }

/* Receipt header */

.receipt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.2rem;
    background: linear-gradient( 135deg, rgba(213, 223, 213, 0.9), rgba(255, 255, 255, 0.95));
    border-bottom: 1px solid rgba(0, 104, 56, 0.15);
}

.receipt-header-title {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.75rem;
}

.receipt-header-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 2.8rem;
    color: var(--apparel-on-primary);
    background: linear-gradient( 145deg, var(--receipt-green), var(--receipt-green-dark));
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0.8rem;
    box-shadow: 0 0.35rem 0.75rem rgba(0, 104, 56, 0.23);
}

.receipt-title {
    margin: 0;
    color: var(--receipt-ink);
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.receipt-subtitle {
    display: block;
    margin-top: 0.1rem;
    color: var(--receipt-muted);
}

.receipt-order-number {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    padding: 0.45rem 0.7rem;
    color: var(--receipt-muted);
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 104, 56, 0.12);
    border-radius: 0.7rem;
    font-size: 0.72rem;
    line-height: 1.2;
}

    .receipt-order-number strong {
        margin-top: 0.15rem;
        color: var(--receipt-green-dark);
        font-size: 0.95rem;
        font-weight: 900;
    }

/* Company */

.receipt-company-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.5rem;
    padding: 1.35rem 1.2rem;
    border-bottom: 1px solid var(--receipt-divider);
}

.receipt-logo-area {
    min-width: 0;
}

.receipt-logo,
.receipt-logo img {
    display: block;
    width: auto !important;
    max-width: min(100%, 24rem) !important;
    height: auto !important;
    max-height: 6rem !important;
    object-fit: contain;
    object-position: left center;
}

.receipt-company-address {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin: 0;
    color: var(--receipt-muted);
    font-style: normal;
    line-height: 1.45;
    text-align: right;
}

.receipt-company-name {
    margin-bottom: 0.25rem;
    color: var(--receipt-ink);
    font-weight: 900;
}

.receipt-company-link {
    color: var(--receipt-green-dark);
    font-size: 0.875rem;
    font-weight: 700;
    overflow-wrap: anywhere;
    text-decoration: none;
}

    .receipt-company-link:hover {
        text-decoration: underline;
    }

/* Customer and totals */

.receipt-details-section {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.9fr);
    gap: 0;
    border-bottom: 1px solid var(--receipt-divider);
}

.receipt-customer-section,
.receipt-summary-section {
    min-width: 0;
    padding: 1.25rem 1.2rem;
}

.receipt-summary-section {
    border-left: 1px solid var(--receipt-divider);
}

.receipt-section-heading {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.8rem;
}

.receipt-section-icon {
    flex: 0 0 auto;
    color: var(--receipt-green);
}

.receipt-section-title {
    color: var(--receipt-ink);
    font-weight: 900;
    line-height: 1.25;
}

.receipt-section-subtitle {
    display: block;
    margin-top: 0.05rem;
    color: var(--receipt-muted);
}

.receipt-customer-details {
    color: var(--receipt-muted);
    line-height: 1.5;
}

.receipt-customer-name {
    margin-bottom: 0.25rem;
    color: var(--receipt-ink);
    font-weight: 850;
}

.receipt-contact-list {
    display: grid;
    gap: 0.3rem;
    margin-top: 0.8rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--receipt-divider);
}

.receipt-contact-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

    .receipt-contact-row .mud-icon-root {
        flex: 0 0 auto;
        color: var(--receipt-green);
    }

    .receipt-contact-row .mud-typography {
        min-width: 0;
        color: var(--receipt-muted);
        overflow-wrap: anywhere;
    }

/* Summary */

.receipt-summary-list {
    display: grid;
}

.receipt-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 2.7rem;
    color: var(--receipt-muted);
    border-bottom: 1px solid var(--receipt-divider);
}

    .receipt-summary-row strong {
        flex: 0 0 auto;
        color: var(--receipt-green-dark);
        font-weight: 850;
        white-space: nowrap;
    }

.receipt-summary-total {
    min-height: 3.1rem;
    margin-top: 0.3rem;
    padding: 0.7rem 0.75rem;
    color: var(--receipt-green-dark);
    background: var(--receipt-green-pale);
    border-bottom: 0;
    border-radius: 0.6rem;
    font-weight: 850;
}

    .receipt-summary-total strong {
        font-size: 1.15rem;
        font-weight: 950;
    }

/* Items */

.receipt-items-section {
    padding: 1.25rem 1.2rem;
}

.receipt-items-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.receipt-items-eyebrow {
    color: var(--receipt-green-dark);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.receipt-items-title {
    margin-top: 0.1rem;
    color: var(--receipt-ink);
    font-weight: 900;
    letter-spacing: -0.02em;
}

.receipt-item-count {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 2rem;
    padding: 0.35rem 0.65rem;
    color: var(--receipt-green-dark);
    background: var(--receipt-green-pale);
    border: 1px solid var(--receipt-green-soft);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.receipt-items-table {
    overflow: hidden;
    background: var(--apparel-surface);
    border: 1px solid var(--receipt-border);
    border-radius: 0.8rem;
}

.receipt-table-header,
.receipt-table-row {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) minmax(12rem, 1.35fr) minmax(12rem, 1.25fr) minmax(6rem, 0.5fr);
}

.receipt-table-header {
    color: var(--receipt-ink);
    background: linear-gradient( 135deg, var(--receipt-green-pale), #f9fbf9);
    border-bottom: 1px solid var(--receipt-border);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

    .receipt-table-header > div {
        padding: 0.8rem 0.85rem;
    }

.receipt-price-heading {
    text-align: right;
}

.receipt-table-row {
    border-bottom: 1px solid var(--receipt-divider);
}

    .receipt-table-row:last-child {
        border-bottom: 0;
    }

    .receipt-table-row:hover {
        background: #fafcfb;
    }

.receipt-table-cell {
    min-width: 0;
    padding: 0.9rem 0.85rem;
    color: var(--receipt-muted);
    border-right: 1px solid #edf0ed;
    overflow-wrap: anywhere;
}

    .receipt-table-cell:last-child {
        border-right: 0;
    }

.receipt-gallery-name,
.receipt-student-name {
    color: var(--receipt-ink);
    font-weight: 850;
}

.receipt-student-cell {
    display: grid;
    align-content: start;
    gap: 0.15rem;
}

.receipt-detail-text {
    display: block;
    color: var(--receipt-muted);
    line-height: 1.4;
}

.receipt-product-cell {
    background: transparent;
}

.receipt-price-cell {
    text-align: right;
}

.receipt-item-price {
    color: var(--receipt-green-dark);
    font-weight: 900;
    white-space: nowrap;
}

/* Notices */

.receipt-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0 1.2rem 1rem;
    padding: 0.8rem 0.9rem;
    line-height: 1.45;
    border-radius: 0.6rem;
}

    .receipt-notice .mud-icon-root {
        flex: 0 0 auto;
        margin-top: 0.05rem;
    }

.receipt-school-notice {
    color: var(--receipt-green-dark);
    background: var(--receipt-green-pale);
    border-left: 0.25rem solid var(--receipt-green);
}

.receipt-gallery-notice {
    color: #574c38;
    background: var(--receipt-tan-soft);
    border-left: 0.25rem solid var(--receipt-tan);
}

/* Tablet */

@media (max-width: 959.98px) {
    .receipt-details-section {
        grid-template-columns: 1fr;
    }

    .receipt-summary-section {
        border-top: 1px solid var(--receipt-divider);
        border-left: 0;
    }
}

/* Phone */

@media (max-width: 699.98px) {
    .receipt-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .receipt-order-number {
        align-items: flex-start;
    }

    .receipt-company-section {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding-inline: 0.9rem;
    }

    .receipt-company-address {
        align-items: flex-start;
        text-align: left;
    }

    .receipt-logo,
    .receipt-logo img {
        max-width: 100% !important;
        max-height: 5rem !important;
    }

    .receipt-customer-section,
    .receipt-summary-section {
        padding: 1rem 0.9rem;
    }

    .receipt-items-section {
        padding: 1rem 0.75rem;
    }

    .receipt-items-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.45rem;
    }

    .receipt-table-header {
        display: none;
    }

    .receipt-table-body {
        display: grid;
        gap: 0.65rem;
        padding: 0.65rem;
        background: #f8faf8;
    }

    .receipt-table-row {
        display: block;
        overflow: hidden;
        background: var(--apparel-surface);
        border: 1px solid var(--receipt-border);
        border-radius: 0.65rem;
    }

    .receipt-table-cell {
        display: grid;
        grid-template-columns: minmax(6rem, 0.4fr) minmax(0, 1fr);
        gap: 0.7rem;
        padding: 0.7rem;
        border-right: 0;
        border-bottom: 1px solid var(--receipt-divider);
        text-align: left;
    }

        .receipt-table-cell:last-child {
            border-bottom: 0;
        }

        .receipt-table-cell::before {
            color: var(--receipt-muted);
            content: attr(data-label);
            font-size: 0.68rem;
            font-weight: 850;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

    .receipt-student-cell {
        display: grid;
        grid-template-columns: minmax(6rem, 0.4fr) minmax(0, 1fr);
    }

        .receipt-student-cell::before {
            grid-row: 1 / 20;
        }

    .receipt-price-cell {
        text-align: left;
    }

    .receipt-notice {
        margin-inline: 0.75rem;
    }
}

@media (max-width: 399.98px) {
    .receipt-table-cell,
    .receipt-student-cell {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

        .receipt-student-cell::before {
            grid-row: auto;
        }
}

/* Print */

@media print {
    .apparel-receipt {
        color: #000;
        background: var(--apparel-surface);
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .receipt-header,
    .receipt-company-section,
    .receipt-details-section,
    .receipt-items-table,
    .receipt-table-row,
    .receipt-notice {
        break-inside: avoid;
    }

        .receipt-table-row:hover {
            background: transparent;
        }

    .receipt-details-section {
        grid-template-columns: 1.1fr 0.9fr;
    }

    .receipt-summary-section {
        border-top: 0;
        border-left: 1px solid var(--receipt-divider);
    }

    .receipt-table-header,
    .receipt-table-row {
        grid-template-columns: 1fr 1.35fr 1.25fr 0.5fr;
    }

    .receipt-table-header {
        display: grid;
    }

    .receipt-table-body {
        display: block;
        padding: 0;
        background: transparent;
    }

    .receipt-table-row {
        display: grid;
        border-radius: 0;
    }

    .receipt-table-cell {
        display: block;
        padding: 0.55rem;
        border-right: 1px solid #d8ddd8;
        border-bottom: 0;
    }

        .receipt-table-cell::before {
            display: none;
        }

    .receipt-price-cell {
        text-align: right;
    }

    .receipt-company-link {
        color: #000;
        text-decoration: none;
    }
}
