/* marketplace.cards.css */

.results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.marketplace-view-switch {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.06);
    flex-shrink: 0;
}

.marketplace-view-switch button {
    width: 38px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #6b7280;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.marketplace-view-switch button.active {
    background: #dcfce7;
    color: #15803d;
}

.results-list.market-grid-view {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

.results-list.market-list-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.tech-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.07);
    text-decoration: none;
    color: #111827;
    min-width: 0;
    cursor: pointer;
    transition: all 0.22s ease;
}

.tech-card:hover,
.tech-card.active {
    border-color: #16a34a;
    box-shadow: 0 16px 34px rgba(22, 163, 74, 0.12);
    transform: translateY(-2px);
}

.market-tech-cover {
    height: 132px;
    position: relative;
    background: #ecfdf3;
    overflow: hidden;
}

.market-tech-cover > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.market-cover-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #15803d;
    font-size: 2.2rem;
}

.market-tech-avatar {
    position: absolute;
    left: 14px;
    bottom: -24px;
    width: 58px;
    height: 58px;
    border-radius: 20px;
    background: white;
    border: 3px solid white;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #15803d;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
    font-size: 1.25rem;
}

.market-tech-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.market-tech-status {
    position: absolute;
    right: 10px;
    top: 10px;
}

.market-tech-status .market-pill {
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
}

.market-tech-body {
    padding: 34px 14px 14px;
}

.market-tech-name {
    display: block;
    font-size: 1rem;
    line-height: 1.25;
    margin-bottom: 4px;
    font-weight: 900;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-tech-service {
    display: block;
    color: #15803d;
    font-size: 0.82rem;
    font-weight: 900;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-tech-location {
    display: flex;
    gap: 5px;
    align-items: center;
    color: #6b7280;
    font-size: 0.76rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-tech-desc {
    margin: 11px 0 0;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.45em * 2);
}

.market-tech-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.market-pill {
    background: #f8fafc;
    border-radius: 999px;
    padding: 6px 9px;
    font-size: 0.72rem;
    font-weight: 900;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1;
}

.market-pill.available {
    background: #dcfce7;
    color: #15803d;
}

.market-pill.available i {
    font-size: 0.48rem;
}

.market-pill.busy {
    background: #fef3c7;
    color: #b45309;
}

.market-pill.offline {
    background: #e5e7eb;
    color: #4b5563;
}

.market-pill.price {
    background: #ecfeff;
    color: #0f766e;
}

.market-pill.verified {
    background: #dbeafe;
    color: #1d4ed8;
}

.tech-empty {
    grid-column: 1 / -1;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 34px 22px;
    text-align: center;
    color: #6b7280;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.06);
}

.tech-empty i {
    font-size: 1.7rem;
    color: #9ca3af;
}

.tech-empty p {
    margin-top: 10px;
    font-weight: 800;
}

/* List view */
.results-list.market-list-view .tech-card {
    display: grid;
    grid-template-columns: 180px 1fr;
    min-height: 168px;
}

.results-list.market-list-view .market-tech-cover {
    height: 100%;
    min-height: 168px;
}

.results-list.market-list-view .market-tech-avatar {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    left: 12px;
    bottom: 12px;
}

.results-list.market-list-view .market-tech-body {
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.results-list.market-list-view .market-tech-name {
    white-space: normal;
    font-size: 1.05rem;
}

.results-list.market-list-view .market-tech-desc {
    -webkit-line-clamp: 2;
    min-height: auto;
}

.results-list.market-list-view .market-tech-meta {
    margin-top: 12px;
}

/* Remove old buttons safely if old markup appears from cache */
.tech-actions,
.action-btn {
    display: none !important;
}

/* Responsive */
@media (max-width: 1200px) {
    .results-list.market-grid-view {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .results-header {
        align-items: center;
    }

    .marketplace-view-switch button {
        width: 36px;
        height: 32px;
    }

    .results-list.market-grid-view {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .market-tech-cover {
        height: 104px;
    }

    .market-tech-avatar {
        left: 10px;
        bottom: -22px;
        width: 52px;
        height: 52px;
        border-radius: 18px;
    }

    .market-tech-body {
        padding: 30px 12px 12px;
    }

    .market-tech-name {
        font-size: 0.92rem;
    }

    .market-tech-service {
        font-size: 0.78rem;
    }

    .market-tech-location {
        font-size: 0.74rem;
    }

    .market-tech-desc {
        display: none;
    }

    .market-pill {
        font-size: 0.68rem;
        padding: 5px 7px;
    }

    .results-list.market-list-view {
        gap: 12px;
    }

    .results-list.market-list-view .tech-card {
        grid-template-columns: 112px 1fr;
        min-height: 126px;
        border-radius: 22px;
    }

    .results-list.market-list-view .market-tech-cover {
        min-height: 126px;
    }

    .results-list.market-list-view .market-tech-avatar {
        width: 46px;
        height: 46px;
        border-radius: 16px;
        left: 10px;
        bottom: 10px;
    }

    .results-list.market-list-view .market-tech-body {
        padding: 14px 12px;
    }

    .results-list.market-list-view .market-tech-desc {
        display: -webkit-box;
        font-size: 0.78rem;
        -webkit-line-clamp: 2;
    }
}