/**
 * Cart, billing, order confirmation, receipt, and my account.
 * Scoped to .commerce-page so header and footer buttons stay unchanged.
 * Tokens: actex-variables.css (loaded by site.css).
 */

body.cart-cart,
body.billing-index,
body.order-confirmation,
body.order-receipt,
body.profile-index,
body.profile-updatepassword {
    background: var(--wave-bg);
}

.commerce-page {
    flex: 1 0 auto;
    background: var(--wave-bg);
    color: var(--slate-grey);
    padding: 0 0 240px;
}

.commerce-page .small-text,
.commerce-page .medium-text,
.commerce-page .large-text {
    font-size: var(--text-base) !important;
    line-height: 1.5 !important;
}

.commerce-page .large-text,
.commerce-page h1.commerce-title,
.commerce-page h2.commerce-title {
    font-family: var(--font-display) !important;
    font-size: var(--text-2xl) !important;
    font-weight: 400 !important;
    line-height: 1.25 !important;
    color: var(--navy);
}

.commerce-page h2.commerce-title.commerce-title-sm {
    font-size: var(--text-xl) !important;
}

.commerce-summary-head .commerce-title {
    margin-bottom: 0;
}

.commerce-shell {
    max-width: 72rem;
    margin: 0 auto;
}

.commerce-shell-narrow {
    max-width: 52rem;
}

.commerce-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
    gap: 1.5rem;
    align-items: start;
}

.commerce-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 48rem;
}

.commerce-shell-narrow .commerce-stack {
    max-width: none;
}

.commerce-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    box-shadow: 0 8px 14px var(--shadow-subtle);
    padding: 1.75rem;
}

.commerce-panel {
    background: var(--grey-50);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.commerce-panel-head,
.commerce-summary-head,
.commerce-line-actions,
.order-card-main,
.order-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.commerce-title {
    font-family: var(--font-display) !important;
    font-size: var(--text-2xl) !important;
    font-weight: 400 !important;
    line-height: 1.25 !important;
    color: var(--navy);
    margin: 0 0 1.25rem;
}

.commerce-title-sm {
    font-size: var(--text-xl) !important;
    margin-bottom: 1rem;
}

.commerce-page h2.commerce-kicker,
.commerce-kicker {
    margin: 1.25rem 0 0.5rem;
    font-family: var(--font-body) !important;
    font-size: var(--text-sm) !important;
    font-weight: 600 !important;
    letter-spacing: var(--tracking-wide-sm);
    text-transform: uppercase;
    line-height: 1.3 !important;
    color: var(--aqua);
}

.commerce-card > .commerce-kicker:first-child,
.commerce-card > h2.commerce-kicker:first-child,
.commerce-fields > .commerce-kicker:first-child,
.commerce-title + h2.commerce-kicker {
    margin-top: 0;
}

.commerce-copy,
.commerce-note,
.commerce-empty {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--slate-grey);
    margin: 0;
}

.commerce-note,
.commerce-caption {
    font-size: var(--text-sm);
    color: var(--grey-muted);
}

.commerce-link {
    font-family: var(--font-body) !important;
    font-size: var(--text-sm) !important;
    font-weight: 600;
    color: var(--aqua) !important;
    text-decoration: none;
}

.commerce-link:hover {
    text-decoration: underline;
}

.commerce-fields {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    width: 100%;
}

.commerce-label {
    display: block;
    margin-bottom: 0.35rem;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.25;
    color: var(--slate-grey);
}

.commerce-page .form-control,
.commerce-page .form-select {
    font-family: var(--font-body) !important;
    font-size: var(--text-base) !important;
    line-height: 1.5 !important;
    color: var(--slate-grey);
    background: var(--white);
    border: 2px solid var(--grey-200);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.commerce-page .form-control:hover,
.commerce-page .form-control:focus,
.commerce-page .form-select:hover,
.commerce-page .form-select:focus {
    border-color: var(--aqua);
    box-shadow: 0 0 0 3px var(--aqua-shadow);
}

.commerce-page .form-check-label,
.commerce-page .form-check-label a {
    font-family: var(--font-body) !important;
    font-size: var(--text-sm) !important;
    line-height: 1.5 !important;
    color: var(--slate-grey);
}

.commerce-page .form-check-input:checked {
    background-color: var(--aqua);
    border-color: var(--aqua);
}

.commerce-page .form-check-input:focus {
    border-color: var(--aqua);
    box-shadow: 0 0 0 3px var(--aqua-shadow);
}

.commerce-pay-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.commerce-pay-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin: 0;
    padding: 0.75rem 1rem;
    background: var(--white);
    border: 2px solid var(--grey-200);
    border-radius: 12px;
    cursor: pointer;
}

.commerce-pay-option:hover,
.commerce-pay-option:focus-within {
    border-color: var(--aqua);
}

.commerce-pay-option:has(input:checked) {
    border-color: var(--aqua);
    background: var(--aqua-lighter);
    box-shadow: 0 0 0 3px var(--aqua-shadow);
}

.commerce-pay-option .form-check-input {
    margin: 0;
    flex: 0 0 auto;
}

.commerce-pay-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    font-size: var(--text-base);
    color: var(--slate-grey);
}

.commerce-pay-mark svg,
.commerce-pay-mark img {
    flex: 0 0 auto;
    max-height: 32px;
    width: auto;
}

.commerce-lines {
    display: flex;
    flex-direction: column;
}

.commerce-line {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

.commerce-line:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.commerce-line-media {
    flex: 0 0 5.5rem;
    width: 5.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.commerce-line-media img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.commerce-line-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.commerce-line-title {
    margin: 0;
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1.4;
    color: var(--navy);
}

.commerce-line-price {
    margin: 0;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--slate-grey);
}

.commerce-qty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.commerce-qty .commerce-label {
    display: inline;
    margin: 0;
}

.commerce-qty .form-select {
    width: auto;
    min-width: 4.5rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.commerce-totals {
    width: 100%;
    margin: 0.5rem 0 0;
    border-collapse: collapse;
}

.commerce-totals td {
    padding: 0.45rem 0;
    font-size: var(--text-base);
    color: var(--slate-grey);
    vertical-align: top;
}

.commerce-totals td:last-child {
    text-align: right;
    font-weight: 500;
}

.commerce-totals tr.commerce-total td {
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-light);
    font-weight: 700;
    color: var(--navy);
    font-size: var(--text-lg);
}

.commerce-coupon {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.commerce-coupon .form-control {
    flex: 1 1 10rem;
}

.commerce-alert {
    border-radius: 12px;
    font-size: var(--text-sm);
    line-height: 1.45;
}

.commerce-btn {
    font-family: var(--font-body) !important;
    font-size: var(--text-sm) !important;
    font-weight: 600;
    line-height: 1 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 2px solid transparent;
    border-radius: 24px;
    padding: 0.85rem 1.35rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.commerce-btn-sm {
    padding: 0.55rem 0.9rem;
    border-radius: 20px;
}

.commerce-btn-accent {
    color: var(--slate-grey);
    background: var(--yellow);
}

.commerce-btn-accent:hover {
    color: var(--slate-grey);
    background: var(--yellow-dark);
    box-shadow: 0 4px 14px var(--yellow-shadow);
    transform: translateY(-2px);
}

.commerce-btn-primary {
    color: var(--white);
    background: var(--navy);
}

.commerce-btn-primary:hover {
    color: var(--white);
    background: var(--navy-dark);
    box-shadow: 0 4px 14px var(--navy-shadow);
    transform: translateY(-2px);
}

.commerce-btn-secondary {
    color: var(--aqua);
    background: var(--aqua-tint);
}

.commerce-btn-secondary:hover {
    color: var(--aqua);
    border-color: var(--aqua);
    box-shadow: 0 4px 14px var(--aqua-shadow);
}

.commerce-btn-ghost {
    color: var(--navy);
    background: var(--grey-50-alt);
}

.commerce-btn-ghost:hover {
    color: var(--navy);
    background: var(--grey-200-hover);
}

.commerce-btn:focus-visible {
    outline: 0.2rem solid var(--royal-blue-focus);
    outline-offset: 2px;
}

.commerce-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.commerce-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.commerce-summary {
    position: sticky;
    top: 1.25rem;
}

.order-list {
    display: flex;
    flex-direction: column;
    max-height: 28rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: 12px;
}

.order-card {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

.order-card:first-child {
    padding-top: 0;
}

.order-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.order-card-main {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
}

.order-id {
    font-size: var(--text-base) !important;
    font-weight: 600;
}

.order-card-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.order-action-status {
    flex: 1 1 100%;
    min-height: 1.1rem;
    margin: 0;
    font-size: var(--text-sm);
    color: var(--aqua);
}

.order-action-status.is-error {
    color: #b42318;
}

.commerce-page .modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 8px 32px var(--shadow);
}

.commerce-page .modal-title {
    font-family: var(--font-display) !important;
    font-weight: 400 !important;
    color: var(--navy);
}

.commerce-page .alert {
    border-radius: 12px;
    font-size: var(--text-sm);
}

#paypal-button-container {
    width: 100%;
    min-height: 2.75rem;
}

@media (max-width: 991.98px) {
    .commerce-layout {
        grid-template-columns: 1fr;
    }

    .commerce-summary {
        position: static;
    }

    .order-card-actions {
        justify-content: flex-start;
    }
}

@media print {
    .commerce-page {
        background: #fff !important;
        padding: 0 !important;
    }

    .commerce-card {
        box-shadow: none;
        border: none;
        padding: 0;
    }
}
