/* Category Detail Page Styles */

/* Page Background */
body {
    background-color: #f1f4f6;
}

.ad-page-banner { margin: 10px 0; }

/* Category Header Section */
.category-header-section {
    background: white;
    padding: 24px 0;
    border-bottom: 1px solid #e2e8f0;
}

.category-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
}

.category-header-left h1 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-nav a {
    color: #64748b;
    text-decoration: none;
}

.breadcrumb-nav a:hover { color: var(--primary); }
.breadcrumb-nav i { font-size: 10px; color: #cbd5e1; }
.breadcrumb-nav span { color: #1e293b; font-weight: 600; }

.category-search-form {
    display: flex;
    flex-shrink: 0;
    width: 450px;
}

.category-search-form input {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid #cbd5e1;
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-size: 15px;
    outline: none;
}

.category-search-form input:focus { border-color: var(--primary); }

.category-search-form button {
    padding: 12px 25px;
    background: var(--accent);
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-dark);
}

/* Category Layout */
.category-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 180px;
    gap: 24px;
    padding: 24px 0;
    max-width: var(--container-max);
    margin: 0 auto;
}

/* Sidebar Styling */
.category-sidebar {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 90px;
}

.sidebar-header {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
}

.sidebar-parent-category {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--primary);
}

.sidebar-subcategories {
    list-style: none !important;
    padding: 0;
    margin: 0;
}

.sidebar-subcategories li { margin-bottom: 4px; }

.sidebar-subcategories a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar-subcategories a:hover,
.sidebar-subcategories a.active {
    color: var(--primary);
    font-weight: 700;
    background: #f1f5f9;
}

/* Ad List Cards */
.ad-list-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s;
    position: relative;
}

.ad-list-card:hover { border-color: var(--primary); }

.ad-list-info h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: #222;
    line-height: 1.3;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ad-list-price {
    font-size: 16px;
    font-weight: 700;
    color: #00a878;
    margin-bottom: 0;
    line-height: 1.2;
}

.ad-list-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
    font-size: 11px;
    color: #888;
}

/* Header UI Elements */
.category-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-count { font-size: 14px; font-weight: 700; color: #1e293b; }

.btn-save-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 18px;
    border-radius: 20px;
    transition: all 0.2s;
}

.btn-save-search:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0f9ff;
}

.ad-list-link {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    color: inherit;
    text-decoration: none;
}

.ad-list-img-wrapper {
    width: 144px;
    height: 108px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    background: #f5f5f5;
}

.ad-list-img-wrapper img { width: 100%; height: 100%; object-fit: cover; }

.ad-list-badge {
    position: absolute;
    bottom: 4px; right: 4px;
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 600;
}

.ad-list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 2px 0;
}

.ad-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 2px;
}

/* Featured Ad V2 */
.featured-ad-card-v2 {
    border: 2px solid #ff9800 !important;
    background: #f8fcfc !important;
    box-shadow: 0 4px 15px rgba(255,152,0,0.1) !important;
}

.featured-ad-link-v2 {
    display: flex;
    flex-direction: column !important;
    gap: 0 !important;
    padding: 0 !important;
}

.featured-ad-images-v2 {
    position: relative;
    background: #fff;
    height: 100px;
    overflow: hidden;
}

.ribbon-container-v2 {
    position: absolute;
    top: 0; left: 0; width: 85px; height: 85px;
    z-index: 10; overflow: hidden;
}

.featured-ribbon-v2 { width: 100%; height: auto; position: absolute; top: 0; left: 0; }

.ribbon-text-v2 {
    position: absolute;
    top: 14px; left: -2px; right: 0;
    text-align: center; color: white;
    font-size: 8px; font-weight: 900;
    text-transform: uppercase; z-index: 11;
    letter-spacing: 0.8px; text-shadow: 1px 1px 1px rgba(0,0,0,0.4);
    pointer-events: none;
}

.featured-img-grid-v2 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px; height: 100px;
}

.thumb-v2 { height: 100%; width: 100%; position: relative; overflow: hidden; }
.thumb-v2 img { width: 100%; height: 100%; object-fit: cover; }

.more-overlay-v2 {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
    color: white; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px;
}

.featured-ad-card-v2 .ad-list-info {
    padding: 10px 15px !important;
    background: #fff9f2 !important;
}

/* Promotion Icons */
.promo-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; font-size: 13px; border-radius: 4px;
    background: #f8fafc; border: 1px solid #e2e8f0;
}

.promo-icon.bump-up-ad { color: #ff9800; font-size: 12px; position: relative; }
.promo-icon.bump-up-ad .promo-count {
    position: absolute; top: -4px; right: -4px;
    background: #f44336; color: white; font-size: 8px; font-weight: 700;
    padding: 1px 3px; border-radius: 50%; min-width: 14px; height: 14px;
    display: flex; align-items: center; justify-content: center;
}

.promo-icon.top-ad { color: #9c27b0; font-size: 14px; }
.promo-icon.featured-ad { color: #ffc107; font-size: 14px; }
.promo-icon.urgent-ad { color: #f44336; font-size: 13px; }
.promo-icon.promotional-ad { color: #2196f3; font-size: 12px; }

/* Sell CTA Card */
.sell-cta-card {
    background: #e6fcf5;
    border: 1px solid #c3fae8;
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 20px;
}

.sell-cta-content { display: flex; align-items: center; gap: 30px; }
.sell-cta-image img { width: 120px; height: auto; display: block; }
.sell-cta-text h4 { font-size: 18px; font-weight: 800; color: #087f5b; margin-bottom: 6px; }
.sell-cta-text p { font-size: 14px; color: #099268; margin-bottom: 15px; }

.btn-sell-cta {
    display: inline-block; padding: 8px 20px;
    background: #12b886; color: white;
    text-decoration: none; border-radius: 20px;
    font-size: 13px; font-weight: 700; transition: background 0.2s;
}

.btn-sell-cta:hover { background: #0ca678; }

/* SEO Description Card */
.category-seo-description-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    margin-top: 30px;
    margin-bottom: 40px;
}

.seo-content-header h3 { font-size: 16px; font-weight: 800; color: #1e293b; margin-bottom: 15px; }
.seo-content-body { font-size: 14px; color: #475569; line-height: 1.7; }

.btn-show-more {
    background: none; border: none; color: var(--primary);
    font-weight: 700; font-size: 13px; cursor: pointer;
    padding: 0; margin-top: 10px; display: flex; align-items: center; gap: 5px;
}

.btn-show-more:hover { text-decoration: underline; }

/* Pagination */
.pagination-wrapper { margin: 30px 0; display: flex; justify-content: center; }
.pagination-wrapper nav .pagination {
    display: flex; list-style: none; padding: 0; margin: 0; align-items: center; gap: 8px;
}

.pagination-wrapper .page-link {
    display: flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    color: #1c7ed6; font-size: 14px; font-weight: 700;
    border-radius: 4px; text-decoration: none; transition: all 0.2s;
}

.pagination-wrapper .page-item.active .page-link {
    background: #1c7ed6; color: white;
}

.pagination-wrapper .page-item.disabled .page-link { color: #cbd5e1; cursor: not-allowed; }

/* Fallback Banners */
.fallback-banner {
    color: #fff; padding: 40px 20px; text-align: center;
    font-size: 32px; font-weight: 700; text-transform: uppercase;
}

.header-fallback { background: #ff9800; border-radius: 4px; }
.footer-fallback { background: #10b981; font-size: 42px; }

/* Responsive */
@media (max-width: 1024px) {
    .category-layout { grid-template-columns: 1fr; }
    .category-sidebar, .category-right-sidebar { display: none; }
    .category-header-top { flex-direction: column; }
    .category-search-form { width: 100%; }
    .ad-list-link { flex-direction: column; }
    .ad-list-img-wrapper { width: 100%; height: 180px; }
}

@media (max-width: 640px) {
    .category-search-form button { padding: 12px; }
    .category-header-top { margin-bottom: 10px; }
    .pillar-chip { flex: 1 1 calc(50% - 10px); justify-content: center; padding: 10px !important; }
    .fallback-banner { padding: 20px 10px !important; font-size: 18px !important; }
}

/* Ribbon V3 Styles (Premium Refined Look) */
.ad-badges-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.featured-ribbon-v3, .urgent-ribbon-v3 {
    position: absolute;
    padding: 3px 12px 3px 8px;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.15);
    min-width: 60px;
}

/* Featured: Top Left Wrap */
.featured-ribbon-v3 {
    top: 10px;
    left: -4px;
    background: linear-gradient(90deg, #f59e0b, #d97706);
    clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%);
}

.featured-ribbon-v3::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    width: 4px;
    height: 6px;
    background: #92400e;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

/* Urgent: Top Right Wrap (Mirrored) */
.urgent-ribbon-v3 {
    top: 10px;
    right: -4px;
    padding: 3px 8px 3px 12px;
    background: linear-gradient(270deg, #ef4444, #dc2626);
    clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%);
}

.urgent-ribbon-v3::before {
    content: "";
    position: absolute;
    top: 100%;
    right: 0;
    width: 4px;
    height: 6px;
    background: #991b1b;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

/* Fix for standard list image display */
.ad-list-img-wrapper {
    background-color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden; /* Keep mirrored wraps contained if needed, but the ribbons use negative offsets */
}

.ad-list-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
