#enemModalOverlay .modal-content {
    width: min(1120px, 96vw) !important;
    max-width: 96vw !important;
    height: min(90vh, 860px) !important;
    padding: 0;
}

#enemModalOverlay .modal-header {
    padding: 12px 16px;
}

#enemModalOverlay .modal-header h3 {
    display: flex;
    align-items: center;
    gap: 6px;
}

.enem-modal-body {
    display: grid;
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    flex: 1;
    padding: 0;
    background: linear-gradient(180deg, #f8fbff, #f2f7ff);
}

.enem-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-right: 1px solid #d8e4f7;
    background: rgba(255, 255, 255, 0.94);
    overflow: hidden;
}

.enem-filters {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    overflow: visible;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #ffffff, #f5f9ff);
}

.enem-filters > select,
.enem-filters > .enem-multiselect,
.enem-filters > .enem-keyword-filter {
    min-width: 0;
}

#enemYearFilter {
    flex: 0 0 164px;
}

#enemDisciplineFilter {
    flex: 0 0 210px;
}

#enemLanguageFilter {
    flex: 0 0 188px;
}

.enem-multiselect {
    position: relative;
}

.enem-multiselect-trigger {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid #cddaf0;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font-size: 12px;
    font-weight: 600;
    justify-content: space-between;
    box-shadow: none;
}

.enem-multiselect-trigger:hover {
    background: #f8fbff;
    border-color: #a9c4ec;
    transform: none;
}

.enem-multiselect-trigger.is-open {
    border-color: #0b5ed7;
    box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.12);
}

.enem-multiselect-trigger i {
    font-size: 14px;
    transition: transform 0.2s ease;
}

.enem-multiselect-trigger.is-open i {
    transform: rotate(180deg);
}

.enem-multiselect-trigger span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.enem-multiselect-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    display: none;
    width: max-content;
    min-width: 100%;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #cddaf0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
}

.enem-multiselect-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
}

.enem-multiselect-option:hover {
    background: #eef5ff;
}

.enem-multiselect-option input {
    width: 14px;
    height: 14px;
    min-height: 14px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    box-shadow: none;
    accent-color: #0b5ed7;
    flex: 0 0 14px;
}

.enem-multiselect-option-all {
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 4px;
    padding-bottom: 9px;
}

.enem-filters input:not([type="checkbox"]),
.enem-filters select {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid #cddaf0;
    border-radius: 10px;
    background: #ffffff;
    font-size: 12px;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.enem-filters input:not([type="checkbox"]):focus,
.enem-filters select:focus {
    border-color: #0b5ed7;
    box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.12);
}

.enem-filters input:not([type="checkbox"]):disabled,
.enem-filters select:disabled {
    background: #eef2f9;
    color: #94a3b8;
    cursor: not-allowed;
    border-color: #d7e3f7;
    box-shadow: none;
}

.enem-search-btn {
    min-height: 36px;
    padding: 8px 12px;
    white-space: nowrap;
    font-size: 12px;
}

.enem-search-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.enem-keyword-filter {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 0;
    flex: 1 1 420px;
    min-width: 340px;
    border: none;
    border-radius: 0;
    background: transparent;
}

.enem-keyword-filter-label {
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
}

.enem-keyword-autocomplete {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.enem-selected-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 0;
    max-height: 46px;
    overflow-y: auto;
    padding-right: 2px;
}

.enem-keyword-input {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid #cddaf0;
    border-radius: 10px;
    background: #ffffff;
    font-size: 12px;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.enem-keyword-input:focus {
    border-color: #0b5ed7;
    box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.12);
}

.enem-keyword-input:disabled {
    background: #eef2f9;
    color: #94a3b8;
    cursor: not-allowed;
    border-color: #d7e3f7;
    box-shadow: none;
}

.enem-keyword-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 5;
    display: none;
    flex-direction: column;
    max-height: 180px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid #cddaf0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
}

.enem-keyword-suggestion {
    width: 100%;
    padding: 7px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #0f172a;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.enem-keyword-suggestion:hover {
    background: #eef5ff;
}

.enem-keyword-filter-empty {
    font-size: 11px;
    line-height: 1.35;
    color: #64748b;
    display: none !important;
}

.enem-keyword-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid #c6d8f3;
    border-radius: 999px;
    background: #ffffff;
    color: #0f172a;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.enem-keyword-chip:hover {
    border-color: #8db2eb;
    background: #eef5ff;
}

.enem-keyword-chip.active {
    border-color: #0b5ed7;
    background: #0b5ed7;
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(11, 94, 215, 0.16);
}

.enem-keyword-chip-remove {
    font-size: 12px;
    line-height: 1;
}

.enem-results-count {
    font-size: 11px;
    font-weight: 700;
    color: #0b4fb3;
    padding: 0;
    white-space: nowrap;
}

.enem-list-header {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 10px 12px 0;
}

.enem-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    height: 100%;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.enem-pagination {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px 12px;
    border-top: 1px solid #e2e8f0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 247, 255, 0.96));
}

.enem-pagination-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.enem-pagination-range {
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
}

.enem-pagination-current {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
}

.enem-pagination-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.enem-pagination-btn {
    width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    border: 1px solid #d7e3f7;
    border-radius: 10px;
    background: #ffffff;
    color: #0b4fb3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.enem-pagination-btn:hover:not(:disabled) {
    border-color: #8db2eb;
    background: #eef5ff;
    color: #0b5ed7;
    transform: translateY(-1px);
}

.enem-pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.enem-pagination-btn i {
    font-size: 14px;
}

.enem-list-item {
    padding: 10px 11px;
    border: 1px solid #d7e3f7;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.enem-list-item:hover {
    border-color: #8db2eb;
    box-shadow: 0 8px 18px rgba(11, 61, 145, 0.08);
    transform: translateY(-1px);
}

.enem-list-item.selected {
    border-color: #0b5ed7;
    box-shadow: 0 10px 22px rgba(11, 94, 215, 0.14);
    background: linear-gradient(180deg, #f8fbff, #edf4ff);
}

.enem-list-item h4 {
    margin: 0 0 4px;
    font-size: 13px;
    color: #0f172a;
    line-height: 1.3;
}

.enem-list-item p {
    margin: 0;
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
}

.enem-preview-container {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: linear-gradient(180deg, #fdfefe, #f5f9ff);
}

.enem-preview {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 20px;
    color: #0f172a;
    line-height: 1.58;
    font-size: 15px;
}

.enem-preview h2 {
    margin: 0 0 14px;
    font-size: 18px;
    line-height: 1.35;
    color: #0b3d91;
}

.enem-preview-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid #dbe5f4;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.enem-preview-meta-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
}

.enem-preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.enem-preview-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eaf2ff;
    color: #0b4fb3;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.enem-preview strong {
    color: inherit;
}

.enem-preview-empty {
    text-align: center;
    color: #94a3b8;
    margin-top: 48px;
    font-size: 13px;
}

.enem-preview .resizable-image {
    display: inline-flex;
    max-width: 100%;
    margin: 4px 0;
}

.enem-preview .resizable-image img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid #d9e4f5;
}

.enem-preview-alt {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid #dbe5f4;
    border-radius: 10px;
    background: #ffffff;
}

.enem-preview-alt.correct {
    border-color: #9fd3b6;
    background: #f0fdf4;
}

.enem-preview-alt strong {
    min-width: 20px;
    color: #0b3d91;
}

.enem-preview-comment {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #d8e4f7;
    border-radius: 14px;
    background: #EEF2FF;
}

.enem-preview-comment h3 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #3730a3;
}

.enem-preview-comment p,
.enem-preview-comment ul,
.enem-preview-comment ol,
.enem-preview-comment h1,
.enem-preview-comment h2,
.enem-preview-comment h3,
.enem-preview-comment h4,
.enem-preview-comment h5,
.enem-preview-comment h6 {
    margin: 0 0 8px;
}

.enem-preview-comment p:last-child,
.enem-preview-comment ul:last-child,
.enem-preview-comment ol:last-child,
.enem-preview-comment h1:last-child,
.enem-preview-comment h2:last-child,
.enem-preview-comment h3:last-child,
.enem-preview-comment h4:last-child,
.enem-preview-comment h5:last-child,
.enem-preview-comment h6:last-child {
    margin-bottom: 0;
}

.enem-preview-comment ul,
.enem-preview-comment ol {
    padding-left: 18px;
}

.enem-preview-comment li + li {
    margin-top: 4px;
}

.enem-preview-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #d8e4f7;
    background: linear-gradient(180deg, #ffffff, #eef5ff);
}

.enem-download-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(9, 20, 43, 0.64);
    backdrop-filter: blur(4px);
}

.enem-download-box {
    width: min(420px, 92vw);
    padding: 28px 24px;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff, #f4f8ff);
    border: 1px solid #d8e4f7;
    box-shadow: 0 28px 60px rgba(11, 61, 145, 0.24);
    text-align: center;
}

.enem-download-box i {
    display: inline-flex;
    font-size: 38px;
    color: #0b5ed7;
    margin-bottom: 12px;
}

.enem-download-box h3 {
    margin: 0 0 10px;
    font-size: 20px;
    color: #0f172a;
}

.enem-download-box p {
    margin: 0;
    color: #475569;
    line-height: 1.6;
}

@media (max-width: 900px) {
    .enem-modal-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(220px, 40vh) minmax(0, 1fr);
    }

    .enem-filters {
        flex-wrap: wrap;
        align-items: stretch;
        overflow: visible;
    }

    .enem-multiselect,
    #enemYearFilter,
    #enemDisciplineFilter,
    #enemLanguageFilter,
    .enem-keyword-filter {
        flex: 1 1 100%;
        min-width: 0;
        max-width: none;
    }

    .enem-sidebar {
        border-right: none;
        border-bottom: 1px solid #d8e4f7;
    }

    .enem-keyword-filter {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        border: 1px solid #d8e4f7;
        border-radius: 12px;
        background: #f8fbff;
    }

    .enem-multiselect-menu {
        width: 100%;
        min-width: 0;
    }

    .enem-results-count {
        width: 100%;
        white-space: normal;
    }

    .enem-preview {
        padding: 16px;
    }

    .enem-pagination {
        padding-bottom: 10px;
    }
}
