/*
 * Guest checkout (frontend/guest-checkout/index.blade.php) and the public Track Order
 * page (frontend/order-tracking/index.blade.php) — Implement 107.
 */

/* ── Shared ────────────────────────────────────────────────────────────── */

.fs-gco__banner {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: var(--appearance-card-border-radius, 8px);
    background: var(--appearance-primary, #0d8255);
    color: #fff;
    font-size: clamp(16px, 2.4vw, 22px);
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.fs-gco__card {
    height: 100%;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: var(--appearance-card-border-radius, 10px);
    background: #fff;
}

.fs-gco__title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
}

/* ── Checkout ──────────────────────────────────────────────────────────── */

.fs-gco__login {
    margin: 0 0 16px;
    color: #6b7280;
    font-size: 14px;
}

.fs-gco__login a {
    font-weight: 600;
    text-decoration: underline;
}

/* Visually gone but still in the form, so bots fill it in. */
.fs-gco__hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.fs-gco .form-control.is-invalid,
.fs-gco [data-location-open].is-invalid {
    border-color: #dc2626;
}

.fs-gco__hint {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #fff7e6;
    color: #92400e;
    font-size: 13px;
}

.fs-gco__pay {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 4px 0 16px;
    padding: 12px;
    border: 1px solid var(--appearance-primary, #0d8255);
    border-radius: 8px;
    background: color-mix(in srgb, var(--appearance-primary, #0d8255) 6%, #fff);
}

.fs-gco__pay img {
    flex-shrink: 0;
    object-fit: contain;
}

.fs-gco__pay div {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    line-height: 1.4;
}

.fs-gco__pay strong {
    font-size: 14px;
}

.fs-gco__pay span {
    color: #4b5563;
}

.fs-gco__confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    padding: 10px 16px;
    border: 0;
    border-radius: var(--appearance-button-border-radius, 6px);
    background: var(--card-buy-btn-bg, #1faa39);
    color: var(--card-buy-btn-text, #fff);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s ease;
}

.fs-gco__confirm:hover {
    filter: brightness(.94);
}

.fs-gco__confirm:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

.fs-gco__confirm:disabled {
    cursor: wait;
    opacity: .75;
}

.fs-gco__confirm.is-loading::before {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: 50%;
    animation: fs-gco-spin .7s linear infinite;
}

@keyframes fs-gco-spin {
    to { transform: rotate(360deg); }
}

/* The summary table is shared with the signed-in checkout; keep long names readable. */
.fs-gco #checkout_summary .table td:first-child {
    min-width: 0;
    overflow-wrap: break-word;
}

/* Four columns do not fit a phone: drop the unit price (qty × subtotal still add up). */
@media (max-width: 575.98px) {
    .fs-gco #checkout_summary .table tr > :nth-child(3):not(:last-child) {
        display: none;
    }

    .fs-gco #checkout_summary .table tr.d-flex {
        gap: .75rem !important;
    }
}

/* ── Track Order ───────────────────────────────────────────────────────── */

.fs-track {
    max-width: 880px;
    margin-inline: auto;
}

.fs-track__form .btn {
    min-height: 44px;
}

.fs-track__head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.fs-track__code {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.fs-track__badge {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: #e7f0ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 600;
}

.fs-track__badge.is-done { background: #e9faf0; color: #15803d; }
.fs-track__badge.is-bad { background: #fdecec; color: #b91c1c; }

.fs-track__steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.fs-track__step {
    position: relative;
    padding: 0 4px;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
}

/* Connector to the previous step. */
.fs-track__step + .fs-track__step::before {
    content: "";
    position: absolute;
    top: 19px;
    right: 50%;
    width: 100%;
    height: 3px;
    background: #e5e7eb;
}

.fs-track__step.is-done + .fs-track__step.is-done::before {
    background: var(--appearance-primary, #0d8255);
}

.fs-track__dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0 auto 8px;
    border: 3px solid #e5e7eb;
    border-radius: 50%;
    background: #fff;
    font-size: 15px;
}

.fs-track__step.is-done { color: #111827; }

.fs-track__step.is-done .fs-track__dot {
    border-color: var(--appearance-primary, #0d8255);
    background: var(--appearance-primary, #0d8255);
    color: #fff;
}

.fs-track__step.is-current .fs-track__dot {
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--appearance-primary, #0d8255) 20%, transparent);
}

.fs-track__step strong {
    display: block;
    font-weight: 600;
    line-height: 1.3;
}

.fs-track__step time {
    display: block;
    margin-top: 2px;
    color: #6b7280;
    font-size: 12px;
}

.fs-track__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.fs-track__meta > div {
    padding: 10px 12px;
    border-radius: 8px;
    background: #f9fafb;
    font-size: 14px;
}

.fs-track__meta dt {
    margin-bottom: 2px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.fs-track__meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.fs-track__items {
    margin: 0 0 12px;
    padding: 0;
    list-style: none;
}

.fs-track__item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f2f4;
}

.fs-track__item img {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 6px;
    background: #f6f7f9;
    object-fit: cover;
}

.fs-track__item-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.fs-track__item-name small {
    display: block;
    color: #6b7280;
}

.fs-track__totals {
    margin: 0;
    font-size: 14px;
}

.fs-track__totals div {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.fs-track__totals div:last-child {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    font-size: 16px;
    font-weight: 700;
}

.fs-track__totals dd {
    margin: 0;
}

@media (max-width: 575.98px) {
    .fs-gco__card {
        padding: 16px;
    }

    .fs-track__dot {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .fs-track__step + .fs-track__step::before {
        top: 15px;
    }

    .fs-track__step {
        font-size: 11.5px;
    }
}

/* ── Dark theme ────────────────────────────────────────────────────────── */

body[data-theme="dark"] .fs-gco__card {
    border-color: #2f3542;
    background: #1b1f27;
}

body[data-theme="dark"] .fs-gco__pay {
    background: #1f2a24;
}

body[data-theme="dark"] .fs-gco__pay span,
body[data-theme="dark"] .fs-gco__login {
    color: #c7ccd4;
}

body[data-theme="dark"] .fs-gco__hint {
    background: #3a2f14;
    color: #fde68a;
}

body[data-theme="dark"] .fs-track__meta > div {
    background: #222733;
}

body[data-theme="dark"] .fs-track__step.is-done { color: #f3f4f6; }
body[data-theme="dark"] .fs-track__dot { background: #1b1f27; border-color: #3a4150; }
body[data-theme="dark"] .fs-track__item { border-color: #2f3542; }
