/* --- MARKETPLACE GRID (ARCHIVE) --- */
.market-main-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Responsive Grid */
    gap: 30px;
    margin-bottom: 50px;
}

.market-card-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.market-card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    border-color: #a855f7;
}

/* Thumbnail Area */
.market-card-thumb {
    position: relative;
    height: 220px;
    background-color: #000;
    overflow: hidden;
}

.market-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.market-card-item:hover .market-card-thumb img {
    transform: scale(1.05);
}

/* Floating Price Badge */
.price-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: #a855f7;
    color: #fff;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 1.1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

/* Placeholder for missing images */
.market-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    color: var(--text-dim);
    font-size: 2rem;
}

/* Card Body */
.market-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.market-card-title {
    margin: 0 0 10px;
    font-size: 1.2rem;
}

.market-card-title a {
    text-decoration: none;
    color: var(--text-color);
}

.market-card-meta {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 20px;
}

.btn-market-view {
    margin-top: auto; /* Pushes button to bottom */
    display: block;
    text-align: center;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-color);
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-market-view:hover {
    background: var(--text-color);
    color: var(--bg-color);
}


/* --- SINGLE MARKETPLACE PAGE --- */
.back-link {
    display: inline-block;
    margin-bottom: 30px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
}
.back-link:hover { color: #a855f7; }

.single-market-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Split 50/50 */
    gap: 50px;
    align-items: start;
}

/* Left Image */
.single-market-image img {
    width: 100%;
    height: auto;
    
}

/* Right Details */
.ad-title {
    font-size: 2.5rem;
    margin: 0 0 15px;
    color: var(--text-color);
}

.ad-meta-top {
    color: #888;
    margin-bottom: 25px;
    display: flex;
    gap: 20px;
}

.ad-price-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.price-label { font-size: 1.2rem; }
.price-value { font-size: 2rem; font-weight: 800; color: #a855f7; }

.ad-description {
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 40px;
}
.ad-description h3 { margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }

/* Contact Button */
.btn-contact-seller {
    display: block;
    width: 100%;
    text-align: center;
    background-color: #a855f7;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.3s;
}
.btn-contact-seller:hover { background-color: #9333ea; }

.safety-tip {
    margin-top: 15px;
    font-size: 0.9rem;
    color: #888;
    text-align: center;
}

/* --- MOBILE RESPONSIVE --- */
@media screen and (max-width: 992px) {
    .single-market-grid {
        grid-template-columns: 1fr; /* Stack vertically on mobile */
        gap: 30px;
    }
    .ad-title { font-size: 1.8rem; }
    .price-value { font-size: 1.8rem; }
}


/* ad form */
.ad-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 20px;
}
.ad-form-box {
    background: var(--card-bg, #fff);
    padding: 30px;
    border-radius: 10px;
    border: 1px solid var(--border, #ddd);
}
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-color, #333);
}
.form-input {
    width: 100%;
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-sizing: border-box; /* Critical for responsiveness */
}
/* Grid for Price/Contact */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.submit-btn {
    background: #a855f7; /* Your accent color */
    color: #fff;
    padding: 15px 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    width: 100%;
    font-weight: bold;
    transition: background 0.3s ease;
}
.submit-btn:hover {
    background: #9333ea;
}

/* MOBILE RESPONSIVE TWEAKS */
@media (max-width: 600px) {
    .form-grid-2 {
        grid-template-columns: 1fr; /* Stack vertically on phones */
        gap: 0;
    }
    .ad-form-box {
        padding: 20px; /* Less padding on mobile */
    }
}

a.success-msg {
    color: black;
    font-weight: 600;
}
