/* =====================================================
   KINETIC MARKET — HYBRID ARCHIVE CARDS
   Desktop: Horizontal
   Mobile: Vertical, image-first
   ===================================================== */

/* Remove GeoDirectory's extra card shell */
.geodir-post:has(.km-gd-card),
.geodir-loop-container .card:has(.km-gd-card),
.geodir-loop-container .geodir-post-item:has(.km-gd-card),
.geodir-loop-container .geodir-post-content:has(.km-gd-card) {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.km-gd-card,
.km-gd-card * {
    box-sizing: border-box;
}

/* Desktop card */
.km-gd-card {
    display: grid !important;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 26px;
    padding: 22px 24px;
    background: #fff;
    border: 1px solid #e6e0d7;
    border-radius: 12px;
    color: #202020;
    width: 100%;
    min-width: 0;
    font-family: Montserrat, sans-serif;
}

/* Image */
.km-gd-card__image {
    width: 190px;
    height: 170px;
    position: relative;
    overflow: hidden;
    border-radius: 9px;
    background: #ecece8;
}

.km-gd-card__image > a {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

.km-gd-card__image img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    max-width: none !important;
    max-height: none !important;
}

/* Main content */
.km-gd-card__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.km-gd-card__heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.km-gd-card__title {
    margin: 0 !important;
    padding: 0 !important;
    font-family: Montserrat, sans-serif;
    font-size: 21px !important;
    line-height: 1.35 !important;
    font-weight: 600 !important;
    letter-spacing: -.02em;
}

.km-gd-card__title a {
    color: #171717 !important;
    text-decoration: none !important;
}

.km-gd-card__title a:hover {
    text-decoration: underline !important;
}

/* Favorite heart */
.km-gd-card__favorite,
.km-gd-card__favorite a,
.km-gd-card__favorite button,
.km-gd-card__favorite span {
    font-size: 0 !important;
    line-height: 1 !important;
}

.km-gd-card__favorite {
    flex: 0 0 auto;
}

.km-gd-card__favorite a,
.km-gd-card__favorite button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    padding: 4px !important;
    overflow: hidden !important;
    text-decoration: none !important;
}

.km-gd-card__favorite i,
.km-gd-card__favorite svg,
.km-gd-card__favorite .fa,
.km-gd-card__favorite .fas,
.km-gd-card__favorite .far {
    font-size: 21px !important;
    width: 21px !important;
    height: 21px !important;
}

/* Badges */
.km-gd-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.km-gd-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    background: #eeeae3;
    color: #222;
}

.km-gd-card__badge--featured {
    background: #f2b544;
    color: #1c1c1c;
}

.km-gd-card__badge--ownership {
    background: #304659;
    color: #fff;
}

.km-gd-card__badge--black-co-owned {
    background: #1e6654;
    color: #fff;
}

.km-gd-card__badge--black-owned-location {
    background: #355e7a;
    color: #fff;
}

.km-gd-card__badge--black-owned-partnership {
    background: #6a4b79;
    color: #fff;
}

.km-gd-card__badge--franchisee {
    background: #414c58;
    color: #fff;
}

.km-gd-card__badge--community-centered {
    background: #7c3e34;
    color: #fff;
}

/* New badge */
.km-gd-card__badge:not([class*="--"]) {
    background-color: #C62828 !important;
    color: #fff !important;
}

/* Description */
.km-gd-card__description {
    margin: 0 !important;
    padding: 0 !important;
    color: #383838 !important;
    font-size: 15px !important;
    line-height: 1.55 !important;
    font-weight: 400;
}

/* Neighborhood and category */
.km-gd-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 13px;
    line-height: 1.5;
}

.km-gd-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #333;
    font-weight: 600;
}

.km-gd-card__location-icon {
    color: #555;
    font-size: 17px;
    line-height: 1;
}

.km-gd-card__category {
    display: inline-flex;
    align-items: center;
    background: #f3f0e9;
    color: #4b453d;
    border-radius: 5px;
    padding: 3px 9px;
    font-weight: 500;
}

/* Rating and business hours */
.km-gd-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #e7e3dc;
    font-size: 13px;
    color: #333;
}

.km-gd-card__rating {
    min-width: 0;
}

.km-gd-card__hours {
    min-width: 0;
    margin-left: auto;
}

.km-gd-card__hours .geodir_post_meta {
    margin: 0;
    padding: 0;
    border: 0;
}

/* =====================================================
   MOBILE — VERTICAL CARDS
   ===================================================== */

@media (max-width: 767px) {

    .km-gd-card {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        border-radius: 12px;
    }

    /* Full-width image */
    .km-gd-card__image {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9;
        border-radius: 0 !important;
        flex: 0 0 auto;
    }

    .km-gd-card__image > a,
    .km-gd-card__image img {
        width: 100% !important;
        height: 100% !important;
    }

    /* Content below image */
    .km-gd-card__main {
        width: 100%;
        padding: 15px 16px 16px;
        gap: 9px !important;
    }

    .km-gd-card__heading {
        gap: 10px;
        align-items: flex-start;
    }

    .km-gd-card__title {
        font-size: 17px !important;
        line-height: 1.35 !important;
        letter-spacing: -.015em;
    }

    .km-gd-card__favorite a,
    .km-gd-card__favorite button {
        width: 30px !important;
        height: 30px !important;
    }

    .km-gd-card__badges {
        gap: 5px;
    }

    .km-gd-card__badge {
        padding: 3px 7px;
        font-size: 10px;
        border-radius: 4px;
    }

    .km-gd-card__description {
        font-size: 13px !important;
        line-height: 1.5 !important;
    }

    .km-gd-card__meta {
        gap: 6px 9px;
        font-size: 11px;
    }

    .km-gd-card__location-icon {
        font-size: 14px;
    }

    .km-gd-card__category {
        padding: 3px 7px;
    }

    .km-gd-card__footer {
        margin-top: 3px;
        padding-top: 10px;
        gap: 7px;
        font-size: 11px;
        align-items: flex-start;
    }

    .km-gd-card__rating,
    .km-gd-card__hours {
        width: 100%;
        margin-left: 0;
    }
}

/* Narrow phones */
@media (max-width: 420px) {

    .km-gd-card__image {
        aspect-ratio: 16 / 10;
    }

    .km-gd-card__main {
        padding: 13px 14px 15px;
    }

    .km-gd-card__title {
        font-size: 16px !important;
    }
}

/* =====================================================
   KINETIC MARKET — MOBILE DIRECTORY REFINEMENTS
   ===================================================== */

@media (max-width: 767px) {

    /* 1. Larger, readable listing text */

    .km-gd-card__title {
        font-size: 19px !important;
        line-height: 1.4 !important;
    }

    .km-gd-card__description {
        font-size: 15px !important;
        line-height: 1.6 !important;
    }

    .km-gd-card__meta,
    .km-gd-card__footer {
        font-size: 13px !important;
        line-height: 1.5 !important;
    }

    .km-gd-card__badge {
        font-size: 11px !important;
        padding: 4px 8px;
    }

    .km-gd-card__main {
        gap: 11px !important;
        padding: 16px !important;
    }

    /* 2. Give the keyword search a solid white field */

    section.km-search input[type="search"],
    section.km-search input[type="text"] {
        background-color: #fff !important;
        border-color: transparent !important;
        box-shadow: none !important;
        font-size: 15px !important;
    }

    section.km-search input:focus {
        outline: none !important;
        box-shadow: none !important;
    }

    /* Remove border from the keyword field wrapper */
    section.km-search .km-search__keyword,
    section.km-search .km-search__input {
        border-color: transparent !important;
    }

    /* 3. Make the filters use the full available width */

    .km-rf {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px !important;
        align-items: stretch !important;
        width: 100%;
    }

    .km-rf .km-rf__pill,
    .km-rf .km-rf__near {
        width: 100% !important;
        min-width: 0 !important;
        height: 44px !important;
        justify-content: center !important;
    }

    .km-rf .km-rf__select select {
        width: 100% !important;
        height: 100% !important;
        font-size: 14px !important;
    }

    /* Keep Sort on its own full-width row */
    .km-rf > :has(select[name="sort_by"]) {
        grid-column: 1 / -1;
        width: 100%;
    }

    .km-rf select[name="sort_by"] {
        width: 100% !important;
        min-height: 44px;
        font-size: 14px !important;
    }

    /* 4. Right-align Save this Search */

    .geodir-loop-actions-container {
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center !important;
        width: 100%;
    }

    .wp-block-geodirectory-geodir-widget-loop-actions {
        margin-left: auto !important;
    }
}
/* =====================================================
   KINETIC MARKET — MOBILE FINAL REFINEMENTS
   ===================================================== */

@media (max-width: 767px) {

    /* Keep Save this Search right-aligned */
    .wp-block-geodirectory-geodir-widget-loop-actions {
        margin-left: auto !important;
        flex: 0 0 auto !important;
    }

    .geodir-loop-actions-container {
        width: auto !important;
        display: flex !important;
        justify-content: flex-end !important;
    }

    /* Allow Clear Search to stay on the left */
    .km-clear-search {
        margin-right: auto !important;
    }

    /* More separation between reviews and hours */
    .km-gd-card__footer {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding-top: 12px !important;
    }

    .km-gd-card__rating,
    .km-gd-card__hours {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .km-gd-card__hours {
        padding-top: 3px !important;
    }
}
