/**
 * Craigslist Extras — Addon Styles
 * View modes: list (no thumb), thumb (default), gallery
 * Related searches sidebar
 */

/* ---- Favorites ---- */
.cl-result-fav.is-fav {
    color: #fc0;
}

.cl-fav-btn.is-fav {
    color: #fc0;
}

/* ---- Hidden Posts Notice ---- */
.cl-hidden-notice {
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
    background: #f8f8f8;
    border: 1px solid #e8e8e8;
    border-radius: 3px;
}

.cl-hidden-notice .cl-restore-hidden {
    color: #00c;
    text-decoration: none;
}

.cl-hidden-notice .cl-restore-hidden:hover {
    text-decoration: underline;
}

/* ---- List Mode (no thumbnails, single-line Craigslist rows) ---- */
/* Layout: ☆ Title · location · date · pic */

.cl-listings.cl-view-list .cl-result-thumb {
    display: none;
}

.cl-listings.cl-view-list .cl-result-row {
    padding: 8px 4px;
    border-bottom: none;
    border-top: 1px solid #ddd;
    align-items: baseline;
}

.cl-listings.cl-view-list .cl-result-row:hover {
    background: #f0f0ff;
}

/* Flatten info into single inline flow */
/* Begin Version 6.5.7 - Keep LIST row on a single line; let title truncate with ellipsis instead of overlapping siblings. Author: Hasif Ahmed (xmart@live.com) */
.cl-listings.cl-view-list .cl-result-info {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0;
    min-width: 0;
}

/* Reorder: title(1) → location(2) → meta(3) */
.cl-listings.cl-view-list .cl-result-title-row {
    order: 1;
    display: contents;
}

.cl-listings.cl-view-list .cl-result-fav {
    margin-right: 6px;
    flex-shrink: 0;
}

.cl-listings.cl-view-list .cl-result-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 0;
    min-width: 0;
}
/* End Version 6.5.7 */

.cl-listings.cl-view-list .cl-result-location {
    order: 2;
    font-size: 13px;
    font-weight: normal;
    color: #333;
    margin-bottom: 0;
    flex-shrink: 0;
    white-space: nowrap;
}

.cl-listings.cl-view-list .cl-result-location::before {
    content: "\00b7";
    color: #999;
    margin: 0 6px;
}

.cl-listings.cl-view-list .cl-result-meta {
    order: 3;
    display: contents;
    margin-top: 0;
}

.cl-listings.cl-view-list .cl-result-time {
    font-size: 13px;
    color: #333;
    flex-shrink: 0;
    white-space: nowrap;
}

.cl-listings.cl-view-list .cl-result-time::before {
    content: "\00b7";
    color: #999;
    margin: 0 6px;
}

/* Show "pic" text instead of camera emoji */
.cl-listings.cl-view-list .cl-result-haspic {
    font-size: 0;
    line-height: 0;
    flex-shrink: 0;
    white-space: nowrap;
}

.cl-listings.cl-view-list .cl-result-haspic::before {
    content: "\00b7";
    font-size: 13px;
    color: #999;
    margin: 0 6px;
}

.cl-listings.cl-view-list .cl-result-haspic::after {
    content: "pic";
    font-size: 13px;
    color: #f60;
}

/* ---- Thumb Mode (default — small thumbnail + info) ---- */
/* No overrides needed — uses base .cl-listings styles from craigslist.css */

/* ---- Gallery Mode (image grid) ---- */
.cl-listings.cl-view-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.cl-listings.cl-view-gallery .cl-result-row {
    border: 1px solid #e8e8e8;
    border-radius: 3px;
    padding: 4px;
    flex-direction: column;
}

.cl-listings.cl-view-gallery .cl-result-thumb {
    width: 100%;
    height: 180px;
    margin-bottom: 4px;
}

.cl-listings.cl-view-gallery .cl-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cl-listings.cl-view-gallery .cl-result-thumb .cl-no-image {
    width: 100%;
    height: 100%;
}

.cl-listings.cl-view-gallery .cl-result-info {
    padding: 0;
}

.cl-listings.cl-view-gallery .cl-result-meta,
.cl-listings.cl-view-gallery .cl-result-location {
    display: none;
}

.cl-listings.cl-view-gallery .cl-result-title-row {
    font-size: 13px;
    line-height: 1.3;
}

/* ---- Related Searches (sidebar) ---- */
.cl-related-searches {
    margin-top: 18px;
    padding-top: 10px;
}

.cl-related-searches-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.cl-related-arrow {
    font-size: 10px;
    color: #00c;
    line-height: 1;
}

.cl-related-label {
    font-size: 14px;
    font-weight: bold;
    color: #00c;
}

.cl-related-searches-list {
    list-style: none;
    margin: 6px 0 0 16px;
    padding: 0;
}

.cl-related-searches-list li {
    margin: 0;
    padding: 2px 0;
}

.cl-related-searches-list li a {
    color: #00c;
    text-decoration: none;
    font-size: 14px;
}

.cl-related-searches-list li a:hover {
    text-decoration: underline;
}

/* ---- Safety Page ---- */
.cl-safety-page {
    max-width: 720px;
    padding: 20px 10px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.cl-safety-page h2 {
    font-size: 18px;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.cl-safety-page h3 {
    font-size: 15px;
    margin: 20px 0 8px;
    color: #222;
}

.cl-safety-page ul {
    margin: 6px 0 12px 20px;
    padding: 0;
}

.cl-safety-page li {
    margin: 4px 0;
}

/* ---- Mobile Filter Toggle ---- */
/* Desktop: toggle button hidden, advanced filters always visible */
.cl-filter-toggle-btn {
    display: none;
}
.cl-advanced-filters {
    /* no special styling on desktop — inherits normal sidebar layout */
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .cl-listings.cl-view-gallery {
        grid-template-columns: 1fr 1fr;
    }

    /* Filter toggle button — CL-style "+" chip inline with filter checks */
    .cl-filter-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: auto;
        border: 1px solid #bbb;
        background: #fff;
        font-size: 18px;
        font-weight: 300;
        color: #333;
        cursor: pointer;
        padding: 4px 0;
        line-height: 1;
        vertical-align: middle;
        flex-shrink: 0;
        align-self: stretch;
    }
    .cl-filter-toggle-btn:active {
        background: #eee;
    }

    /* Advanced filters hidden by default on mobile */
    .cl-advanced-filters {
        display: none;
        padding-top: 10px;
    }
    .cl-advanced-filters.is-open {
        display: block;
    }

    /* Style the advanced filters when visible */
    .cl-advanced-filters .cl-price-filter,
    .cl-advanced-filters .cl-custom-filter {
        display: block;
        margin-bottom: 8px;
    }
    .cl-advanced-filters .cl-price-filter label,
    .cl-advanced-filters .cl-price-label,
    .cl-advanced-filters .cl-custom-filter > label {
        font-size: 11px;
        font-weight: bold;
        text-transform: uppercase;
        margin-bottom: 3px;
    }
    .cl-advanced-filters .cl-custom-filter select,
    .cl-advanced-filters .cl-custom-filter input[type="text"] {
        width: 100%;
        font-size: 14px;
        padding: 6px 8px;
        border: 1px solid #aaa;
    }
    .cl-advanced-filters .cl-price-input {
        width: 80px;
        font-size: 14px;
        padding: 6px 8px;
        border: 1px solid #aaa;
    }
    .cl-advanced-filters .cl-filter-actions {
        display: block;
        margin-top: 8px;
    }

    /* Related searches hidden on mobile */
    .cl-related-searches {
        display: none !important;
    }
}

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

    .cl-filter-toggle-btn {
        width: 30px;
        height: 30px;
        font-size: 18px;
    }
}