/**
 * Listings list/search page styles
 *
 * Extracted verbatim from the embedded <style> block in src/clasificados/templates/listings/list.html
 * (design-system token consolidation refactor, 2026-07-02).
 *
 * Page-scoped rules — loaded ONLY by that page at the same cascade position
 * the inline <style> occupied (its extra_css/extra_head block), so computed
 * styles are byte-for-byte identical. NOT loaded globally via base.html:
 * these selectors are page-namespaced and would risk regressions elsewhere.
 * Consumes design tokens from tokens.css.
 */

    /* List Layout */
    .list-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        margin-bottom: 24px;
    }

    .list-header__title {
        font-family: var(--font-body);
        font-size: 1.75rem;
        font-weight: 600;
        color: var(--black);
    }

    .list-header__count {
        font-size: 1rem;
        color: var(--gray-600);
    }

    .entity-links {
        margin-bottom: 18px;
        padding: 14px;
        border: 1px solid var(--gray-200);
        background: var(--white);
        border-radius: 10px;
    }

    .entity-links__title {
        font-size: 0.95rem;
        font-weight: 700;
        margin-bottom: 8px;
    }

    .entity-links__items {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .entity-links__item {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        border: 1px solid var(--gray-200);
        border-radius: 999px;
        padding: 6px 10px;
        font-size: 0.82rem;
        color: var(--gray-700);
    }

    .entity-links__item:hover {
        border-color: var(--red-accent);
        color: var(--red-accent);
    }

    /* Search input */
    .search-input {
        flex: 1 1 200px;
        padding: 10px 14px 10px 36px;
        background: var(--gallery-white);
        border: 1px solid var(--gray-200);
        border-radius: 8px;
        font-family: var(--font-body);
        font-size: 0.875rem;
        color: var(--gray-700);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: 12px center;
    }

    .search-input:focus {
        outline: none;
        border-color: var(--red-accent);
    }

    .search-input::placeholder {
        color: var(--gray-400);
    }

    /* Filters Bar */
    .filters-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        padding: 16px;
        background: var(--white);
        border: 1px solid var(--card-border);
        border-radius: var(--card-radius);
        margin-bottom: 24px;
    }

    .filter-select {
        padding: 10px 14px;
        padding-right: 32px;
        background: var(--gallery-white);
        border: 1px solid var(--gray-200);
        border-radius: 8px;
        font-family: var(--font-body);
        font-size: 0.875rem;
        color: var(--gray-700);
        cursor: pointer;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
    }

    .filter-select:focus {
        outline: none;
        border-color: var(--red-accent);
    }

    .filter-input {
        padding: 10px 14px;
        background: var(--gallery-white);
        border: 1px solid var(--gray-200);
        border-radius: 8px;
        font-family: var(--font-body);
        font-size: 0.875rem;
        color: var(--gray-700);
        width: 120px;
    }

    .filter-input:focus {
        outline: none;
        border-color: var(--red-accent);
    }

    .filter-input::placeholder {
        color: var(--gray-400);
    }

    .filter-btn {
        padding: 10px 20px;
        background: var(--red-accent);
        color: white;
        border: none;
        border-radius: 8px;
        font-family: var(--font-body);
        font-size: 0.875rem;
        font-weight: 500;
        cursor: pointer;
        transition: background 0.15s ease;
    }

    .filter-btn:hover {
        background: var(--red-hover);
    }

    .filter-btn {
        position: relative;
        overflow: hidden;
    }

    .filter-btn__progress {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        background: rgba(255,255,255,0.25);
        width: 0;
        transition: none;
        pointer-events: none;
    }

    .filter-btn__progress--active {
        transition: width 1.5s linear;
        width: 100%;
    }

    .filter-clear {
        padding: 10px 14px;
        background: transparent;
        color: var(--gray-600);
        border: 1px solid var(--gray-200);
        border-radius: 8px;
        font-family: var(--font-body);
        font-size: 0.875rem;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .filter-clear:hover {
        border-color: var(--gray-400);
        color: var(--gray-900);
    }

    /* Sort dropdown */
    .sort-bar {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 16px;
    }

    .sort-label {
        font-size: 0.875rem;
        color: var(--gray-600);
    }

    /* Listings Grid — dense for classifieds scanning */
    .listings-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 12px;
    }

    /* Listing Card */
    .listing-card {
        background: var(--white);
        border: 1px solid var(--card-border);
        border-radius: var(--card-radius);
        overflow: hidden;
        transition: all 0.2s ease;
    }

    .listing-card:hover {
        box-shadow: var(--card-shadow-hover);
        transform: translateY(-2px);
    }

    .listing-card__link {
        display: block;
        text-decoration: none;
        color: inherit;
    }

    .listing-card__image {
        position: relative;
        height: 140px;
        background: var(--warm-white);
        overflow: hidden;
    }

    .listing-card__image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

    .listing-card:hover .listing-card__image img {
        transform: scale(1.03);
    }

    .listing-card__image-placeholder {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        color: var(--gray-400);
        font-size: 0.875rem;
    }

    /* Rich no-photo placeholder: seller initial + name */
    .listing-card__image-placeholder--rich {
        flex-direction: column;
        gap: 6px;
        background: linear-gradient(135deg, var(--gallery-white, #f5f5f5) 0%, var(--warm-white, #faf8f5) 100%);
    }

    .listing-card__seller-initial {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--red-accent, #D32F2F);
        color: white;
        font-size: 1rem;
        font-weight: 700;
        font-family: var(--font-body);
    }

    .listing-card__seller-name {
        font-size: 0.75rem;
        color: var(--gray-500, #8B8B8B);
        font-weight: 500;
        text-align: center;
        max-width: 80%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Honest no-photo placeholder (UX bug 11). The .listing-card__image tile
       paints the warm background and .listing-card__image-placeholder above
       already centers and fills it, so this only stacks icon over label. */
    .listing-card__no-photo {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        color: var(--gray-500);
    }

    .listing-card__no-photo svg {
        opacity: 0.4;
        color: var(--gray-400);
    }

    .listing-card__no-photo span {
        font-size: 0.75rem;
        font-weight: 500;
        letter-spacing: 0.02em;
        text-transform: uppercase;
    }

    .listing-card__location {
        position: absolute;
        bottom: 8px;
        left: 8px;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 4px 8px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(4px);
        border-radius: 6px;
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--gray-900);
    }

    .listing-card__content {
        padding: 10px 12px;
    }

    .listing-card__title {
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--black);
        margin-bottom: 4px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .listing-card__specs {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 8px;
        font-size: 0.75rem;
        color: var(--gray-600);
        margin-bottom: 6px;
    }

    .listing-card__price {
        font-family: var(--font-body);
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--black);
    }

    .listing-card__price-note {
        font-size: 0.8125rem;
        font-weight: 400;
        color: var(--gray-600);
    }

    /* Pagination */
    .pagination {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        margin-top: 40px;
        padding-top: 24px;
        border-top: 1px solid var(--gray-200);
    }

    .pagination__btn {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        height: 40px;
        padding: 0 12px;
        background: var(--white);
        border: 1px solid var(--gray-200);
        border-radius: 8px;
        font-size: 0.875rem;
        color: var(--gray-700);
        transition: all 0.15s ease;
    }

    .pagination__btn:hover:not(.pagination__btn--disabled) {
        border-color: var(--red-accent);
        color: var(--red-accent);
    }

    .pagination__btn--active {
        background: var(--red-accent);
        border-color: var(--red-accent);
        color: white;
    }

    .pagination__btn--disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    .pagination__ellipsis {
        color: var(--gray-400);
        padding: 0 4px;
    }

    /* No results */
    .no-results {
        text-align: center;
        padding: 64px 24px;
        background: var(--white);
        border: 1px solid var(--card-border);
        border-radius: var(--card-radius);
    }

    .no-results__icon {
        font-size: 3rem;
        margin-bottom: 16px;
    }

    .no-results__title {
        font-family: var(--font-body);
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--black);
        margin-bottom: 8px;
    }

    .no-results__text {
        color: var(--gray-600);
    }

    /* Autocomplete filter component */
    .filter-autocomplete {
        position: relative;
        min-width: 160px;
    }

    .filter-autocomplete__control {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px;
        padding: 6px 10px;
        background: var(--gallery-white);
        border: 1px solid var(--gray-200);
        border-radius: 8px;
        cursor: text;
        min-height: 40px;
    }

    .filter-autocomplete__control:focus-within {
        border-color: var(--red-accent);
    }

    .filter-autocomplete__tags {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .filter-autocomplete__tag {
        display: inline-flex;
        align-items: center;
        gap: 2px;
        padding: 2px 8px;
        background: var(--red-accent);
        color: white;
        border-radius: 4px;
        font-size: 0.75rem;
        font-weight: 500;
        white-space: nowrap;
    }

    .filter-autocomplete__tag-remove {
        background: none;
        border: none;
        color: white;
        cursor: pointer;
        font-size: 0.875rem;
        padding: 0 2px;
        line-height: 1;
        opacity: 0.8;
    }

    .filter-autocomplete__tag-remove:hover {
        opacity: 1;
    }

    .filter-autocomplete__input {
        border: none;
        outline: none;
        background: transparent;
        font-family: var(--font-body);
        font-size: 0.875rem;
        color: var(--gray-700);
        flex: 1;
        min-width: 60px;
        padding: 2px 0;
    }

    .filter-autocomplete__input::placeholder {
        color: var(--gray-400);
    }

    .filter-autocomplete__dropdown {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 100;
        background: var(--white);
        border: 1px solid var(--gray-200);
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        max-height: 240px;
        overflow-y: auto;
        margin-top: 4px;
    }

    .filter-autocomplete__dropdown--open {
        display: block;
    }

    .filter-autocomplete__option {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        cursor: pointer;
        font-size: 0.875rem;
        color: var(--gray-700);
        transition: background 0.1s;
    }

    .filter-autocomplete__option:hover {
        background: var(--warm-white);
    }

    .filter-autocomplete__option--selected {
        background: var(--gallery-white);
        font-weight: 500;
    }

    .filter-autocomplete__option--hidden {
        display: none;
    }

    .filter-autocomplete__option input[type="checkbox"] {
        accent-color: var(--red-accent);
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    .filter-autocomplete__option-label {
        flex: 1;
    }

    .filter-autocomplete__count {
        color: var(--gray-400);
        font-size: 0.8125rem;
    }

    /* Subcategory pills */
    .subcategory-pills {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 16px;
    }

    .subcategory-pill {
        display: inline-flex;
        align-items: center;
        padding: 6px 14px;
        border: 1px solid var(--gray-200);
        border-radius: 999px;
        font-size: 0.875rem;
        color: var(--gray-700);
        background: var(--white);
        transition: all 0.15s ease;
    }

    .subcategory-pill:hover {
        border-color: var(--red-accent);
        color: var(--red-accent);
    }

    .subcategory-pill--active {
        background: var(--red-accent);
        border-color: var(--red-accent);
        color: white;
    }

    /* Has-images toggle */
    .filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 10px 14px;
        background: var(--gallery-white);
        border: 1px solid var(--gray-200);
        border-radius: 8px;
        font-family: var(--font-body);
        font-size: 0.875rem;
        color: var(--gray-700);
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .filter-toggle:hover {
        border-color: var(--red-accent);
    }

    .filter-toggle--active {
        background: var(--red-accent);
        border-color: var(--red-accent);
        color: white;
    }

    .filter-toggle input[type="checkbox"] {
        display: none;
    }

    /* Manual load-more control */
    .load-more-listings {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 32px 0;
        min-height: 80px;
    }

    .load-more-listings__btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 180px;
        min-height: 44px;
        padding: 12px 22px;
        border: 1px solid var(--red-accent, #D32F2F);
        border-radius: 8px;
        background: var(--red-accent, #D32F2F);
        color: #fff;
        font-family: var(--font-body);
        font-weight: 700;
        cursor: pointer;
        transition: opacity 0.15s ease, transform 0.15s ease;
    }

    .load-more-listings__btn:hover:not(:disabled) {
        transform: translateY(-1px);
    }

    .load-more-listings__btn:disabled {
        cursor: default;
        opacity: 0.55;
    }

    .scroll-loader {
        display: flex;
        align-items: center;
        gap: 10px;
        color: var(--gray-500, #8B8B8B);
        font-size: 0.875rem;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .scroll-loader--visible {
        opacity: 1;
    }

    .scroll-loader__spinner {
        width: 20px;
        height: 20px;
        border: 2px solid var(--gray-200, #e5e7eb);
        border-top-color: var(--red-accent, #D32F2F);
        border-radius: 50%;
        animation: spin 0.7s linear infinite;
    }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }

    .scroll-end {
        text-align: center;
        padding: 24px 0;
        color: var(--gray-400, #C4C4C4);
        font-size: 0.875rem;
    }

    @media (max-width: 768px) {
        .list-header {
            flex-direction: column;
            align-items: flex-start;
        }

        .filters-bar {
            padding: 12px;
        }

        .filter-select,
        .filter-input {
            flex: 1;
            min-width: 100px;
        }

        .listings-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 8px;
        }

        .listing-card__image {
            height: 100px;
        }

        .listing-card__title {
            font-size: 0.8rem;
            -webkit-line-clamp: 1;
        }

        .listing-card__price {
            font-size: 0.9rem;
        }

        .listing-card__specs {
            display: none;
        }

        .subcategory-pills {
            gap: 6px;
        }

        .subcategory-pill {
            font-size: 0.8125rem;
            padding: 5px 10px;
        }

    }
