#main-searchbox {
    margin-left: auto;
}

/* ===== CONTAINER (GERAL) ===== */
#content {
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 6rem);
    width: 100%;
    max-width: 1800px;
    box-sizing: border-box;
}

/* ===== LAYOUT ITEM (ESCOPADO) ===== */
.item.show #content {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.item.show #content > .media-embeds {
    flex: 0 0 38%;
    max-width: 38%;
}

.item.show #content > dl {
    flex: 1;
    min-width: 300px;
    padding: 2rem;
    overflow: auto;
}

/* ===== TÍTULOS ===== */
.item.show #content h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.item.show #content h3 {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
}

/* ===== CARDS HOME ===== */
.card-img-top {
    transition: all 0.3s ease;
}

.card-img-top:hover {
    filter: brightness(0.8);
    transform: scale(1.05);
}

.card a,
.header-info a {
    text-decoration: none;
    outline: none;
    border: none;
    background: none !important;
}

/* ===== BUSCA FACETADA ===== */

.button.permalink {
    display: none;
}

nav.pagination form {
    display: flex;
    align-items: center;
    padding: 10px;
}

nav.pagination .row-count {
    padding: 10px;
}

.faceted-browse-page #section-content table .resource-link {
    flex-wrap: nowrap;
}

/* ===== LISTA DE ITENS ===== */

.resource-list {
    list-style: none;
    padding: 0;
    margin: 2rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.resource-list .item.resource {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.25s ease;
}

.resource-list .item.resource:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.resource-list .resource-link {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
}

.resource-list .resource-link img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.resource-list .resource-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

.resource-list .resource-link:hover .resource-name {
    color: #2563eb;
}

.resource-list .description {
    margin-top: 10px;
    margin-left: 96px;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ===== PREVIEW PDF ===== */

.item.show .media-embeds img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
}

/* ===== METADADOS ===== */

.item.show dl {
    margin: 0;
}

.item.show .property {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.item.show .property dt {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #777;
    margin-bottom: 4px;
    font-weight: 600;
}

.item.show .property dd {
    margin: 0;
    font-size: 1rem;
    color: #222;
    line-height: 1.5;
}

/* ===== LINKS ===== */

.item.show .property a {
    color: #2563eb;
    text-decoration: none;
}

.item.show .property a:hover {
    text-decoration: underline;
}

/* ===== TAGS ===== */

.item.show .property dd .value-content a {
    display: inline-block;
    background: #eef2ff;
    color: #3730a3;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    margin: 4px 6px 0 0;
}

/* ===== BADGES ===== */

.faceted-results td:nth-child(4) a {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.faceted-results td:nth-child(4) a[href*="Revogado"] {
    background: #ffe5e5;
    color: #d93025;
}

.faceted-results td:nth-child(4) a[href*="Vigente"] {
    background: #e6f4ea;
    color: #1e7e34;
}

.faceted-results td:nth-child(4) a[href*="consta"] {
    background: #fff4e5;
    color: #b26a00;
}

/* ===== EMENTA ===== */

.item.show .property dt + dd {
    max-width: 65ch;
}

/* ===== RELAÇÕES ===== */

.item.show .value.resource.items {
    display: flex;
    align-items: center;
    gap: 10px;
}

.item.show .value.resource.items img {
    width: 50px;
    border-radius: 6px;
}

/* ===== TABELAS ===== */

.item.show #resources-linked table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.item.show #resources-linked th {
    background: #f5f7fa;
    text-align: left;
    padding: 10px;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #555;
}

.item.show #resources-linked td {
    padding: 10px;
    border-top: 1px solid #eee;
}

.item.show #resources-linked tr:hover {
    background: #f9fafb;
}

/* ===== AJUSTES ===== */

#resources-linked {
    display: none;
}

/* ===== NAVEGAÇÃO ===== */

.browse-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 15px;
    background: #f8f9fb;
    border-radius: 10px;
    border: 1px solid #e0e3e8;
    font-size: 14px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-input-top {
    width: 50px;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    text-align: center;
}

.page-count {
    color: #666;
}

.pagination-buttons {
    display: flex;
    gap: 5px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button:hover {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.button.inactive {
    opacity: 0.4;
    pointer-events: none;
}

.row-count {
    color: #444;
    font-weight: 500;
}

.advanced-search {
    text-decoration: none;
    color: #007bff;
    font-weight: 500;
}

.advanced-search:hover {
    text-decoration: underline;
}

.sorting {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sorting select {
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #fff;
}

.sorting button {
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    background: #007bff;
    color: white;
    cursor: pointer;
}

.sorting button:hover {
    background: #0056b3;
}

/* ===== TABELA FACETADA ===== */

.faceted-results {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    background: #fff;
    border: 1px solid #e0e3e8;
    border-radius: 10px;
    overflow-x: auto;
    display: block;
}

.faceted-results thead {
    background: #f1f3f6;
}

.faceted-results th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e0e3e8;
}

.faceted-results td {
    padding: 12px;
    vertical-align: top;
    border-bottom: 1px solid #f0f0f0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.faceted-results tbody tr:hover {
    background: #f9fbff;
}

/* ===== LARGURAS FLEXÍVEIS ===== */

.faceted-results th,
.faceted-results td {
    min-width: 120px;
}

.faceted-results th:nth-child(1),
.faceted-results td:nth-child(1) {
    min-width: 260px;
}

.faceted-results th:nth-child(2),
.faceted-results td:nth-child(2) {
    min-width: 320px;
}

/* ===== RESOURCE LINK ===== */

.resource-link {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}

.resource-link img {
    width: 45px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.resource-name {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #0d6efd;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.resource-link:hover .resource-name {
    text-decoration: underline;
}

/* ===== RELAÇÕES ===== */

.item.show .value.resource.items .resource-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #eef2ff;
    padding: 8px 12px;
    border-radius: 999px;
    text-decoration: none;
    max-width: 100%;
}

.item.show .value.resource.items .resource-link img {
    width: 40px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    margin: 0;
}

.item.show .value.resource.items .resource-name {
    display: inline;
    overflow: visible;
    color: #2563eb;
    font-weight: 500;
    white-space: normal;
}

/* ===== SIDEBAR ===== */

.facets-container {
    background: #ffffff;
    border: 1px solid #e0e3e8;
    border-radius: 12px;
    padding: 16px;
}

.facets-container > legend {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1a1a1a;
}

.facet {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
    background: #f9fafb;
    transition: all 0.2s ease;
}

.facet:hover {
    border-color: #c7d2fe;
    background: #f5f7ff;
}

.facet legend {
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.select-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 220px;
    overflow-y: auto;
}

.select-list-item {
    margin-bottom: 6px;
}

.select-list-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.select-list-item label:hover {
    background: #eef2ff;
}

.select-list-item input {
    accent-color: #2563eb;
    cursor: pointer;
}

.facet input[type="text"] {
    width: 100% !important;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 0.9rem;
}

.facet input[type="text"]:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* ===== RESPONSIVO ===== */

@media (max-width: 1100px) {

    #content {
        display: flex;
        flex-direction: column;
    }

    .facets-container {
        width: 100%;
        margin-bottom: 20px;
    }
}

@media (max-width: 900px) {

    .item.show #content {
        flex-direction: column;
    }

    .item.show #content > .media-embeds,
    .item.show #content > dl {
        max-width: 100%;
    }
}

@media (max-width: 768px) {

    #content {
        padding: 0 1rem;
    }

    .faceted-results {
        font-size: 13px;
        overflow-x: auto;
        white-space: nowrap;
    }

    .browse-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination,
    .sorting {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .resource-link {
        gap: 8px;
    }

    .resource-link img {
        width: 36px;
        height: 48px;
    }
}

@media (max-width: 600px) {

    .resource-list .resource-link {
        flex-direction: column;
        align-items: flex-start;
    }

    .resource-list .description {
        margin-left: 0;
    }

    .resource-list .resource-link img {
        width: 100%;
        height: auto;
    }
}
/* ===== MOBILE: TABELA VIRA CARD ===== */

@media (max-width: 768px) {

    .faceted-results,
    .faceted-results tbody,
    .faceted-results tr,
    .faceted-results td {
        display: block;
        width: 100%;
    }

    /* remove cabeçalho */
    .faceted-results thead {
        display: none;
    }

    /* card */
    .faceted-results tr {
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        margin-bottom: 16px;
        padding: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }

    .faceted-results td {
        border: none;
        padding: 6px 0;
        min-width: 0 !important;
        white-space: normal;
    }

    /* título */
    .faceted-results td:nth-child(1) {
        margin-bottom: 8px;
    }

    .faceted-results td:nth-child(1) .resource-link {
        display: flex;
        align-items: flex-start;
        gap: 12px;
    }

    .faceted-results td:nth-child(1) img {
        width: 42px;
        height: 56px;
        flex-shrink: 0;
    }

    .faceted-results td:nth-child(1) .resource-name {
        display: block;
        overflow: visible;
        -webkit-line-clamp: unset;
        color: #0d6efd;
        font-size: 15px;
        line-height: 1.4;
    }

    /* ementa */
.faceted-results td:nth-child(2) {
    display: block;
    color: #555;
    font-size: 14px;
    line-height: 1.5;

    margin-left: 54px;
    margin-top: -4px;
    margin-bottom: 14px;

    width: calc(100% - 54px);
    box-sizing: border-box;

    overflow-wrap: break-word;
    word-break: break-word;
}

    /* data */
    .faceted-results td:nth-child(3) {
        display: inline-block;
        margin-left: 54px;
        margin-top: 8px;
        font-size: 13px;
        color: #666;
    }

    /* status */
    .faceted-results td:nth-child(4) {
        display: inline-block;
        margin-left: 10px;
    }

    /* autor */
    .faceted-results td:nth-child(5) {
        margin-left: 54px;
        margin-top: 8px;
        font-size: 13px;
    }
}