/* ============================================================



   ChaabiHub Marketplace — Pro Design



   Uses app CSS variables for automatic dark/light theme support



   Mobile-first, RTL-ready, Facebook Marketplace inspired



   ============================================================ */







/* === Layout Shell === */



.marketplace-screen,



.product-screen,



.sell-screen,



.my-listings-screen {



    max-width: 1280px;



    margin: 0 auto;



    padding: 12px 16px 80px;



    width: 100%;



    box-sizing: border-box;



}







/* === Marketplace Header === */



.marketplace-header {



    display: flex;



    align-items: center;



    justify-content: space-between;



    margin-bottom: 20px;



    gap: 12px;



    flex-wrap: wrap;



}



.marketplace-header h1 {



    font-size: 26px;



    font-weight: 800;



    margin: 0;



    color: var(--text-primary);



    display: flex;



    align-items: center;



    gap: 8px;



}



.marketplace-header h1 i { color: var(--accent-cyan, #06b6d4); }



.marketplace-header small {



    color: var(--text-secondary);



    font-size: 13px;



    display: block;



    margin-top: 2px;



}







/* === Layout: full-width single column === */

.marketplace-layout {

    display: block;

}



/* === Single Swipeable Category Bar === */

.marketplace-catbar-wrap {

    position: relative;

    display: flex;

    align-items: center;

    gap: 6px;

    margin: 6px 0 18px;

}

.marketplace-catbar {

    display: flex;

    gap: 8px;

    overflow-x: auto;

    scroll-behavior: smooth;

    -webkit-overflow-scrolling: touch;

    scroll-snap-type: x proximity;

    padding: 4px 2px;

    flex: 1 1 auto;

    list-style: none;

    margin: 0;

    scrollbar-width: none;

    -ms-overflow-style: none;

}

.marketplace-catbar::-webkit-scrollbar { display: none; height: 0; }

.marketplace-catbar > li { display: flex; flex: 0 0 auto; }

.category-item {

    scroll-snap-align: start;

    display: inline-flex;

    align-items: center;

    gap: 7px;

    padding: 9px 16px;

    border-radius: 999px;

    background: var(--surface-raised, var(--bg-card, #fff));

    border: 1px solid var(--line, rgba(0,0,0,.10));

    color: var(--text-secondary, #444);

    font-size: 13.5px;

    font-weight: 600;

    text-decoration: none;

    white-space: nowrap;

    transition: all .15s ease;

    cursor: pointer;

    user-select: none;

}

.category-item i { font-size: 13px; opacity: .85; width: auto; text-align: center; }

.category-item:hover {

    border-color: var(--accent, #4f46e5);

    color: var(--accent, #4f46e5);

}

.category-item.active {

    background: var(--accent, #4f46e5);

    border-color: var(--accent, #4f46e5);

    color: #fff;

}

.category-item.active i { opacity: 1; color: #fff; }
.category-item.sub {
    padding: 6px 13px;
    font-size: 12.5px;
    font-weight: 500;
    background: transparent;
    border-style: dashed;
    opacity: .9;
}
.category-item.sub:hover { background: var(--surface-hover, rgba(0,0,0,.04)); }


.catbar-arrow {

    flex: 0 0 auto;

    width: 34px;

    height: 34px;

    border-radius: 50%;

    border: 1px solid var(--line, rgba(0,0,0,.10));

    background: var(--surface-raised, #fff);

    color: var(--text-secondary, #444);

    display: inline-flex;

    align-items: center;

    justify-content: center;

    cursor: pointer;

    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,.06));

    transition: all .15s ease;

}

.catbar-arrow:hover { border-color: var(--accent, #4f46e5); color: var(--accent, #4f46e5); }

.catbar-arrow:active { transform: scale(.94); }

.marketplace-catbar-wrap.no-scroll .catbar-arrow { display: none; }

@media (max-width: 768px) {

    .catbar-arrow { display: none; }

    .category-item { padding: 8px 13px; font-size: 13px; }

}



/* === Toolbar (Search + Sort) === */



.marketplace-toolbar {



    display: flex;



    gap: 10px;



    margin-bottom: 16px;



}



.mp-search-input {



    flex: 1;



    padding: 11px 16px;



    border-radius: 12px;



    border: 1px solid var(--border-color, #e2e8f0);



    background: var(--input-bg, #fff);



    color: var(--text-primary);



    font-size: 14px;



    outline: none;



    transition: border-color .15s;



}



.mp-search-input:focus {



    border-color: var(--accent-cyan, #06b6d4);



    box-shadow: 0 0 0 3px rgba(6,182,212,.12);



}



.mp-sort-select {



    padding: 11px 14px;



    border-radius: 12px;



    border: 1px solid var(--border-color, #e2e8f0);



    background: var(--input-bg, #fff);



    color: var(--text-primary);



    font-size: 14px;



    cursor: pointer;



}







/* === Product Grid === */



.marketplace-grid {



    display: grid;



    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));



    gap: 14px;



}



@media (max-width: 480px) {



    .marketplace-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }



}







/* === Product Card === */



.product-card {



    background: var(--surface-raised, var(--bg-card, #fff));



    border-radius: 14px;



    overflow: hidden;



    cursor: pointer;



    transition: transform .15s ease, box-shadow .15s ease;



    border: 1px solid var(--line, rgba(0,0,0,.04));



    position: relative;



}



.product-card:hover {



    transform: translateY(-3px);



    box-shadow: var(--shadow-card, 0 8px 24px rgba(0,0,0,.1));



}



.product-card-img {



    width: 100%;



    aspect-ratio: 1;



    object-fit: cover;



    background: var(--media-bg, #f1f5f9);



    display: block;



}



.product-card-favorite {



    position: absolute;



    top: 8px;



    right: 8px;



    background: rgba(0,0,0,.5);



    border: none;



    border-radius: 50%;



    width: 32px;



    height: 32px;



    display: flex;



    align-items: center;



    justify-content: center;



    cursor: pointer;



    backdrop-filter: blur(4px);



    transition: background .15s;



}



.product-card-favorite i { color: #fff; font-size: 14px; }



.product-card-favorite.active { background: rgba(239,68,68,.8); }



.product-card-favorite.active i { color: #fff; }







.product-card-negotiable {



    position: absolute;



    top: 8px;



    left: 8px;



    background: rgba(6,182,212,.85);



    color: #fff;



    font-size: 10px;



    font-weight: 700;



    padding: 3px 8px;



    border-radius: 6px;



    text-transform: uppercase;



}







.product-card-body { padding: 10px 12px 12px; }



.product-card-price {



    font-size: 17px;



    font-weight: 800;



    color: var(--accent-cyan, #06b6d4);



    margin-bottom: 2px;



}



.product-card-title {



    font-size: 13px;



    font-weight: 600;



    color: var(--text-primary);



    line-height: 1.35;



    overflow: hidden;



    text-overflow: ellipsis;



    display: -webkit-box;



    -webkit-line-clamp: 2;



    -webkit-box-orient: vertical;



    margin-bottom: 6px;



}



.product-card-meta {



    display: flex;



    align-items: center;



    gap: 8px;



    font-size: 11px;



    color: var(--text-muted);



}



.product-card-meta span { display: flex; align-items: center; gap: 3px; }







/* === Empty State === */



.mp-empty {



    grid-column: 1 / -1;



    text-align: center;



    padding: 60px 20px;



    color: var(--text-muted);



}



.mp-empty i { font-size: 48px; margin-bottom: 12px; opacity: .4; }



.mp-empty p { font-size: 15px; margin: 0 0 16px; }







/* === Pagination === */



.marketplace-pagination {



    display: flex;



    justify-content: center;



    gap: 6px;



    margin-top: 24px;



}



.marketplace-pagination button {



    padding: 8px 14px;



    border-radius: 8px;



    border: 1px solid var(--border-color, #e2e8f0);



    background: var(--surface-raised, #fff);



    color: var(--text-primary);



    font-size: 13px;



    cursor: pointer;



    transition: all .15s;



}



.marketplace-pagination button:hover { background: var(--surface-hover); }



.marketplace-pagination button.active {



    background: var(--accent-cyan, #06b6d4);



    color: #fff;



    border-color: var(--accent-cyan, #06b6d4);



}



.marketplace-pagination button:disabled { opacity: .4; cursor: default; }







/* === Product Detail Page === */



.product-screen { padding-top: 20px; }



.product-detail-layout {



    display: grid;



    grid-template-columns: 1fr 380px;



    gap: 24px;



    align-items: start;



}



@media (max-width: 900px) {



    .product-detail-layout { grid-template-columns: 1fr; }



}



.product-gallery {



    background: var(--surface-raised, #fff);



    border-radius: 16px;



    overflow: hidden;



    border: 1px solid var(--line);



}



.product-main-image {



    width: 100%;



    max-height: 600px;



    object-fit: contain;



    background: var(--media-bg, #f1f5f9);



    display: block;



}



.product-thumbnails {



    display: flex;



    gap: 8px;



    padding: 10px;



    overflow-x: auto;



}



.product-thumb {



    width: 64px;



    height: 64px;



    border-radius: 10px;



    object-fit: cover;



    cursor: pointer;



    border: 2px solid transparent;



    transition: border-color .15s;



}



.product-thumb:hover, .product-thumb.active {



    border-color: var(--accent-cyan, #06b6d4);



}







.product-info { padding: 0; }



.product-info h1 {



    font-size: 22px;



    font-weight: 800;



    color: var(--text-primary);



    margin: 0 0 10px;



}



.product-price {



    font-size: 28px;



    font-weight: 800;



    color: var(--accent-cyan, #06b6d4);



    margin-bottom: 12px;



}



.product-meta {



    display: flex;



    gap: 10px;



    align-items: center;



    margin-bottom: 16px;



    flex-wrap: wrap;



}



.mp-condition-badge {



    padding: 4px 12px;



    border-radius: 20px;



    font-size: 12px;



    font-weight: 700;



    text-transform: capitalize;



}



.condition-new { background: rgba(16,185,129,.15); color: #10b981; }



.condition-like_new { background: rgba(6,182,212,.15); color: #06b6d4; }



.condition-good { background: rgba(59,130,246,.15); color: #3b82f6; }



.condition-fair { background: rgba(245,158,11,.15); color: #f59e0b; }



.condition-used { background: rgba(107,114,128,.15); color: #6b7280; }







.mp-badge {



    display: inline-block;



    padding: 3px 10px;



    border-radius: 6px;



    font-size: 11px;



    font-weight: 700;



    background: rgba(6,182,212,.12);



    color: var(--accent-cyan, #06b6d4);



}







.product-description {



    margin-top: 16px;



    padding-top: 16px;



    border-top: 1px solid var(--line);



}



.product-description h3 { font-size: 15px; margin: 0 0 8px; color: var(--text-primary); }



.product-description p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; }







.seller-card {



    display: flex;



    align-items: center;



    gap: 12px;



    padding: 14px;



    background: var(--surface-muted, rgba(0,0,0,.03));



    border-radius: 14px;



    margin-top: 16px;



}



.seller-avatar {



    width: 48px;



    height: 48px;



    border-radius: 50%;



    object-fit: cover;



}



.seller-name { font-weight: 700; color: var(--text-primary); font-size: 14px; text-decoration: none; }



.seller-card small { color: var(--text-muted); font-size: 12px; }







.product-actions { display: flex; gap: 10px; margin-top: 20px; }



.product-actions .primary-btn, .product-actions .secondary-btn { flex: 1; text-align: center; }







/* === Sell Form === */



.sell-container { max-width: 640px; margin: 0 auto; padding: 20px 0; }



.sell-container h1 { font-size: 22px; font-weight: 800; color: var(--text-primary); margin-bottom: 20px; }



.form-group { margin-bottom: 18px; }



.form-group label {



    display: block;



    font-size: 13px;



    font-weight: 600;



    color: var(--text-secondary);



    margin-bottom: 6px;



}



.form-group input[type="text"],



.form-group input[type="number"],



.form-group textarea,



.form-group select {



    width: 100%;



    padding: 12px 14px;



    border-radius: 12px;



    border: 1px solid var(--border-color);



    background: var(--input-bg);



    color: var(--text-primary);



    font-size: 14px;



    outline: none;



    transition: border-color .15s;



    box-sizing: border-box;



}



.form-group input:focus, .form-group textarea:focus, .form-group select:focus {



    border-color: var(--accent-cyan, #06b6d4);



    box-shadow: 0 0 0 3px rgba(6,182,212,.12);



}



.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }



.checkbox-label input { width: 18px; height: 18px; accent-color: var(--accent-cyan, #06b6d4); }







.upload-dropzone {



    border: 2px dashed var(--border-color);



    border-radius: 14px;



    padding: 32px;



    text-align: center;



    cursor: pointer;



    transition: border-color .15s, background .15s;



}



.upload-dropzone:hover { border-color: var(--accent-cyan, #06b6d4); background: var(--surface-hover); }



.upload-dropzone i { font-size: 28px; color: var(--text-muted); margin-bottom: 8px; }



.upload-dropzone p { font-size: 13px; color: var(--text-muted); margin: 0; }







.image-preview-container {



    display: flex;



    gap: 8px;



    margin-top: 10px;



    flex-wrap: wrap;



}



.image-preview-container .preview-item {



    position: relative;



    width: 80px;



    height: 80px;



    border-radius: 10px;



    overflow: hidden;



}



.image-preview-container .preview-item img { width: 100%; height: 100%; object-fit: cover; }



.image-preview-container .preview-item .remove-img {



    position: absolute;



    top: 2px; right: 2px;



    background: rgba(0,0,0,.6);



    color: #fff;



    border: none;



    border-radius: 50%;



    width: 20px; height: 20px;



    font-size: 11px;



    cursor: pointer;



    display: flex; align-items: center; justify-content: center;



}







.form-error {



    color: #ef4444;



    font-size: 13px;



    padding: 10px 14px;



    background: rgba(239,68,68,.08);



    border-radius: 10px;



    margin-bottom: 12px;



}







/* === My Listings === */



.my-listings-header {



    display: flex;



    align-items: center;



    justify-content: space-between;



    margin-bottom: 16px;



}



.listings-tabs {



    display: flex;



    gap: 6px;



    margin-bottom: 16px;



    border-bottom: 1px solid var(--line);



    padding-bottom: 0;



}



.tab-btn {



    padding: 10px 18px;



    border: none;



    background: transparent;



    color: var(--text-secondary);



    font-size: 14px;



    font-weight: 600;



    cursor: pointer;



    border-bottom: 2px solid transparent;



    margin-bottom: -1px;



    transition: all .15s;



}



.tab-btn:hover { color: var(--text-primary); }



.tab-btn.active { color: var(--accent-cyan, #06b6d4); border-bottom-color: var(--accent-cyan, #06b6d4); }







.listings-content { display: grid; gap: 12px; }



.listing-card {



    display: flex;



    gap: 14px;



    padding: 14px;



    background: var(--surface-raised, #fff);



    border-radius: 14px;



    border: 1px solid var(--line);



    align-items: center;



}



.listing-card .listing-image {



    width: 80px;



    height: 80px;



    border-radius: 10px;



    overflow: hidden;



    flex-shrink: 0;



}



.listing-card .listing-image img { width: 100%; height: 100%; object-fit: cover; }



.listing-card .listing-body { flex: 1; min-width: 0; }



.listing-card .listing-body h3 { font-size: 14px; font-weight: 700; margin: 0 0 4px; color: var(--text-primary); }



.listing-price { font-size: 16px; font-weight: 800; color: var(--accent-cyan, #06b6d4); }



.listing-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-muted); align-items: center; }



.status-badge {



    padding: 2px 8px;



    border-radius: 6px;



    font-size: 11px;



    font-weight: 700;



    text-transform: capitalize;



}



.status-active { background: rgba(16,185,129,.15); color: #10b981; }



.status-sold { background: rgba(239,68,68,.15); color: #ef4444; }



.status-hidden { background: rgba(107,114,128,.15); color: #6b7280; }



.status-archived { background: rgba(107,114,128,.15); color: #6b7280; }







/* === Skeleton Loader === */



.product-card-skeleton {



    background: var(--surface-raised, #fff);



    border-radius: 14px;



    overflow: hidden;



    border: 1px solid var(--line);



}



.skeleton-img {



    aspect-ratio: 1;



    background: linear-gradient(90deg, var(--surface-muted, #f1f5f9) 25%, var(--surface-hover, #e2e8f0) 50%, var(--surface-muted, #f1f5f9) 75%);



    background-size: 200% 100%;



    animation: shimmer 1.5s infinite;



}



.skeleton-text {



    height: 12px;



    border-radius: 4px;



    margin: 8px 12px;



    background: linear-gradient(90deg, var(--surface-muted, #f1f5f9) 25%, var(--surface-hover, #e2e8f0) 50%, var(--surface-muted, #f1f5f9) 75%);



    background-size: 200% 100%;



    animation: shimmer 1.5s infinite;



}



@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }







/* === Modals === */



.modal-overlay {



    position: fixed;



    inset: 0;



    background: rgba(0,0,0,.5);



    display: none;



    align-items: center;



    justify-content: center;



    z-index: 9999;



    backdrop-filter: blur(4px);



}



.modal-overlay.open { display: flex; }



.modal-box {



    background: var(--surface-raised, #fff);



    border-radius: 18px;



    padding: 24px;



    max-width: 440px;



    width: 90%;



    box-shadow: var(--shadow-floating, 0 24px 70px rgba(0,0,0,.3));



}



.modal-box h3 { font-size: 18px; font-weight: 800; margin: 0 0 16px; color: var(--text-primary); }



.modal-box textarea {



    width: 100%;



    min-height: 100px;



    padding: 12px;



    border-radius: 12px;



    border: 1px solid var(--border-color);



    background: var(--input-bg);



    color: var(--text-primary);



    resize: vertical;



    box-sizing: border-box;



}



.modal-actions { display: flex; gap: 10px; margin-top: 16px; }



.modal-actions button { flex: 1; }







/* === Buttons === */



.primary-btn {



    background: var(--accent-cyan, #06b6d4);



    color: #fff;



    border: none;



    padding: 10px 20px;



    border-radius: 12px;



    font-size: 14px;



    font-weight: 700;



    cursor: pointer;



    text-decoration: none;



    display: inline-flex;



    align-items: center;



    gap: 6px;



    transition: opacity .15s, transform .1s;



}



.primary-btn:hover { opacity: .9; }



.primary-btn:active { transform: scale(.97); }



.secondary-btn {



    background: var(--surface-hover, #f1f5f9);



    color: var(--text-primary);



    border: 1px solid var(--border-color);



    padding: 10px 20px;



    border-radius: 12px;



    font-size: 14px;



    font-weight: 600;



    cursor: pointer;



    text-decoration: none;



    display: inline-flex;



    align-items: center;



    gap: 6px;



    transition: opacity .15s;



}



.secondary-btn:hover { opacity: .8; }







/* === Toast === */



.toast {



    position: fixed;



    bottom: 90px;



    left: 50%;



    transform: translateX(-50%);



    padding: 12px 24px;



    border-radius: 12px;



    font-size: 14px;



    font-weight: 600;



    z-index: 10000;



    animation: toastIn .3s ease;



}



.toast-success { background: #10b981; color: #fff; }



.toast-error { background: #ef4444; color: #fff; }



@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; } }







/* === No image placeholder === */



.mp-no-image {



    aspect-ratio: 1;



    display: flex;



    align-items: center;



    justify-content: center;



    background: var(--surface-muted, #f1f5f9);



    color: var(--text-muted);



}



.mp-no-image i { font-size: 32px; opacity: .3; }



.mp-no-image-large {



    min-height: 300px;



    display: flex;



    align-items: center;



    justify-content: center;



    background: var(--media-bg, #f1f5f9);



    color: var(--text-muted);



}



.mp-no-image-large i { font-size: 48px; opacity: .3; }







/* === Post back button === */



.post-back-btn {



    background: var(--surface-hover, rgba(0,0,0,.06));



    border: none;



    border-radius: 50%;



    width: 36px;



    height: 36px;



    font-size: 20px;



    color: var(--text-primary);



    cursor: pointer;



    display: flex;



    align-items: center;



    justify-content: center;



    margin-bottom: 12px;



    transition: background .15s;



}



.post-back-btn:hover { background: var(--surface-hover); }







/* === RTL Support === */



[dir="rtl"] .product-card-favorite { right: auto; left: 8px; }



[dir="rtl"] .product-card-negotiable { right: 8px; left: auto; }



[dir="rtl"] .post-back-btn { transform: scaleX(-1); }







/* === Swipeable Category Bar (easy swipe & choose) === */



.marketplace-catbar-wrap {



    position: relative;



    display: flex;



    align-items: center;



    gap: 4px;



    margin-bottom: 14px;



}



.marketplace-catbar {



    display: flex;



    gap: 8px;



    overflow-x: auto;



    scroll-behavior: smooth;



    -webkit-overflow-scrolling: touch;



    scroll-snap-type: x proximity;



    padding: 4px 2px;



    flex: 1 1 auto;



    /* hide scrollbar but keep scroll */



    scrollbar-width: none;



    -ms-overflow-style: none;



}



.marketplace-catbar::-webkit-scrollbar { display: none; height: 0; }



.catbar-chip {



    flex: 0 0 auto;



    scroll-snap-align: start;



    display: inline-flex;



    align-items: center;



    gap: 7px;



    padding: 8px 14px;



    border-radius: 999px;



    background: var(--surface-raised, var(--bg-card, #fff));



    border: 1px solid var(--line, rgba(0,0,0,.10));



    color: var(--text-secondary, #444);



    font-size: 13.5px;



    font-weight: 600;



    text-decoration: none;



    white-space: nowrap;



    transition: all .15s ease;



    cursor: pointer;



    user-select: none;



}



.catbar-chip i { font-size: 13px; opacity: .85; }



.catbar-chip:hover {



    border-color: var(--accent, #4f46e5);



    color: var(--accent, #4f46e5);



}



.catbar-chip.active {



    background: var(--accent, #4f46e5);



    border-color: var(--accent, #4f46e5);



    color: #fff;



}



.catbar-chip.active i { opacity: 1; }



.catbar-arrow {



    flex: 0 0 auto;



    width: 32px;



    height: 32px;



    border-radius: 50%;



    border: 1px solid var(--line, rgba(0,0,0,.10));



    background: var(--surface-raised, #fff);



    color: var(--text-secondary, #444);



    display: inline-flex;



    align-items: center;



    justify-content: center;



    cursor: pointer;



    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,.06));



    transition: all .15s ease;



}



.catbar-arrow:hover { border-color: var(--accent, #4f46e5); color: var(--accent, #4f46e5); }



.catbar-arrow:active { transform: scale(.94); }



/* Hide arrows when not needed (JS adds .no-scroll) */



.marketplace-catbar-wrap.no-scroll .catbar-arrow { display: none; }







@media (max-width: 768px) {



    .catbar-arrow { display: none; } /* touch swipe on mobile */



    .catbar-chip { padding: 7px 12px; font-size: 13px; }



}
.marketplace-catbar > li { margin: 0; }
.marketplace-catbar .subcategory-list { display: contents; }
