/* ============================================
   KiwiClub Sweden — Marketplace Styles
   ============================================ */

/* --- Type Tabs --- */
.market-type-tabs {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.market-tab {
    padding: 8px 18px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.market-tab:hover {
    border-color: var(--aurora-green);
    color: var(--text-primary);
}

.market-tab.active {
    background: rgba(0, 214, 143, 0.12);
    border-color: var(--aurora-green);
    color: var(--aurora-green);
    font-weight: 500;
}

/* --- Layout --- */
.marketplace-layout {
    padding: 32px 0 80px;
}

/* --- Toolbar --- */
.market-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.market-search {
    flex: 1;
    min-width: 200px;
}

.market-search input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s;
}

.market-search input:focus {
    border-color: var(--aurora-green);
}

.market-search input::placeholder {
    color: var(--text-muted);
}

.market-filters {
    display: flex;
    gap: 8px;
}

.market-filters select {
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    outline: none;
}

/* --- Listings Grid --- */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* --- Listing Card --- */
.listing-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
}

.listing-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.listing-card.featured {
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(229, 168, 75, 0.1);
}

.listing-image {
    width: 100%;
    height: 200px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
    overflow: hidden;
}

.listing-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.listing-image .no-image {
    color: var(--text-muted);
    font-size: 1rem;
}

.listing-type-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.listing-type-badge.sell {
    background: rgba(0, 214, 143, 0.85);
    color: #fff;
}

.listing-type-badge.rent {
    background: rgba(0, 106, 167, 0.85);
    color: #fff;
}

.listing-type-badge.service {
    background: rgba(229, 168, 75, 0.85);
    color: #1a1a2e;
}

.listing-type-badge.free {
    background: rgba(200, 80, 220, 0.85);
    color: #fff;
}

.listing-type-badge.wanted {
    background: rgba(240, 80, 80, 0.85);
    color: #fff;
}

.listing-featured-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(229, 168, 75, 0.9);
    color: #1a1a2e;
}

.listing-body {
    padding: 16px 18px;
}

.listing-body h3 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listing-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--aurora-green);
    margin-bottom: 8px;
}

.listing-price.free {
    color: #c850dc;
}

.listing-price.wanted {
    color: #f05050;
}

.listing-info {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    align-items: center;
    flex-wrap: wrap;
}

.listing-info .city {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.listing-info .seller {
    font-weight: 500;
    color: var(--text-secondary);
}

.listing-info .dot {
    width: 3px;
    height: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    flex-shrink: 0;
}

.listing-category-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: var(--bg-primary);
    border-radius: 6px;
    color: var(--text-muted);
    display: inline-block;
    margin-top: 8px;
}

/* --- View Listing --- */
.view-listing-gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
}

.view-listing-gallery img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 10px;
}

.view-listing-gallery .placeholder-img {
    width: 100%;
    height: 250px;
    background: var(--bg-card);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.view-listing-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.view-listing-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--aurora-green);
}

.view-listing-location {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.view-listing-desc {
    line-height: 1.7;
    margin-bottom: 24px;
    white-space: pre-wrap;
    color: var(--text-secondary);
}

.view-listing-seller {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 20px;
}

.seller-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.seller-info .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.seller-info .details {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.contact-seller-btn {
    padding: 14px 28px;
    width: 100%;
    border: none;
    background: var(--aurora-green);
    color: #1a1a2e;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.contact-seller-btn:hover {
    background: #00f0a0;
    transform: translateY(-1px);
}

.seller-other-listings {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.seller-other-listings h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.other-listing-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.85rem;
}

.other-listing-item .title {
    color: var(--text-secondary);
}

.other-listing-item .price {
    color: var(--aurora-green);
    font-weight: 600;
}

/* --- 3-column form row --- */
.form-row-3 {
    grid-template-columns: 1fr 120px 1fr;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .listings-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 12px;
    }

    .market-toolbar {
        flex-direction: column;
    }

    .market-filters {
        width: 100%;
        flex-wrap: wrap;
    }

    .market-filters select {
        flex: 1;
        min-width: 100px;
    }

    .market-type-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-bottom: 4px;
    }

    .form-row-3 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .listings-grid {
        grid-template-columns: 1fr;
    }
}