/* ==========================================================================
   Print shop discovery — consumer order step 1

   Uses the same design tokens as the partner dashboard theme
   (dashboard-modern-theme.css) so both sides of the product look like one app.

   Loaded after order.css, which is still responsible for the footer and the
   shared order-flow chrome. Everything here is scoped under .discovery-page so
   it cannot leak into the other order steps that also load order.css.
   ========================================================================== */

:root {
    --pdm-accent: #0E9384;
    --pdm-accent-deep: #0B6F65;
    --pdm-accent-wash: #E6F4F1;
    --pdm-ink: #131A22;
    --pdm-ink-soft: #66707E;
    --pdm-line: #E3E8EF;
    --pdm-line-soft: #EDF0F4;
    --pdm-surface: #ffffff;
    --pdm-surface-2: #FBFCFD;
    --pdm-good: #12805C;
    --pdm-good-wash: #E4F4EC;
    --pdm-crit: #C4362F;
    --pdm-crit-wash: #FBE7E5;
}

/* order.css centres a fixed 1000px .column; discovery is fluid instead. */
body.discovery-body {
    padding: 0;
    display: block;
    background: var(--pdm-surface-2);
}

.discovery-page {
    max-width: 62rem;
    margin: 0 auto;
    padding: 1.25rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-sizing: border-box;
}

.discovery-page h3,
.discovery-page h4 {
    color: var(--pdm-ink);
    margin: 0;
}

/* ---------- steps ---------- */

.discovery-page .discovery-steps {
    width: 100%;
    margin: 0;
}

/* ---------- code banner ---------- */

.code-banner {
    background: linear-gradient(180deg, var(--pdm-accent-wash), var(--pdm-surface) 70%);
    border: 1px solid var(--pdm-accent);
    border-radius: 10px;
    padding: 0.95rem 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.code-banner-heading h3 {
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.code-banner-heading p {
    margin: 0.15rem 0 0;
    font-size: 13px;
    color: var(--pdm-ink-soft);
}

.code-banner-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.code-boxes {
    display: flex;
    gap: 0.4rem;
}

.code-boxes input {
    width: 2.4rem;
    height: 2.85rem;
    text-align: center;
    font-size: 19px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    border: 1.5px solid var(--pdm-line);
    border-radius: 8px;
    background: var(--pdm-surface);
    color: var(--pdm-ink);
    outline: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.code-boxes input:focus {
    border-color: var(--pdm-accent);
    box-shadow: 0 0 0 3px var(--pdm-accent-wash);
}

.code-boxes.shake input {
    border-color: var(--pdm-crit);
}

@media (prefers-reduced-motion: no-preference) {
    .code-boxes.shake {
        animation: code-shake .32s ease;
    }
}

@keyframes code-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.discovery-page .ui.button.code-check-btn {
    border-radius: 8px;
    font-weight: 650;
    font-size: 14px;
    padding: 0.7rem 1.35rem;
    background: var(--pdm-accent);
    border: 1px solid var(--pdm-accent);
    color: #fff;
    box-shadow: none;
}

.discovery-page .ui.button.code-check-btn:hover {
    background: var(--pdm-accent-deep);
}

.discovery-page .ui.button.code-check-btn:disabled {
    background: var(--pdm-line-soft);
    border-color: var(--pdm-line);
    color: var(--pdm-ink-soft);
    opacity: 1;
}

.code-error {
    display: none;
    align-items: center;
    gap: 0.35rem;
    color: var(--pdm-crit);
    font-size: 13px;
    font-weight: 600;
}

.code-error.visible {
    display: flex;
}

.code-preview {
    display: none;
    border: 1px solid var(--pdm-line);
    background: var(--pdm-surface);
    border-radius: 10px;
    padding: 0.8rem;
    gap: 0.9rem;
    align-items: center;
}

.code-preview.visible {
    display: flex;
}

@media (prefers-reduced-motion: no-preference) {
    .code-preview.visible {
        animation: code-slidein .2s ease;
    }
}

@keyframes code-slidein {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.code-preview-banner {
    flex: 0 0 auto;
    width: 4rem;
    height: 4rem;
    border-radius: 8px;
    background: var(--pdm-accent-wash);
    color: var(--pdm-accent-deep);
    display: flex;
    align-items: center;
    justify-content: center;
}

.code-preview-banner > i.icon {
    font-size: 1.4rem;
    margin: 0;
}

.code-preview-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.code-preview-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.code-preview-heading h4 {
    font-size: 14.5px;
    font-weight: 700;
    margin: 0;
}

.code-preview-address {
    margin: 0;
    font-size: 13px;
    color: var(--pdm-ink-soft);
}

.code-preview-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.discovery-page .code-preview-actions .ui.button {
    border-radius: 8px;
    font-weight: 650;
    font-size: 13.5px;
    padding: 0.6rem 1.15rem;
    box-shadow: none;
}

.code-reset-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--pdm-ink-soft);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

@media (max-width: 640px) {
    .code-banner-row {
        flex-direction: column;
        align-items: stretch;
    }

    .code-boxes {
        justify-content: space-between;
    }

    .code-boxes input {
        flex: 1 1 0;
        width: auto;
    }
}

/* ---------- control bar ---------- */

.discovery-controls {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--pdm-surface);
    border: 1px solid var(--pdm-line);
    border-radius: 10px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.discovery-controls-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.discovery-page .discovery-search {
    flex: 1 1 auto;
    min-width: 0;
}

.discovery-page .discovery-search .ui.icon.input {
    width: 100%;
}

.discovery-page .discovery-search input {
    border-radius: 8px;
    border: 1px solid var(--pdm-line);
    font-size: 14px;
}

.discovery-page .ui.button.discovery-clear-button {
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    background: var(--pdm-surface);
    border: 1px solid var(--pdm-line);
    color: var(--pdm-ink-soft);
    box-shadow: none;
    flex: 0 0 auto;
}

.discovery-view-toggle {
    display: flex;
    flex: 0 0 auto;
    background: var(--pdm-line-soft);
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
}

.discovery-view-toggle > .view-option {
    padding: 0.42rem 0.85rem;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--pdm-ink-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.discovery-view-toggle > .view-option.active {
    background: var(--pdm-surface);
    color: var(--pdm-accent-deep);
    box-shadow: 0 1px 2px rgba(19, 26, 34, .08);
}

/* ---------- filter chips ---------- */

.discovery-filters {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    overflow-x: auto;
    /* The chip row scrolls on its own so the page body never scrolls sideways. */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.discovery-filters::-webkit-scrollbar {
    display: none;
}

.discovery-filters > .filter-chip {
    flex: 0 0 auto;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--pdm-line);
    background: var(--pdm-surface);
    color: var(--pdm-ink-soft);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.discovery-filters > .filter-chip:hover {
    border-color: var(--pdm-accent);
    color: var(--pdm-accent-deep);
}

.discovery-filters > .filter-chip.active {
    background: var(--pdm-accent);
    border-color: var(--pdm-accent);
    color: #fff;
}

.discovery-filters > .filter-divider {
    flex: 0 0 auto;
    width: 1px;
    height: 20px;
    background: var(--pdm-line);
    margin: 0 0.15rem;
}

/* ---------- summary ---------- */

.discovery-summary {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.discovery-summary h4 {
    font-size: 15px;
}

.discovery-radius-note {
    margin: 0;
    font-size: 13px;
    color: var(--pdm-ink-soft);
}

/* ---------- map ---------- */

.discovery-map-panel {
    display: none;
    border: 1px solid var(--pdm-line);
    border-radius: 10px;
    overflow: hidden;
}

.discovery-map-panel.visible {
    display: block;
}

#discoveryMap {
    height: 26rem;
    width: 100%;
}

.discovery-map-popup strong {
    display: block;
    margin-bottom: 2px;
}

.discovery-map-popup a {
    color: var(--pdm-accent-deep);
    font-weight: 600;
}

/* ---------- result cards ---------- */

.discovery-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.discovery-results.hidden {
    display: none;
}

.shop-card {
    display: grid;
    grid-template-columns: 11rem 1fr auto;
    gap: 1rem;
    align-items: center;
    background: var(--pdm-surface);
    border: 1px solid var(--pdm-line);
    border-radius: 10px;
    padding: 0.9rem;
}

.shop-card-banner {
    width: 11rem;
    height: 7rem;
    border-radius: 8px;
    overflow: hidden;
    background: var(--pdm-line-soft);
}

.shop-card-banner > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.shop-card-banner-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #B9C2CC;
}

.shop-card-banner-empty > i.icon {
    font-size: 1.8rem;
    margin: 0;
}

.shop-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.shop-card-heading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.shop-card-heading > h3 {
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.status-pill {
    font-size: 11.5px;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.status-pill.status-open {
    background: var(--pdm-good-wash);
    color: var(--pdm-good);
}

.status-pill.status-closed {
    background: var(--pdm-crit-wash);
    color: var(--pdm-crit);
}

.shop-card-address {
    margin: 0;
    font-size: 13.5px;
    color: var(--pdm-ink-soft);
}

.shop-card-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1rem;
    font-size: 13.5px;
    color: var(--pdm-ink);
}

.shop-card-facts > .fact > i.icon {
    color: var(--pdm-ink-soft);
    margin-right: 0.25rem;
}

.shop-card-facts > .fact-distance {
    font-weight: 700;
    color: var(--pdm-accent-deep);
}

.shop-card-facts > .fact-price strong {
    color: var(--pdm-ink);
}

.shop-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.shop-card-chips > .chip {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--pdm-ink-soft);
    background: var(--pdm-line-soft);
    border-radius: 5px;
    padding: 0.18rem 0.45rem;
}

.shop-card-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    font-size: 13px;
}

.shop-card-links a {
    color: var(--pdm-accent-deep);
    font-weight: 600;
}

.shop-card-action {
    display: flex;
    align-items: center;
}

.discovery-page .shop-card-action .ui.button {
    border-radius: 8px;
    font-weight: 650;
    padding: 0.7rem 1.6rem;
    background: var(--pdm-accent);
    border: 1px solid var(--pdm-accent);
    color: #fff;
    box-shadow: none;
}

.discovery-page .shop-card-action .ui.button:hover {
    background: var(--pdm-accent-deep);
}

/* ---------- empty state ---------- */

.discovery-page .print-shop-no-item {
    background: var(--pdm-surface);
    border: 1px solid var(--pdm-line);
    border-radius: 10px;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--pdm-ink-soft);
}

.discovery-page .print-shop-no-item p {
    margin: 0.75rem 0 0;
}

.discovery-page .print-shop-no-item p.hint {
    margin-top: 0.25rem;
    font-size: 13px;
}

/* ---------- price list modal ---------- */

.price-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.price-list-table th,
.price-list-table td {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--pdm-line-soft);
}

.price-list-table th {
    color: var(--pdm-ink-soft);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.price-list-table td.price {
    text-align: right;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- pagination ---------- */

.discovery-page .pagination-section {
    display: flex;
    justify-content: center;
}

/* ---------- narrow screens ---------- */

@media (max-width: 900px) {
    .shop-card {
        grid-template-columns: 8rem 1fr;
    }

    .shop-card-banner {
        width: 8rem;
        height: 6rem;
    }

    .shop-card-action {
        grid-column: 1 / -1;
    }

    .discovery-page .shop-card-action .ui.button {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .discovery-page {
        padding: 0.75rem 0.75rem 2rem;
        gap: 1rem;
    }

    /* Semantic's four-across steps do not fit a phone; stack them instead. */
    .discovery-page .ui.four.steps {
        flex-direction: column;
    }

    .discovery-page .ui.steps .step {
        width: 100%;
    }

    .discovery-page .ui.steps:not(.vertical) .step:after {
        display: none;
    }

    .discovery-controls-row {
        flex-wrap: wrap;
    }

    .discovery-page .discovery-search {
        flex: 1 1 100%;
    }

    .discovery-view-toggle {
        flex: 1 1 auto;
    }

    .discovery-view-toggle > .view-option {
        flex: 1 1 0;
        justify-content: center;
    }

    .shop-card {
        grid-template-columns: 1fr;
    }

    .shop-card-banner {
        width: 100%;
        height: 8.5rem;
    }

    #discoveryMap {
        height: 20rem;
    }
}
