/* Layout 1 — guest checkout (users/guestCart, templates/Users/v1/guest_cart.php).

   The page's structural styling (.checkout-container grid, .step-card,
   .step-num, .summary-card, .sidebar-block, the product rows, the payment
   chooser, the buttons) lives in style2.css, which layout 1 does not load —
   so on this layout the page rendered as raw HTML: bare step numbers, no
   cards, a 600px map, the sidebar stacked with no frame. This sheet rebuilds
   it in layout 1's own vocabulary (cards, theme tokens, the app frame), and
   everything is scoped under .app-shell .checkout-container so it can reach
   nothing outside this page. */

/* --- Frame -------------------------------------------------------------- */

.app-shell .checkout-container {
    display: block;
    padding: var(--app-page-top, 12px) var(--app-pad) var(--app-page-bottom, 24px);
    color: var(--app-ink);
}

/* Form left, sidebar right once there is room — the summary and Place Order
   stay in view beside the steps. Stacked below that, form first. */
@media (min-width: 900px) {
    .app-shell .checkout-container {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        gap: 20px;
        align-items: start;
    }

    .app-shell .checkout-container .sidebar {
        position: sticky;
        top: calc(var(--app-nav-height, 64px) + 12px);
    }
}

.app-shell .checkout-container .main-content {
    min-width: 0;
}

.app-shell .checkout-container .page-title {
    margin: 0 0 14px;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
    color: var(--app-ink);
}

/* --- Step cards ----------------------------------------------------------- */

.app-shell .checkout-container .step-card,
.app-shell .checkout-container .summary-card,
.app-shell .checkout-container .sidebar-block {
    margin: 0 0 14px;
    padding: 18px 16px;
    border: 1px solid #ececf0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(16, 24, 40, .04);
}

@media (min-width: 600px) {
    .app-shell .checkout-container .step-card,
    .app-shell .checkout-container .summary-card {
        padding: 22px;
    }
}

.app-shell .checkout-container .step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
}

/* The step number was printed as plain text on its own line above the
   heading; it is the badge beside it. */
.app-shell .checkout-container .step-num,
.app-shell .checkout-container .check-circle {
    display: inline-flex;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--app-theme);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.app-shell .checkout-container .check-circle {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
    font-size: 13px;
}

.app-shell .checkout-container .step-header h3,
.app-shell .checkout-container .card-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--app-ink);
}

/* "Welcome back" panel shown instead of steps 2–3 for a known customer. */
.app-shell .checkout-container .existing-account-panel {
    border-color: var(--app-theme-border, var(--app-theme));
    background: var(--app-theme-soft);
}

.app-shell .checkout-container .existing-account-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--app-ink);
}

.app-shell .checkout-container .existing-account-rechecking {
    margin-top: 8px;
    color: var(--app-muted);
}

/* --- Grid inside the steps --------------------------------------------------
   The markup uses Bootstrap .row / .col-* (col-md-4 triplets, col-12, col-md-6
   in the schedule step). One column on a phone, the markup's split above. */

.app-shell .checkout-container .row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -6px;
}

.app-shell .checkout-container .row > [class*="col-"],
.app-shell .checkout-container .row > .field {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 6px;
    box-sizing: border-box;
}

@media (min-width: 600px) {
    .app-shell .checkout-container .row > .col-md-4 {
        flex: 0 0 33.3333%;
        max-width: 33.3333%;
    }

    .app-shell .checkout-container .row > .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* --- Fields ------------------------------------------------------------------ */

.app-shell .checkout-container .field {
    margin: 0 0 14px;
}

.app-shell .checkout-container .field label,
.app-shell .checkout-container .form-label,
.app-shell .checkout-container .guest-row-schedule label {
    display: block;
    margin: 0 0 6px;
    color: var(--app-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.app-shell .checkout-container .text-danger {
    color: #dc2626;
}

.app-shell .checkout-container .form-control,
.app-shell .checkout-container .form-select,
.app-shell .checkout-container textarea {
    display: block;
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    background-color: #fff;
    color: var(--app-ink);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.app-shell .checkout-container textarea {
    min-height: 84px;
    resize: vertical;
}

.app-shell .checkout-container .form-control::placeholder,
.app-shell .checkout-container textarea::placeholder {
    color: #aeb4bd;
}

.app-shell .checkout-container .form-control:focus,
.app-shell .checkout-container .form-select:focus,
.app-shell .checkout-container textarea:focus {
    border-color: var(--app-theme);
    box-shadow: 0 0 0 3px var(--app-theme-soft);
    outline: 0;
}

.app-shell .checkout-container .form-control:disabled,
.app-shell .checkout-container .form-control[readonly] {
    background-color: #f6f7f9;
}

/* Native selects: room for, and the same chevron as, every layout 1 select. */
.app-shell .checkout-container select.form-control,
.app-shell .checkout-container .form-select {
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    appearance: none;
    -webkit-appearance: none;
}

/* Address search: the magnifier sat on its own line above the field. */
.app-shell .checkout-container .search-wrap {
    position: relative;
}

.app-shell .checkout-container .search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 1;
    transform: translateY(-50%);
    color: var(--app-muted);
    font-size: 14px;
    pointer-events: none;
}

.app-shell .checkout-container .search-wrap #autocomplete {
    padding-left: 40px;
}

/* The map carries height:600px inline — taller than a phone screen. */
.app-shell .checkout-container #map-canvas {
    height: 260px !important;
    border: 1px solid #eceef1;
    border-radius: 12px !important;
    box-shadow: none !important;
    overflow: hidden;
}

@media (min-width: 768px) {
    .app-shell .checkout-container #map-canvas {
        height: 340px !important;
    }
}

.app-shell .checkout-container .error,
.app-shell .checkout-container .schedule_date_error {
    display: block;
    margin-top: 5px;
    color: #dc2626;
    font-size: 12px;
}

.app-shell .checkout-container .hide_schedules {
    display: none !important;
}

/* --- Buttons --------------------------------------------------------------- */

.app-shell .checkout-container .btn-confirm,
.app-shell .checkout-container .btn-place-order {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    margin: 4px 0 0;
    padding: 12px 18px;
    border: 0;
    border-radius: 14px;
    background: var(--app-theme);
    box-shadow: 0 6px 16px rgba(16, 24, 40, .12);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s ease, opacity .15s ease;
}

.app-shell .checkout-container .btn-confirm:hover,
.app-shell .checkout-container .btn-place-order.active:hover {
    filter: brightness(.94);
}

.app-shell .checkout-container .btn-place-order {
    margin-top: 16px;
}

/* Not yet usable until the details are confirmed (guest_cart.js adds .active). */
.app-shell .checkout-container #placeOrderBtn:not(.active) {
    opacity: .5;
    box-shadow: none;
    cursor: not-allowed;
}

.app-shell .checkout-container .order-hint {
    margin: 10px 0 0;
    color: #b45309;
    font-size: 12px;
    text-align: center;
}

.app-shell .checkout-container .edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    padding: 8px 12px;
    border: 1px solid var(--app-theme);
    border-radius: 10px;
    background: #fff;
    color: var(--app-theme);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.app-shell .checkout-container .edit-btn:hover {
    background: var(--app-theme-soft);
}

/* --- Confirmed view (summary cards) ------------------------------------------ */

.app-shell .checkout-container .confirmed-view > .d-flex {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.app-shell .checkout-container .card-header {
    padding: 0;
    border: 0;
    background: none;
}

.app-shell .checkout-container .card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.app-shell .checkout-container .card-body {
    padding: 12px 0 0 34px;
}

.app-shell .checkout-container .info-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    font-size: 14px;
    line-height: 1.45;
}

.app-shell .checkout-container .info-row .icon {
    color: var(--app-theme);
    font-size: 15px;
}

.app-shell .checkout-container .info-row small {
    color: var(--app-muted);
    font-size: 11.5px;
}

.app-shell .checkout-container .confirmed-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #ecfdf3;
    color: #15803d;
    font-size: 14px;
    font-weight: 600;
}

/* --- Sidebar ------------------------------------------------------------------ */

.app-shell .checkout-container .sidebar {
    min-width: 0;
    margin-top: 6px;
}

.app-shell .checkout-container .sidebar > .text-right {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 8px;
}

/* style2.css pinned this absolutely above the card; here it is a plain link
   on its own row, right-aligned over the products card. */
.app-shell .checkout-container a.clear-cart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #dc2626;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
}

.app-shell .checkout-container a.clear-cart::before {
    content: "\f2ed";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 12px;
}

.app-shell .checkout-container .sidebar-title {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 700;
    color: var(--app-ink);
}

/* Product rows */
.app-shell .checkout-container .product-item {
    display: flex;
    gap: 12px;
    margin: 0 0 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid #f1f2f4;
}

.app-shell .checkout-container .product-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.app-shell .checkout-container .prod-img {
    display: flex;
    flex: 0 0 60px;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: 1px solid #eceef1;
    border-radius: 10px;
    background: #fafbfc;
    overflow: hidden;
}

.app-shell .checkout-container .prod-img img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

.app-shell .checkout-container .prod-info {
    flex: 1 1 auto;
    min-width: 0;
}

.app-shell .checkout-container .prod-info h4 {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--app-ink);
}

.app-shell .checkout-container .pro_unit {
    color: var(--app-muted);
    font-size: 12px;
}

.app-shell .checkout-container .price-info-icon {
    margin-left: 4px;
    color: var(--app-muted);
    font-size: 12px;
    cursor: help;
}

.app-shell .checkout-container .prod-price-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.app-shell .checkout-container .prod-price-line strong {
    color: var(--app-theme);
    font-size: 15px;
    font-weight: 800;
}

.app-shell .checkout-container .prod-price-line > .d-flex,
.app-shell .checkout-container .prod-price-line .quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Quantity stepper — same build as the cart / product steppers. */
.app-shell .checkout-container .pro-qty {
    display: inline-flex;
    align-items: center;
    height: 32px !important;
    border: 1px solid #e3e5e9 !important;
    border-radius: 10px !important;
    background: #fff;
    overflow: hidden;
}

.app-shell .checkout-container .pro-qty .qtybtn {
    position: relative;
    display: block;
    flex: 0 0 30px;
    width: 30px;
    min-width: 30px;
    height: 100%;
    background: #f6f7f9;
    color: var(--app-ink);
    cursor: pointer;
}

.app-shell .checkout-container .pro-qty .qtybtn:hover {
    background: #eceef1;
}

.app-shell .checkout-container .pro-qty .qtybtn::before,
.app-shell .checkout-container .pro-qty .qtybtn.inc::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 2px;
    background: currentColor;
}

.app-shell .checkout-container .pro-qty .qtybtn::before {
    width: 10px;
    height: 2px;
}

.app-shell .checkout-container .pro-qty .qtybtn.inc::after {
    width: 2px;
    height: 10px;
}

.app-shell .checkout-container .pro-qty input {
    width: 34px;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--app-ink);
    -webkit-text-fill-color: var(--app-ink);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    text-align: center;
    opacity: 1;
    -moz-appearance: textfield;
}

.app-shell .checkout-container .pro-qty input::-webkit-outer-spin-button,
.app-shell .checkout-container .pro-qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.app-shell .checkout-container .js-guest-remove-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
    cursor: pointer;
}

.app-shell .checkout-container .js-guest-remove-item:hover {
    background: #fef2f2;
}

/* Per-product date / slot under each row. */
.app-shell .checkout-container .guest-row-schedule {
    margin-top: 10px;
}

.app-shell .checkout-container .guest-row-schedule .form-control-sm {
    min-height: 40px;
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 13px;
}

.app-shell .checkout-container .guest-row-slot-field label {
    margin-top: 8px;
}

.app-shell .checkout-container .container-item {
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid #eceef1;
    border-radius: 10px;
    background: #fafbfc;
    font-size: 12px;
    color: var(--app-muted);
}

/* Delivery-charge note */
.app-shell .checkout-container .delivery_charge_note {
    margin: 0 0 14px;
}

.app-shell .checkout-container .delivery_charge_note .alert {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #f2e2bf;
    border-left: 4px solid #e0a82e;
    border-radius: 12px;
    background: #fdf6e3;
    color: #6b4c12;
    font-size: 12.5px;
    line-height: 1.55;
}

/* Totals */
.app-shell .checkout-container .summary-line,
.app-shell .checkout-container .delivery_Charges,
.app-shell .checkout-container .delivery_Charges > .deliveryCharges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--app-ink);
}

.app-shell .checkout-container .summary-line i {
    color: var(--app-muted);
    font-size: 12px;
}

.app-shell .checkout-container .green-free {
    color: #15803d;
    font-weight: 700;
}

.app-shell .checkout-container .free-delivery-wrapper {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.app-shell .checkout-container .sidebar-block .grand-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eceef1;
    color: var(--app-ink);
    font-size: 16px;
    font-weight: 800;
}

.app-shell .checkout-container .grand-total .total-price {
    color: var(--app-theme);
    font-size: 19px;
}

/* --- Payment chooser (.guest-payment-select) --------------------------------
   Even grid of selectable cards; the chosen one carries the theme. */

.app-shell .checkout-container .guest-payment-select {
    margin-top: 16px;
}

.app-shell .checkout-container .guest-payment-select .guest-payment-title {
    margin: 0 0 10px;
    color: var(--app-muted);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.app-shell .checkout-container .guest-payment-select .direct_pay_section {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.app-shell .checkout-container .guest-payment-select .payment_methods_section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
}

.app-shell .checkout-container .guest-payment-select .box-radio {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
}

.app-shell .checkout-container .guest-payment-select .box-radio .form-check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 11px 12px;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    background: #fff;
    color: var(--app-ink);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.3;
    text-transform: none;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.app-shell .checkout-container .guest-payment-select .box-radio img {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    margin: 0 !important;
    object-fit: contain;
}

.app-shell .checkout-container .guest-payment-select .box-radio .form-check-input {
    position: static;
    order: 3;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0 0 0 auto;
    accent-color: var(--app-theme);
}

.app-shell .checkout-container .guest-payment-select #paypal-button {
    display: none;
}

.app-shell .checkout-container .guest-payment-select .box-radio.is-selected .form-check-label,
.app-shell .checkout-container .guest-payment-select .box-radio:has(.form-check-input:checked) .form-check-label {
    border-color: var(--app-theme);
    background: var(--app-theme-soft);
    box-shadow: inset 0 0 0 1px var(--app-theme);
}

/* --- Tooltips (price / delivery breakdown) ------------------------------------ */

.app-shell .checkout-container .price-info-wrapper,
.app-shell .checkout-container .delivery-wrapper {
    position: relative;
}

.app-shell .checkout-container .delivery-tooltip {
    left: auto;
    right: 0;
    min-width: 230px;
    max-width: calc(100vw - 48px);
    border-radius: 10px;
    background: var(--app-ink, #1f2937);
    font-size: 12.5px;
}

/* --- Small utilities this page's markup relies on (Bootstrap is not loaded) --- */

.app-shell .checkout-container .d-flex {
    display: flex;
}

.app-shell .checkout-container .justify-content-between {
    justify-content: space-between;
}

.app-shell .checkout-container .align-items-center {
    align-items: center;
}

.app-shell .checkout-container .text-muted {
    color: var(--app-muted);
}

.app-shell .checkout-container .small {
    font-size: 12px;
}

.app-shell .checkout-container .mt-2 {
    margin-top: 8px;
}

.app-shell .checkout-container .mt-3 {
    margin-top: 12px;
}

.app-shell .checkout-container .ml-1 {
    margin-left: 4px;
}
