/* ====================================================================
   MARKETPLACE DISCOVER (HOMEPAGE) STYLES
   ==================================================================== */
/* --- Desktop Hide Rules --- */
.pt-mobile-sell-btn-wrapper, .pt-mobile-main-nav, .pt-mobile-filter-bar, .pt-close-filters-bar, .pt-sidebar-overlay { 
    display: none; 
}

/* Autosuggest Dropdown Hover */
.pt-market-suggest-item:hover {
    background-color: #f2f2f2;
}

/* --- 1. Global Wrapper & Container (1400px width) --- */
.pt-market-archive-wrapper {
    background-color: #f0f2f5; /* 🏆 Premium App Background (FB Style) */
    min-height: 100vh;
    padding: 40px 0 80px 0;
    display: flex;
    flex-direction: column;

    /* 🏆 THE BULLETPROOF BREAKOUT TRICK (Bypasses GeneratePress) */
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
}

.pt-market-archive-wrapper .pt-container {
    /* 🏆 Increased width to use more of the screen */
    max-width: 1850px; 
    width: 95%; /* Use 95% of the viewport width */
    margin: 0 auto;
    box-sizing: border-box;
}



/* --- 2. Header & Search Bar --- */
.pt-market-header {
    text-align: left;
    margin-bottom: 20px;
    margin-top: -20px; /* Pulls everything up to maximize space above fold */
}

.pt-header-text-group h1 {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 4px;
    color: #050505;
    letter-spacing: -0.5px;
}

.pt-header-text-group p {
    color: #65676b;
    font-size: 1rem;
    margin-bottom: 0;
}

.pt-market-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

/* Modern Pill-Shaped Search Bar */
.pt-market-search-form {
    display: flex;
    gap: 10px;
    background: #fff;
    padding: 6px 6px 6px 20px;
    border-radius: 40px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    max-width: 650px;
    width: 100%;
    align-items: center;
    border: 1px solid #e4e6eb;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.pt-market-search-form:focus-within {
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-color: #ced0d4;
}

.pt-market-search-form input {
    border: none;
    background: transparent;
    flex: 1;
    font-size: 1rem;
    outline: none;
    padding: 8px 0;
    color: #050505;
}

.pt-market-search-form input::placeholder {
    color: #8c939d;
}

.pt-market-search-form .pt-button.pt-black {
    border-radius: 30px;
    padding: 10px 24px;
    margin: 0;
}

.pt-sidebar-sell-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    background: #e60000 !important; 
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 15px !important;
    font-size: 0.9rem !important;
    font-weight: 800 !important; 
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    box-shadow: 0 4px 10px rgba(230, 0, 0, 0.25) !important;
    transition: all 0.2s ease-in-out !important;
    box-sizing: border-box !important;
    margin-bottom: 5px !important;
}

.pt-sidebar-sell-btn:hover {
    background: #cc0000 !important;
    box-shadow: 0 6px 14px rgba(230, 0, 0, 0.35) !important;
    color: #ffffff !important;
}





/* --- 3. Layout Grid (Sidebar + Feed) --- */
.pt-market-content-row {
    display: flex;
    gap: 30px;
    align-items: flex-start; /* Required for sticky sidebar */
}

/* --- 4. Sticky Sidebar & Navigation --- */
.pt-market-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 30px; /* Sticks to the top of the screen on scroll */
    z-index: 10;
}

.pt-nav-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Softer app shadow */
    border: 1px solid #e4e6eb;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 60px); /* Restricts height to viewport */
    
    /* 🏆 ALLOW THE ENTIRE CARD TO SCROLL */
    overflow-y: auto; 
    overflow-x: hidden;
    scrollbar-width: thin;
}

/* Custom Slim Scrollbar for the whole sidebar */
.pt-nav-card::-webkit-scrollbar {
    width: 6px;
}
.pt-nav-card::-webkit-scrollbar-track {
    background: transparent;
}
.pt-nav-card::-webkit-scrollbar-thumb {
    background: #bcc0c4;
    border-radius: 4px;
}
.pt-nav-card::-webkit-scrollbar-thumb:hover {
    background: #a0a3a7;
}

.pt-market-main-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pt-market-main-menu li {
    margin-bottom: 5px;
}

.pt-market-main-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #050505;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.pt-market-main-menu a:hover {
    background: #f2f2f2;
}

.pt-menu-icon {
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    background: #e4e6eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pt-location-block {
    padding: 15px 20px;
    border-top: 1px solid #e4e6eb;
    border-bottom: 1px solid #e4e6eb;
    background: #fafbfc;
}

.pt-location-block h4 {
    margin: 0 0 10px 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #65676b;
    letter-spacing: 0.8px;
    font-weight: 800;
}

.pt-location-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #050505;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid #ced0d4;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.pt-location-btn:hover {
    background: #f2f2f2;
}

/* --- 5. Scrollable Categories Section --- */

/* 🏆 Override the default accordion flex layout to fix internal scrolling */
.pt-filter-accordion.is-active .pt-accordion-content.pt-sidebar-categories-wrapper {
    display: block !important; 
}

.pt-sidebar-categories-wrapper {
    /* 🏆 Strict height rules ensure the box is always a visible, scrollable window */
    height: 40vh; 
    min-height: 350px;
    max-height: 500px; 
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    padding-top: 0 !important; 
}

/* Custom Slim Scrollbar for Categories */
.pt-sidebar-categories-wrapper::-webkit-scrollbar { width: 6px; }
.pt-sidebar-categories-wrapper::-webkit-scrollbar-track { background: transparent; }
.pt-sidebar-categories-wrapper::-webkit-scrollbar-thumb { background: #bcc0c4; border-radius: 4px; }
.pt-sidebar-categories-wrapper::-webkit-scrollbar-thumb:hover { background: #a0a3a7; }

/* Remove old h4 since it's now in the accordion header */
.pt-sidebar-categories-wrapper h4 { display: none; }

.pt-cat-list { list-style: none; padding: 0; margin: 0; }
.pt-cat-header {
    margin-top: 18px;
    font-weight: 800;
    color: #8c939d;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-left: 5px;
}

.pt-cat-item { margin-bottom: 2px; }
.pt-cat-item a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: #050505;
    font-size: 0.95rem;
    transition: all 0.2s;
    font-weight: 500;
}

.pt-cat-item a:hover {
    background: #f2f2f2;
}

.pt-cat-item a.active {
    background: #ebedf0;
    color: #d00;
    font-weight: 700;
}


#pt-cat-accordion .pt-accordion-header:hover {
    background-color: #f0f2f5;
}

/* --- 6. SIDEBAR ACCORDION FILTERS --- */

.pt-filter-accordion {
    border-bottom: 1px solid #e4e6eb;
    background: #fff;
}

.pt-accordion-header {
    font-weight: 700;
    color: #050505;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    font-size: 0.95rem;
    user-select: none;
    transition: background 0.2s;
}

.pt-accordion-header:hover {
    background: #fcfcfc;
}

.pt-accordion-header .pt-chevron {
    color: #8c939d;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pt-accordion-content {
    display: none;
    padding: 0 20px 20px 20px;
}

/* Active State toggled by Inline JS */
.pt-filter-accordion.is-active .pt-accordion-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pt-filter-accordion.is-active .pt-accordion-header .pt-chevron {
    transform: rotate(180deg);
}

/* Price Range Grid */
.pt-price-grid {
    display: grid !important; 
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
}

.pt-price-grid input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced0d4;
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.pt-price-grid input:focus {
    border-color: #0084ff;
    outline: none;
}

/* Custom Radios & Checkboxes */
.pt-radio-label, .pt-check-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #050505;
}

.pt-radio-label input[type="radio"], 
.pt-check-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
    accent-color: #0084ff; /* Facebook Blue Selection */
}


/* --- 7. Main Feed & Product Cards --- */
.pt-market-feed {
    flex: 1;
    min-width: 0;
}

#market-feed {
    scroll-margin-top: 50px;
}

.pt-market-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

/* Tablet: 3 per row */
@media (max-width: 1400px) {
    .pt-market-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile: 2 per row */
@media (max-width: 600px) {
    .pt-market-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

.pt-market-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e4e6eb;
    height: 100%;
    position: relative;
}

.pt-market-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: #d1d5db;
}

.pt-market-card.is-sold {
    opacity: 0.7;
}
.pt-market-card.is-sold .pt-card-img {
    filter: grayscale(100%);
}

.pt-card-img {
    height: 240px; /* Increased height for larger image container */
    width: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #f9f9f9;
    border-bottom: 1px solid #f0f2f5;
    position: relative;
}

/* Adjust image height on smaller screens to keep proportion */
@media (max-width: 600px) {
    .pt-card-img {
        height: 180px; 
    }
}

.pt-card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.pt-card-price {
    font-weight: 800;
    font-size: 1.15rem;
    color: #050505;
    margin-bottom: 5px;
}

.pt-card-title {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    line-height: 1.3;
    color: #050505;
    font-weight: 600;
    
    /* 🏆 STRICT WORD/LINE COUNT CONTROL */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Forces text to exactly 2 lines maximum */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.6em; /* Matches line-height x 2 to keep cards uniform */
}

.pt-card-loc {
    margin-top: auto; /* Pushes location to the bottom of the card body */
    font-size: 0.75rem;
    color: #65676b;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Empty State Styling */
.pt-empty-state {
    text-align: center;
    padding: 80px 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e4e6eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}




/* --- 8. Mobile Responsive Adjustments --- */

/* 🏆 Hide mobile drawer elements on desktop */
.pt-mobile-filter-bar, 
.pt-close-filters-bar, 
.pt-sidebar-overlay { 
    display: none; 
}

@media (max-width: 900px) {
    .pt-market-content-row {
        flex-direction: column;
    }
  
    .pt-market-header {
    margin-bottom: auto;
    }

    /* 🏆 NEW: Show the horizontal nav under search bar */
    .pt-mobile-main-nav {
        display: block !important;
        margin-bottom: 15px;
    }

    /* 🏆 NEW: Style for horizontal row items */
    .pt-mobile-main-nav .pt-market-main-menu {
        display: flex !important;
        justify-content: space-around;
        padding: 5px 0;
    }

    .pt-mobile-main-nav .pt-market-main-menu a {
        flex-direction: column;
        gap: 4px;
        font-size: 0.75rem;
        padding: 8px !important;
    }

    /* 🏆 HIDE the original menu inside the sidebar drawer on mobile only */
    .pt-market-sidebar .pt-market-main-menu {
        display: none !important;
    }

    /* Turn Sidebar into an Off-Canvas Drawer */
    .pt-market-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -100%; 
        width: 85% !important;
        max-width: 380px !important;
        height: 100dvh !important; 
        background: #fff;
        z-index: 99999 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 25px rgba(0,0,0,0.2);
        margin: 0;
    }

    .pt-market-sidebar.is-open { left: 0; }

    .pt-nav-card {
        max-height: 100dvh !important;
        height: 100% !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding-bottom: 40px !important;
    }
    
    .pt-mobile-filter-bar {
        display: block;
        margin-bottom: 20px;
        position: sticky;
        top: 10px;
        z-index: 99;
    }

    .pt-close-filters-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        border-bottom: 1px solid #e4e6eb;
        background: #fff;
    }

    .pt-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0;
        width: 100vw; height: 100vh;
        background: rgba(0,0,0,0.6);
        z-index: 99998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .pt-sidebar-overlay.is-active { display: block; opacity: 1; }
    
    /* Search Bar Tweaks */
    .pt-market-search-form {
        flex-direction: column;
        border-radius: 12px;
        padding: 15px;
        align-items: stretch;
    }
    
    .pt-mobile-sell-btn-wrapper {
        display: flex !important;
        flex-shrink: 0;
        align-items: center;
    }

    .pt-mobile-sell-btn-wrapper .pt-sidebar-sell-btn {
        width: auto !important;
        margin-bottom: 0 !important;
        white-space: nowrap;
        height: auto !important;
        padding: 7px 14px !important;
        font-size: 0.75rem !important;
        letter-spacing: 0.3px !important;
        border-radius: 6px !important;
        box-shadow: 0 2px 6px rgba(230, 0, 0, 0.2) !important;
    }
}

/* ==========================================================================
   MARKETPLACE — Floating Clear Filters Pill
   ========================================================================== */

.pt-mkt-clear-pill {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(90px);
    opacity: 0;
    pointer-events: none;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #111;
    color: #fff;
    border-radius: 50px;
    padding: 10px 10px 10px 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    white-space: nowrap;
}

.pt-mkt-clear-pill.pt-mcf-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.pt-mcf-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pt-mcf-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    background: #d00;
    padding: 7px 14px;
    border-radius: 50px;
    transition: background 0.2s;
}

.pt-mcf-btn:hover,
.pt-mcf-btn:focus {
    background: #b00;
    color: #fff;
    text-decoration: none;
}
}