/*
 * Marketplace Landing Page — [liveag_marketplace]
 *
 * Styles for the catalog listing at /marketplace/.
 * Loaded via <link> tag inside the shortcode's ob_start() buffer —
 * only on pages that render [liveag_marketplace].
 *
 * Layout: two views toggled by JS —
 *   List  (.liveag-mp-view-list)  — clean list rows, divider-only separation.
 *   Tiles (.liveag-mp-view-tiles) — responsive card grid, thumbnail at top.
 *
 * @since POC
 * @ver   20260528d
 * @package LiveAg_Catalog
 */

/* =========================================================
   CONTAINER
   ========================================================= */

.liveag-marketplace {
    font-family: 'Poppins', sans-serif;
    color: #2b2b2b;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px 56px;
    box-sizing: border-box;
}

/* =========================================================
   TOOLBAR — view toggle buttons row
   ========================================================= */

.liveag-mp-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
}

.liveag-mp-view-toggle {
    display: flex;
    gap: 4px;
}

.liveag-mp-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #999;
    background: none;
    border: 1px solid #e0dbd3;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.liveag-mp-view-btn:hover {
    color: #4a7436;
    border-color: #9BBF7C;
    background-color: #f9f7f3;
}

/* Active state: aria-pressed="true" via CSS attribute selector */
.liveag-mp-view-btn[aria-pressed="true"] {
    color: #4a7436;
    border-color: #4a7436;
    background-color: #f5f0e8;
    font-weight: 600;
}

/* CSS-drawn list-lines icon (three horizontal bars) */
.liveag-mp-view-icon--list {
    display: inline-block;
    width: 13px;
    height: 10px;
    position: relative;
    flex-shrink: 0;
}

.liveag-mp-view-icon--list::before,
.liveag-mp-view-icon--list::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1.5px;
    background-color: currentColor;
    border-radius: 1px;
}

.liveag-mp-view-icon--list::before {
    top: 0;
    box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}

.liveag-mp-view-icon--list::after {
    display: none;
}

/*
 * CSS-drawn grid icon (2x2 squares via box-shadow).
 * Earlier inline-grid approach only provided 2 pseudo-element cells.
 * Box-shadow on a single ::before simulates all 4 squares.
 */
.liveag-mp-view-icon--tiles {
    display: inline-block;
    width: 11px;
    height: 11px;
    position: relative;
    flex-shrink: 0;
}

.liveag-mp-view-icon--tiles::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4.5px;
    height: 4.5px;
    background-color: currentColor;
    border-radius: 1px;
    box-shadow:
        6.5px 0 0 currentColor,
        0     6.5px 0 currentColor,
        6.5px 6.5px 0 currentColor;
}

.liveag-mp-view-icon--tiles::after {
    display: none;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */

.liveag-mp-empty {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    color: #888;
    text-align: center;
    padding: 56px 0;
    margin: 0;
}

/* =========================================================
   SECTION (status group)
   Generous gap between sections so Active / Upcoming / Past
   read as clearly distinct groups on a long page.
   ========================================================= */

.liveag-mp-section {
    margin-bottom: 56px;
}

.liveag-mp-section:last-child {
    margin-bottom: 0;
}

/*
 * Section heading — understated label style.
 * Small caps, tracked, green, with a thin rule extending right.
 * Using flex so the rule fills available width alongside the text.
 */
.liveag-mp-section-heading {
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #4a7436;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 12px 0;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

/* Thin rule extending from the section label to the right edge */
.liveag-mp-section-heading::after {
    content: '';
    display: block;
    height: 1px;
    background-color: #d4cdc3;
    flex: 1 1 auto;
    min-width: 20px;
}

/* =========================================================
   LIST CONTAINER
   Top border closes the list — each row adds a bottom border.
   In tiles view this becomes a CSS grid.
   ========================================================= */

.liveag-mp-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e8e3da;
}

/* =========================================================
   LIST ROW (anchor element — entire row is clickable)
   Base rules (mobile-first) appear here, before any @media.
   ========================================================= */

.liveag-mp-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    background-color: #ffffff;
    border-bottom: 1px solid #e8e3da;
    text-decoration: none;
    color: inherit;
    padding: 14px 4px;
    box-sizing: border-box;
    transition: background-color 0.15s ease;
}

.liveag-mp-row:hover,
.liveag-mp-row:focus {
    background-color: #f9f7f3;
    outline: none;
    text-decoration: none;
    color: inherit;
}

.liveag-mp-row:focus-visible {
    outline: 2px solid #4a7436;
    outline-offset: -2px;
}

/* =========================================================
   THUMBNAIL
   Base: 44px square — useful in list view, hidden via CSS.
   In tiles view: full-width at top of card (overridden below).
   ========================================================= */

.liveag-mp-row-thumb {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f5f0e8;
    position: relative;
}

.liveag-mp-row-thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* =========================================================
   ROW BODY
   ========================================================= */

.liveag-mp-row-body {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Header row: title + badge inline */
.liveag-mp-row-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.liveag-mp-row-title {
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #2b2b2b;
    margin: 0;
    padding: 0;
    line-height: 1.3;
    flex: 1 1 auto;
    min-width: 0;
}

.liveag-mp-row-date {
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #888888;
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

.liveag-mp-row-desc {
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #555555;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =========================================================
   STATUS BADGE — dot + label, no filled background
   A small colored circle followed by the status text.
   Much lighter than a filled pill; blends into the row.
   ========================================================= */

.liveag-mp-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 5px;
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    line-height: 1;
}

/* Colored dot — rendered via ::before pseudo-element */
.liveag-mp-badge::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.liveag-mp-badge--active {
    color: #4a7436;
}
.liveag-mp-badge--active::before {
    background-color: #4a7436;
}

.liveag-mp-badge--upcoming {
    color: #5e8042;
}
.liveag-mp-badge--upcoming::before {
    background-color: #9BBF7C;
}

.liveag-mp-badge--past {
    color: #999999;
}
.liveag-mp-badge--past::before {
    background-color: #c8c8c8;
}

/* =========================================================
   LIST VIEW — hide thumbnail column
   Thumbnail is not rendered in HTML when no image exists.
   When an image does exist, hide it in list view so the layout
   stays clean and text-only regardless of thumbnail presence.
   ========================================================= */

.liveag-mp-view-list .liveag-mp-row-thumb {
    display: none;
}

/* =========================================================
   TILES VIEW — card grid layout
   The .liveag-mp-list becomes a CSS grid.
   Each .liveag-mp-row becomes a vertical card.
   ========================================================= */

/* Grid container: 1 column mobile-first */
.liveag-mp-view-tiles .liveag-mp-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    border-top: none;
}

/* Card: vertical flex, white bg, rounded, subtle shadow */
.liveag-mp-view-tiles .liveag-mp-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border-bottom: none;
    border-radius: 9px;
    background-color: #fffefd;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.liveag-mp-view-tiles .liveag-mp-row:hover,
.liveag-mp-view-tiles .liveag-mp-row:focus {
    background-color: #fffefd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(74, 116, 54, 0.2);
    transform: translateY(-1px);
}

/* Thumbnail at top of tile — full width, 16:9 */
.liveag-mp-view-tiles .liveag-mp-row-thumb {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 0;
    flex-shrink: unset;
}

.liveag-mp-view-tiles .liveag-mp-row-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Content area padding inside tile */
.liveag-mp-view-tiles .liveag-mp-row-body {
    flex: none;
    min-width: unset;
    padding: 16px;
    gap: 4px;
}

/* Title slightly larger in tile cards */
.liveag-mp-view-tiles .liveag-mp-row-title {
    font-size: 16px;
}

/* Date slightly more prominent in tiles */
.liveag-mp-view-tiles .liveag-mp-row-date {
    font-size: 13px;
}

/* Description: 2-line clamp in tiles */
.liveag-mp-view-tiles .liveag-mp-row-desc {
    font-size: 13px;
    color: #444444;
    -webkit-line-clamp: 2;
}

/* =========================================================
   RESPONSIVE — TABLET (768px and up)
   ========================================================= */

@media (min-width: 768px) {
    .liveag-marketplace {
        padding: 40px 28px 64px;
    }

    /* --- LIST view tablet adjustments --- */
    .liveag-mp-view-list .liveag-mp-row {
        gap: 18px;
        padding: 16px 6px;
    }

    .liveag-mp-view-list .liveag-mp-row-body {
        gap: 3px;
    }

    .liveag-mp-view-list .liveag-mp-row-title {
        font-size: 16px;
    }

    .liveag-mp-view-list .liveag-mp-row-date {
        font-size: 13px;
    }

    .liveag-mp-view-list .liveag-mp-row-desc {
        font-size: 13px;
    }

    /* --- TILES view tablet: 2 columns --- */
    .liveag-mp-view-tiles .liveag-mp-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .liveag-mp-view-tiles .liveag-mp-row-body {
        padding: 18px;
    }
}

/* =========================================================
   RESPONSIVE — DESKTOP (1024px and up)
   ========================================================= */

@media (min-width: 1024px) {
    .liveag-marketplace {
        padding: 48px 24px 72px;
    }

    .liveag-mp-section {
        margin-bottom: 64px;
    }

    /* --- LIST view desktop adjustments --- */
    .liveag-mp-view-list .liveag-mp-row {
        gap: 20px;
        padding: 18px 8px;
    }

    .liveag-mp-view-list .liveag-mp-row-body {
        gap: 4px;
    }

    .liveag-mp-view-list .liveag-mp-row-title {
        font-size: 17px;
    }

    /* --- TILES view desktop: 3 columns --- */
    .liveag-mp-view-tiles .liveag-mp-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .liveag-mp-view-tiles .liveag-mp-row-body {
        padding: 20px;
    }

    .liveag-mp-view-tiles .liveag-mp-row-title {
        font-size: 17px;
    }
}
