/* ============================
   LISTING — Layout principal
   Cor marca: #D6C899
   ============================ */

:root {
    --ji-brand: #D6C899;
    --ji-brand-dark: #b8a76e;
    --ji-brand-light: #f0e6c8;
    --ji-dark: #1a1a2e;
    --ji-gray-900: #2d2d3d;
    --ji-gray-700: #4a4a5a;
    --ji-gray-500: #7a7a8a;
    --ji-gray-300: #d1d1d9;
    --ji-gray-100: #f4f4f7;
    --ji-white: #ffffff;
    --ji-danger: #e74c3c;
    --ji-success: #2ecc71;
    --ji-radius: 12px;
    --ji-radius-sm: 8px;
    --ji-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --ji-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --ji-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ji-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* RESET DO PLUGIN */
.ji-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.ji-wrapper {
    font-family: var(--ji-font);
    color: var(--ji-gray-900);
    line-height: 1.5;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* CONTAINER GRID */
.ji-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    align-items: start;
}

/* HEADER DA LISTAGEM */
.ji-listing-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ji-gray-300);
}

.ji-total {
    font-size: 14px;
    color: var(--ji-gray-500);
    flex: 1;
}

.ji-total strong {
    color: var(--ji-brand-dark);
    font-size: 16px;
}

.ji-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--ji-brand);
    color: var(--ji-dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.ji-tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--ji-dark);
    line-height: 1;
}

/* SELECT ORDENAR */
.ji-sort-wrapper {
    position: relative;
}

.ji-select {
    appearance: none;
    background: var(--ji-white);
    border: 1px solid var(--ji-gray-300);
    border-radius: var(--ji-radius-sm);
    padding: 8px 36px 8px 12px;
    font-size: 14px;
    color: var(--ji-gray-700);
    cursor: pointer;
    transition: border-color var(--ji-transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%237a7a8a' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 160px;
}

.ji-select:focus {
    outline: none;
    border-color: var(--ji-brand);
    box-shadow: 0 0 0 3px rgba(214, 200, 153, 0.2);
}

/* GRID DE CARDS */
.ji-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* PAGINAÇÃO */
.ji-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--ji-gray-300);
}

.ji-page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ji-gray-300);
    background: var(--ji-white);
    border-radius: var(--ji-radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--ji-gray-700);
    cursor: pointer;
    transition: all var(--ji-transition);
}

.ji-page-btn:hover,
.ji-page-btn.ji-active {
    background: var(--ji-brand);
    border-color: var(--ji-brand);
    color: var(--ji-dark);
    font-weight: 700;
}

/* NO RESULTS */
.ji-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--ji-gray-500);
    font-size: 16px;
}

/* LOADING */
.ji-loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.ji-loading.ji-active {
    display: block;
}

.ji-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--ji-gray-300);
    border-top-color: var(--ji-brand);
    border-radius: 50%;
    animation: ji-spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes ji-spin {
    to {
        transform: rotate(360deg);
    }
}

/* BOTÃO FILTRO MOBILE */
.ji-filter-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--ji-brand) !important;
    color: var(--ji-dark) !important;
    border: none;
    padding: 12px 24px;
    border-radius: var(--ji-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    width: 100%;
    justify-content: center;
}

.ji-filter-toggle:hover,
.ji-filter-toggle:focus {
    background: var(--ji-brand-dark, #b8a76e) !important;
    color: var(--ji-dark, #1a1a2e) !important;
    opacity: 1 !important;
}

/* OVERLAY MOBILE */
.ji-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity var(--ji-transition);
}

.ji-overlay.ji-active,
.ji-overlay.ji-is-open {
    display: block;
    opacity: 1;
}

/* SR-ONLY */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* BOTÃO LIMPAR FILTROS (no header) */
.ji-btn--clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid var(--ji-gray-300);
    color: var(--ji-gray-500);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ji-transition);
    white-space: nowrap;
}

.ji-btn--clear-filters:hover {
    background: var(--ji-danger);
    color: var(--ji-white);
    border-color: var(--ji-danger);
}

/* Esconder tab "Todos" quando finalidade definida */
.ji-wrapper[data-finalidade]:not([data-finalidade=""]) .ji-tab[data-value=""] {
    display: none;
}

/* ============================
   RESPONSIVO
   ============================ */

@media (max-width: 1024px) {
    .ji-container {
        grid-template-columns: 260px 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .ji-wrapper {
        padding: 12px;
    }

    .ji-container {
        grid-template-columns: 1fr;
    }

    .ji-filter-toggle {
        display: flex;
    }

    .ji-listing-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ji-sort-wrapper {
        width: 100%;
    }

    .ji-sort-wrapper .ji-select {
        width: 100%;
    }

    /* Cards centralizados no mobile */
    .ji-cards {
        max-width: 440px;
        margin: 0 auto;
        padding: 0 4px;
        box-sizing: border-box;
    }
}