/* Deal cards (Part 5 §5.3). Every rule is scoped under the cards' root class .oa-cards, so Bootstrap's reboot and
   utilities cannot restyle a card, and every value comes from the --oa-* custom properties that SiteThemeFactory emits
   on the root's style attribute (the fallbacks below are the §5.3.1 fallback column). No web fonts. M6b (user decision
   2026-10-01): the image slot shows the item's https image (object-fit cover in the theme's aspect), else the tinted
   block; the header shows the site's https logo, else its initials. The cards root is a size container, so the row variant reacts to the pane width. */

.oa-cards {
    container-type: inline-size;
    color: var(--oa-ink, #1F2328);
    font-family: var(--oa-font-family, system-ui, "Segoe UI", Arial, sans-serif);
    font-size: var(--oa-font-size, 14px);
    line-height: 1.35;
    border: 1px solid var(--oa-border, #D0D7DE);
    border-radius: var(--oa-radius-card, 8px);
    background: var(--oa-surface, #FFFFFF);
    overflow: hidden;
}

.oa-cards * {
    box-sizing: border-box;
}

/* Header: shell colours, the site's logo or its initials on the primary colour. */
.oa-cards .oa-cards-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 8px 12px;
    background: var(--oa-shell-bg, #F6F8FA);
    color: var(--oa-shell-ink, #1F2328);
}

.oa-cards .oa-site-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 6px;
    border-radius: var(--oa-radius-button, 6px);
    background: var(--oa-primary, #1F6FEB);
    color: var(--oa-on-primary, #FFFFFF);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.oa-cards .oa-site-initials.oa-deleted {
    background: #8C959F;
}

.oa-cards .oa-cards-site {
    font-weight: 700;
}

.oa-cards .oa-cards-query {
    font-style: italic;
    overflow-wrap: anywhere;
}

.oa-cards .oa-cards-count {
    margin-left: auto;
    white-space: nowrap;
}

.oa-cards .oa-cards-json-toggle {
    border: 0;
    background: transparent;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.oa-cards .oa-cards-json {
    flex-basis: 100%;
    margin: 0;
    padding: 6px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.06);
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.oa-cards .oa-repaired-chip {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: #FFF4CE;
    color: #6B4E00;
    border: 1px solid #E3B341;
    font-size: 12px;
}

.oa-cards .oa-cards-notes {
    flex-basis: 100%;
    margin: 0;
    font-size: 11px;
    opacity: 0.85;
}

.oa-cards .oa-cards-fallback {
    margin: 8px 12px 0;
    padding: 6px 10px;
    border: 1px solid #E3B341;
    border-radius: 6px;
    background: #FFF8E1;
    color: #6B4E00;
}

.oa-cards .oa-cards-empty {
    margin: 0;
    padding: 12px;
    color: var(--oa-muted, #656D76);
}

.oa-cards .oa-cards-footer {
    display: flex;
    justify-content: center;
    padding: 8px 12px 12px;
}

.oa-cards .oa-load-more {
    border: 1px solid var(--oa-border, #D0D7DE);
    border-radius: var(--oa-radius-button, 6px);
    background: var(--oa-surface, #FFFFFF);
    color: var(--oa-ink, #1F2328);
    padding: 4px 14px;
    cursor: pointer;
}

.oa-cards .oa-load-more:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Body: the variant decides the layout. */
.oa-cards .oa-cards-body {
    padding: 12px;
}

.oa-cards.oa-variant-card .oa-cards-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--oa-card-width, 300px)), var(--oa-card-width, 300px)));
    gap: 12px;
}

.oa-cards.oa-variant-row .oa-cards-body {
    display: flex;
    flex-direction: column;
    max-width: var(--oa-card-width, 300px);
}

.oa-cards .oa-similar > summary {
    cursor: pointer;
    color: var(--oa-muted, #656D76);
    padding: 4px 0;
}

.oa-cards .oa-similar .oa-card {
    opacity: 0.6;
}

/* One card. */
.oa-cards .oa-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.oa-cards.oa-variant-card .oa-card {
    background: var(--oa-surface, #FFFFFF);
    border: 1px solid var(--oa-border, #D0D7DE);
    border-radius: var(--oa-radius-card, 8px);
    box-shadow: var(--oa-shadow-card, 0 1px 3px rgba(0,0,0,.12));
    overflow: hidden;
    padding-bottom: 10px;
    transition: box-shadow 0.15s ease-in-out;
}

.oa-cards.oa-variant-card .oa-card:hover {
    box-shadow: var(--oa-shadow-elevated, 0 8px 24px rgba(0,0,0,.18));
}

.oa-cards.oa-variant-card .oa-card > :not(.oa-card-image):not(.oa-card-media):not(.oa-ai-marker):not(.oa-sponsored):not(.oa-ask):not(.oa-pick-choose),
.oa-cards.oa-variant-card .oa-card-body > * {
    margin-left: 10px;
    margin-right: 10px;
}

.oa-cards.oa-variant-card .oa-card.oa-image-left {
    display: grid;
    grid-template-columns: 40% 1fr;
    padding-bottom: 0;
}

.oa-cards .oa-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0 10px;
    min-width: 0;
}

.oa-cards.oa-variant-row .oa-card {
    padding: var(--oa-space-row-padding, 10px 0);
    border-bottom: 1px solid var(--oa-border, #D0D7DE);
    background: transparent;
}

/* The image slot: the item's image (cover), or a tinted block when there is none or it failed to load. */
.oa-cards .oa-card-image,
.oa-cards .oa-card-media {
    background: var(--oa-shell-bg, #F6F8FA);
    aspect-ratio: var(--oa-image-aspect, 16 / 9);
    width: 100%;
    overflow: hidden;
}

.oa-cards .oa-card-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
}

.oa-cards .oa-site-logo {
    display: inline-block;
    height: 24px;
    max-width: 120px;
    object-fit: contain;
    border-radius: var(--oa-radius-button, 6px);
    background: var(--oa-surface, #FFFFFF);
}

.oa-cards .oa-card-media {
    height: 100%;
    aspect-ratio: auto;
    min-height: 120px;
}

.oa-cards .oa-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.oa-cards .oa-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: var(--oa-radius-badge, var(--oa-radius-pill, 999px));
    font-size: var(--oa-badge-size, 11px);
    font-weight: 700;
    line-height: 1.5;
}

/* User finding 2026-10-01: a structuredApi deal's match level (exact / relaxed), so relaxed results never look exact. */
.oa-cards .oa-match {
    align-self: flex-start;
    display: inline-block;
    max-width: 100%;
    margin-top: 4px;
    padding: 0 7px;
    border: 1px solid currentColor;
    border-radius: var(--oa-radius-badge, var(--oa-radius-pill, 999px));
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.oa-cards .oa-match-exact {
    color: var(--oa-ui-success, #1a7f37);
    background: var(--oa-ui-success-bg, #dafbe1);
}

.oa-cards .oa-match-relaxed {
    color: var(--oa-ui-warning, #9a6700);
    background: var(--oa-ui-warning-bg, #fff8c5);
}

.oa-cards .oa-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}

.oa-cards .oa-title {
    margin: 0;
    font-size: var(--oa-title-size, inherit);
    font-weight: var(--oa-title-weight, 600);
    color: var(--oa-ink, #1F2328);
    overflow-wrap: anywhere;
}

.oa-cards .oa-title a {
    color: var(--oa-link, var(--oa-price-color, inherit));
    text-decoration: none;
}

.oa-cards .oa-title a:visited {
    color: var(--oa-link-visited, var(--oa-link, inherit));
}

.oa-cards .oa-title a:hover {
    text-decoration: underline;
    color: var(--oa-primary-hover, var(--oa-link, inherit));
}

.oa-cards .oa-place {
    color: var(--oa-muted, #656D76);
}

.oa-cards .oa-price,
.oa-cards .oa-full-price {
    display: inline-block;
    margin-right: 8px;
}

.oa-cards .oa-price {
    font-size: var(--oa-price-size, 16px);
    font-weight: var(--oa-price-weight, 700);
    color: var(--oa-price-color, var(--oa-ink, #1F2328));
}

.oa-cards .oa-full-price {
    color: var(--oa-muted, #656D76);
    text-decoration: line-through;
}

.oa-cards .oa-price-per-unit {
    font-weight: 700;
    color: var(--oa-price-per-unit-color, var(--oa-ink, #1F2328));
}

.oa-cards .oa-meta {
    font-size: var(--oa-meta-size, 12px);
    font-weight: var(--oa-meta-weight, 400);
    color: var(--oa-meta-color, var(--oa-muted, #656D76));
}

.oa-cards .oa-description {
    margin: 0;
    font-size: var(--oa-description-size, inherit);
    line-height: var(--oa-description-line-height, 1.35);
    color: var(--oa-description-color, var(--oa-ink, #1F2328));
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.oa-cards .oa-cta {
    display: block;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: var(--oa-radius-button, 6px);
    text-align: center;
    text-decoration: none;
    font-weight: 700;
}

.oa-cards .oa-ai-marker {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 1;
    padding: 0 5px;
    border-radius: 4px;
    background: #9A6700;
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 700;
}

.oa-cards .oa-sponsored {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 1;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.oa-cards .oa-ask {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 1;
    display: none;
    border: 1px solid var(--oa-border, #D0D7DE);
    border-radius: var(--oa-radius-button, 6px);
    background: var(--oa-surface, #FFFFFF);
    color: var(--oa-ink, #1F2328);
    padding: 1px 8px;
    font-size: 12px;
    cursor: pointer;
}

.oa-cards .oa-card:hover .oa-ask,
.oa-cards .oa-card:focus-within .oa-ask {
    display: inline-block;
}

/* A narrow pane turns each row into the site's mobile card (§5.3.3). */
@container (max-width: 767px) {
    .oa-cards.oa-variant-row .oa-cards-body {
        max-width: none;
        gap: 10px;
    }

    .oa-cards.oa-variant-row .oa-card {
        background: var(--oa-surface, #FFFFFF);
        border: 1px solid var(--oa-card-border, var(--oa-border, #D0D7DE));
        border-radius: var(--oa-radius-card, 8px);
        box-shadow: var(--oa-shadow-card, 0 1px 3px rgba(0,0,0,.12));
        padding: var(--oa-space-mobile-card-padding, 10px);
    }
}

/* Addendum O.3 (M7m): the card carousel of a Workspace card widget - fixed-width slides (about 280 px, the site's card
   width within 240-320 px; at most 85 % of a narrow widget), CSS scroll-snap, a visible scrollbar on desktop, native swipe
   on touch, prev / next buttons and the "x / N" position (js/oa-carousel.js keeps them in step and adds is-static when
   every slide fits, which hides the bar). A row-variant site (GoHome) shows each row as the site's mobile card. */
.oa-cards {
    --oa-carousel-card-width: clamp(240px, var(--oa-card-width, 280px), 320px);
}

.oa-cards.oa-variant-row {
    --oa-carousel-card-width: 280px;
}

.oa-cards .oa-carousel {
    position: relative;
}

.oa-cards .oa-carousel-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 12px 0;
}

.oa-cards .oa-carousel.is-static .oa-carousel-bar {
    display: none;
}

.oa-cards .oa-carousel-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--oa-border, #D0D7DE);
    border-radius: 50%;
    background: var(--oa-surface, #FFFFFF);
    color: var(--oa-ink, #1F2328);
    cursor: pointer;
}

.oa-cards .oa-carousel-button:hover:not(:disabled) {
    border-color: var(--oa-primary, #1F6FEB);
    color: var(--oa-primary, #1F6FEB);
}

.oa-cards .oa-carousel-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.oa-cards .oa-carousel-position {
    min-width: 4.5em;
    text-align: center;
    color: var(--oa-muted, #656D76);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.oa-cards .oa-carousel-track {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 12px;
    padding: 8px 12px 12px;
    scrollbar-width: thin;
}

.oa-cards .oa-carousel-slide {
    display: flex;
    flex: 0 0 min(var(--oa-carousel-card-width), 85%);
    min-width: 0;
    scroll-snap-align: start;
}

.oa-cards .oa-carousel-slide > .oa-card {
    flex: 1 1 auto;
    width: 100%;
}

.oa-cards.oa-variant-row .oa-carousel-slide > .oa-card {
    background: var(--oa-surface, #FFFFFF);
    border: 1px solid var(--oa-card-border, var(--oa-border, #D0D7DE));
    border-radius: var(--oa-radius-card, 8px);
    box-shadow: var(--oa-shadow-card, 0 1px 3px rgba(0,0,0,.12));
    padding: var(--oa-space-mobile-card-padding, 10px);
}

.oa-cards .oa-carousel-button:focus-visible,
.oa-cards .oa-carousel-track:focus-visible,
.oa-cards .oa-cards-mode:focus-visible,
.oa-cards .oa-cards-pill:focus-visible {
    outline: 2px solid var(--oa-ui-focus, #0969DA);
    outline-offset: 2px;
}

/* The carousel <-> grid toggle in the header (O.3). */
.oa-cards .oa-cards-mode {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--oa-radius-button, 6px);
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.oa-cards .oa-cards-mode:hover:not(:disabled) {
    border-color: currentColor;
}

.oa-cards .oa-cards-mode:disabled {
    opacity: 0.45;
    cursor: default;
}

/* "Prikaži još 10" / "Prikaži sve (N)" (O.7) - round pills over the fetched cards, no site request. */
.oa-cards .oa-cards-more {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 4px 12px 12px;
}

.oa-cards .oa-cards-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
    padding: 4px 14px;
    border: 1px solid var(--oa-primary, #1F6FEB);
    border-radius: 999px;
    background: var(--oa-surface, #FFFFFF);
    color: var(--oa-primary, #1F6FEB);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.oa-cards .oa-cards-pill .rzi {
    font-size: 18px;
}

.oa-cards .oa-cards-pill:hover:not(:disabled) {
    background: var(--oa-primary, #1F6FEB);
    color: var(--oa-on-primary, #FFFFFF);
}

.oa-cards .oa-cards-pill:disabled {
    opacity: 0.5;
    cursor: default;
}

/* "Moj izbor: 3 od 30" (O.6) and the refused sort (O.5). */
.oa-cards .oa-cards-selection {
    margin: 0;
    padding: 8px 12px 0;
    font-weight: 600;
}

.oa-cards .oa-cards-sort-note {
    margin: 0;
    padding: 8px 12px 0;
    color: var(--oa-muted, #656D76);
    font-size: 12px;
}

/* The sort control in the header (O.5): a compact native select (keyboard and screen readers as the browser gives them). */
.oa-cards .oa-cards-sort {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    color: inherit;
}

.oa-cards .oa-cards-sort .rzi {
    font-size: 18px;
}

.oa-cards .oa-cards-sort-select {
    max-width: 14em;
    min-height: 28px;
    padding: 2px 6px;
    border: 1px solid var(--oa-border, #D0D7DE);
    border-radius: var(--oa-radius-button, 6px);
    background: var(--oa-surface, #FFFFFF);
    color: var(--oa-ink, #1F2328);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.oa-cards .oa-cards-sort-select:focus-visible {
    outline: 2px solid var(--oa-ui-focus, #0969DA);
    outline-offset: 2px;
}

.oa-cards .oa-cards-sort-select:disabled {
    opacity: 0.5;
    cursor: default;
}

/* The chat's item pick (O.4): candidate cards are ringed in the primary colour with an always visible "Odaberi" button. */
.oa-cards .oa-card.is-pick {
    outline: 3px solid var(--oa-ui-accent, var(--oa-primary, #1F6FEB));
    outline-offset: 1px;
    padding-top: 40px;
}

.oa-cards .oa-card .oa-pick-choose {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    padding: 2px 12px;
    border: 1px solid var(--oa-ui-accent, var(--oa-primary, #1F6FEB));
    border-radius: 999px;
    background: var(--oa-ui-accent, var(--oa-primary, #1F6FEB));
    color: var(--oa-ui-on-accent, #FFFFFF);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.oa-cards .oa-card .oa-pick-choose .rzi {
    font-size: 16px;
}

.oa-cards .oa-card .oa-pick-choose:focus-visible {
    outline: 2px solid var(--oa-ui-focus, #0969DA);
    outline-offset: 2px;
}

.oa-cards .oa-card .oa-pick-choose:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
    .oa-cards .oa-carousel-track {
        scroll-behavior: auto;
    }
}

/* Citation target flash (oa-ui.js initCitations adds the class for 1.6 s). */
.oa-cards .oa-flash {
    animation: oa-card-flash 1.6s ease-out;
}

@keyframes oa-card-flash {
    0% {
        box-shadow: 0 0 0 3px var(--oa-primary, #1F6FEB);
    }

    100% {
        box-shadow: var(--oa-shadow-card, 0 1px 3px rgba(0,0,0,.12));
    }
}
