/* Checkout page. Shared tokens and .pd-panel live in storefront.css. */

.co-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 20px;
    margin-bottom: 16px;
}

.co-title {
    margin: 0;
    font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
}

.co-sub {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 6px 14px;
    border-radius: 99px;
    background: var(--pd-mint);
    color: var(--pd-green-dark);
    font-size: .92rem;
    font-weight: 500;
}

/* Summary sits second in the markup so phones read: items → details → confirm */
.co-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-areas: "form summary";
    gap: 20px;
    align-items: start;
}

.co-grid > .pd-panel {
    margin-top: 0;
}

.co-summary {
    grid-area: summary;
    position: sticky;
    top: 92px;
    padding: 22px;
}

.co-form-panel {
    grid-area: form;
    padding: 24px;
}

.co-h2 {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
    font-size: 1.25rem;
    font-weight: 600;
}

.co-count {
    font-size: .9rem;
    font-weight: 500;
    color: var(--pd-muted);
}

/* ---------- Items ---------- */

.co-items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.co-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: start;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--pd-line);
    transition: opacity .2s;
}

.co-item:first-child {
    padding-top: 0;
    border-top: 0;
}

.co-item.is-removing {
    opacity: .4;
    pointer-events: none;
}

.co-item__img {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: var(--pd-sunk);
    object-fit: cover;
}

.co-item__name {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-weight: 500;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.co-item__opts,
.co-item__unit {
    margin: 2px 0 0;
    font-size: .84rem;
    color: var(--pd-muted);
}

.co-item__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.co-item__total {
    font-size: 1.05rem;
    font-weight: 700;
}

.co-item__remove {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--pd-muted);
    transition: background-color .15s, color .15s;
}

.co-item__remove:hover {
    background: #fdecea;
    color: var(--pd-red);
}

.co-item__remove:focus-visible {
    outline: none;
    box-shadow: var(--pd-ring);
}

.co-qty {
    display: inline-flex;
    height: 36px;
    border: 1.5px solid #cfd9d3;
    border-radius: 9px;
    overflow: hidden;
}

.co-qty button {
    width: 34px;
    border: 0;
    background: var(--pd-sunk);
    color: var(--pd-ink);
    font-size: .75rem;
}

.co-qty button:hover {
    background: var(--pd-mint);
}

.co-qty input {
    width: 42px;
    border: 0;
    border-inline: 1.5px solid #cfd9d3;
    text-align: center;
    font: inherit;
    font-weight: 600;
    color: var(--pd-ink);
    -moz-appearance: textfield;
    appearance: textfield;
}

.co-qty input::-webkit-outer-spin-button,
.co-qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.co-qty button:focus-visible,
.co-qty input:focus-visible {
    outline: none;
    background: var(--pd-mint);
}

/* ---------- Totals ---------- */

.co-totals {
    margin: 16px 0 0;
    padding-top: 12px;
    border-top: 1px dashed #cfd9d3;
}

.co-totals > div {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.co-totals dt {
    font-weight: 400;
    color: var(--pd-muted);
}

.co-totals dd {
    margin: 0;
    font-weight: 600;
}

.co-totals > .co-totals__grand {
    align-items: center;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--pd-line);
}

.co-totals__grand dt {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--pd-ink);
}

.co-totals__grand dd {
    font-size: 1.55rem;
    font-weight: 700;
    font-stretch: 87.5%;
    color: var(--pd-green-deep);
}

/* ---------- Form ---------- */

.co-field {
    min-width: 0;
    margin: 0 0 16px;
    padding: 0;
    border: 0;
}

.co-field > label,
.co-field > legend {
    display: block;
    float: none;
    width: auto;
    margin: 0 0 6px;
    padding: 0;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.3;
}

.co-input {
    position: relative;
}

.co-input > .svg-inline--fa,
.co-input > i {
    position: absolute;
    top: 16px;
    left: 14px;
    color: var(--pd-muted);
    font-size: .9rem;
    pointer-events: none;
}

.co-input input,
.co-input textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px 12px 40px;
    border: 1.5px solid #cfd9d3;
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-size: 1rem;
    color: var(--pd-ink);
    transition: border-color .15s, box-shadow .15s;
}

.co-input textarea {
    min-height: 78px;
    line-height: 1.5;
    resize: vertical;
}

.co-input input::placeholder,
.co-input textarea::placeholder {
    color: #98a39d;
}

.co-input input:focus,
.co-input textarea:focus {
    outline: none;
    border-color: var(--pd-green-deep);
    box-shadow: var(--pd-ring);
}

.co-input input:user-invalid,
.co-input textarea:user-invalid {
    border-color: var(--pd-red);
}

.co-hint {
    display: block;
    margin-top: 6px;
    font-size: .82rem;
    color: var(--pd-muted);
}

/* Delivery area as choice cards */

.co-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.co-area__opt {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.co-area__opt input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.co-area__opt > span {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "name price"
        "time price";
    align-items: center;
    gap: 2px 10px;
    height: 100%;
    padding: 12px 14px 12px 44px;
    border: 1.5px solid #cfd9d3;
    border-radius: 10px;
    background: #fff;
    transition: border-color .15s, background-color .15s;
}

.co-area__opt > span::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 14px;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border: 2px solid #b9c6bf;
    border-radius: 50%;
    background: #fff;
    transition: border-color .15s, background-color .15s;
}

.co-area__opt strong {
    grid-area: name;
    font-weight: 600;
}

.co-area__opt small {
    grid-area: time;
    font-size: .8rem;
    color: var(--pd-muted);
}

.co-area__opt em {
    grid-area: price;
    font-style: normal;
    font-weight: 700;
    color: var(--pd-green-deep);
}

.co-area__opt:hover > span {
    border-color: var(--pd-green);
}

.co-area__opt input:checked + span {
    border-color: var(--pd-green-deep);
    background: var(--pd-mint);
    box-shadow: inset 0 0 0 1px var(--pd-green-deep);
}

.co-area__opt input:checked + span::before {
    border-color: var(--pd-green-deep);
    background: var(--pd-green-deep);
    box-shadow: inset 0 0 0 3px #fff;
}

.co-area__opt input:focus-visible + span {
    box-shadow: var(--pd-ring);
}

/* Confirm — the one loud element */

.co-submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    margin-top: 8px;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    background: var(--pd-green-deep);
    color: #fff;
    font: inherit;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .15s;
}

.co-submit:hover {
    background: var(--pd-green-dark);
}

.co-submit:focus-visible {
    outline: none;
    box-shadow: var(--pd-ring);
}

.co-submit:disabled {
    opacity: .75;
    cursor: progress;
}

.co-submit__label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.co-submit__total {
    padding: 4px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .14);
    font-size: 1.2rem;
    font-stretch: 87.5%;
    white-space: nowrap;
}

/* ---------- Empty cart ---------- */

.co-empty {
    max-width: 520px;
    margin: 24px auto;
    padding: 40px 24px;
    text-align: center;
}

.co-empty__icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--pd-mint);
    color: var(--pd-green-deep);
    font-size: 1.8rem;
}

.co-empty__title {
    margin: 0 0 6px;
    font-size: 1.35rem;
    font-weight: 600;
}

.co-empty p {
    margin: 0 0 20px;
    color: var(--pd-muted);
}

.co-btn {
    display: inline-flex;
    align-items: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 10px;
    background: var(--pd-green-deep);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.co-btn:hover {
    background: var(--pd-green-dark);
    color: #fff;
}

/* ---------- Responsive ---------- */

@media (max-width: 991.98px) {
    .co-head {
        margin-bottom: 12px;
    }

    .co-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "summary"
            "form";
        gap: 14px;
    }

    .co-summary {
        position: static;
        padding: 16px;
    }

    .co-form-panel {
        padding: 18px 16px;
    }
}

@media (max-width: 420px) {
    .co-area {
        grid-template-columns: 1fr;
    }

    .co-item {
        grid-template-columns: 60px minmax(0, 1fr) auto;
        gap: 10px;
    }

    .co-item__img {
        width: 60px;
        height: 60px;
    }

    .co-submit {
        padding: 0 14px;
        font-size: 1.02rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .co * {
        transition: none !important;
    }
}
