/* Process Details Modal - LexFlow Theme */
.modal-xl {
    max-width: 1000px;
    width: 95%;
}

.process-header {
    background: var(--light, #f8fafc);
    padding: 20px;
    border-radius: var(--radius-sm, 12px);
    border: 1px solid var(--border, #e2e8f0);
    margin-bottom: 24px;
    transition: var(--transition, 0.2s ease);
}

[data-theme="dark"] .process-header {
    background: var(--card-bg, #22345a);
    border-color: var(--border, #334155);
}

.process-header h3 {
    margin: 0;
    color: var(--primary, #10b981);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.process-meta {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--secondary, #64748b);
    flex-wrap: wrap;
}

[data-theme="dark"] .process-meta {
    color: #94a3b8;
}

.process-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.process-meta i {
    font-size: 16px;
    color: var(--primary, #10b981);
    opacity: 0.8;
}

.modal-section-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--primary, #10b981);
    margin: 12px 0 20px 0;
    /* Adjusted margins */
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light, #34d399);
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

[data-theme="dark"] .modal-section-title {
    color: var(--primary-light, #34d399);
    border-color: rgba(52, 211, 153, 0.2);
    background: rgba(16, 185, 129, 0.05);
    /* Soft background for banner style */
    padding: 12px 16px;
    border-radius: 8px;
    text-transform: none;
    /* More natural for long messages */
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: normal;
}

.movements-timeline,
.scrollable-section {
    position: relative;
    max-height: 480px;
    overflow-y: auto;
    overflow-x: auto;
    /* Allow horizontal scroll if needed for table */
    padding: 0;
    /* Table will handle internal padding */
    margin-bottom: 20px;
    /* Explicit bottom margin for the card */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.movements-timeline::-webkit-scrollbar,
.scrollable-section::-webkit-scrollbar {
    width: 6px;
}

.movements-timeline::-webkit-scrollbar-track,
.scrollable-section::-webkit-scrollbar-track {
    background: transparent;
}

.movements-timeline::-webkit-scrollbar-thumb,
.scrollable-section::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 20px;
}

.movements-timeline::-webkit-scrollbar-thumb,
.scrollable-section::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

[data-theme="dark"] .movements-timeline::-webkit-scrollbar-thumb,
[data-theme="dark"] .scrollable-section::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
}

.movements-timeline:hover::-webkit-scrollbar-thumb,
.scrollable-section:hover::-webkit-scrollbar-thumb {
    background-color: var(--primary);
}

.scrollable-section table thead th {
    position: sticky;
    top: 0;
    background: var(--light, #f8fafc);
    z-index: 100;
    box-shadow: 0 1px 0 var(--border);
    padding: 14px 16px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--secondary);
    text-align: left;
}

[data-theme="dark"] .scrollable-section table thead th {
    background: #0f172a !important;
    /* Matches deepest blue */
    color: #94a3b8;
    box-shadow: 0 1px 0 #334155;
}

.eproc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    table-layout: auto;
    /* Changed from fixed for better text flow */
}

.eproc-table td {
    padding: 18px 16px;
    /* Slightly more horizontal padding */
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
    /* Better for badges and buttons */
    line-height: 1.5;
    font-size: 0.9rem;
}

[data-theme="dark"] .eproc-table td {
    color: #e2e8f0;
    border-bottom-color: rgba(255, 255, 255, 0.05);
    /* Very subtle divider */
}

.eproc-table tr:last-child td {
    border-bottom: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-xl {
        width: 98%;
        margin: 10px auto;
    }

    .process-header {
        padding: 16px;
    }

    .process-header h3 {
        font-size: 1.1rem;
    }

    .eproc-table {
        font-size: 0.8rem;
    }

    .scrollable-section table thead th {
        padding: 8px 4px;
        font-size: 0.7rem;
    }

    .parties-grid {
        grid-template-columns: 1fr;
    }

    .movements-timeline {
        padding-left: 24px;
    }

    .movement-item::before {
        left: -24px;
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    .process-meta {
        flex-direction: column;
        gap: 8px;
    }

    .eproc-table thead {
        display: none;
        /* Hide header on very small screens and use card-like layout or let it overflow */
    }

    .eproc-table,
    .eproc-table tbody,
    .eproc-table tr,
    .eproc-table td {
        display: block;
        width: 100%;
    }

    .eproc-table tr {
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 8px;
        background: var(--light, #f8fafc);
    }

    [data-theme="dark"] .eproc-table tr {
        background: rgba(30, 41, 59, 0.3);
    }

    .eproc-table td {
        border: none;
        padding: 4px 0;
    }

    .eproc-table td:first-child {
        font-weight: 800;
        color: var(--primary);
        font-size: 0.75rem;
        text-transform: uppercase;
    }

    .eproc-table td:nth-child(2) {
        font-size: 0.75rem;
        color: var(--secondary);
        font-weight: 600;
    }
}

.movements-timeline {
    padding-left: 32px;
}

.movements-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 5px;
    bottom: 0;
    width: 2px;
    background: var(--border, #e2e8f0);
}

[data-theme="dark"] .movements-timeline::before {
    background: var(--border, #334155);
}

.movement-item {
    margin-bottom: 24px;
    position: relative;
}

.movement-item::before {
    content: '';
    position: absolute;
    left: -32px;
    top: 6px;
    width: 16px;
    height: 16px;
    background: var(--card-bg, #fff);
    border: 3px solid var(--primary, #10b981);
    border-radius: 50%;
    z-index: 2;
    transition: var(--transition, 0.2s ease);
}

[data-theme="dark"] .movement-item::before {
    background: var(--card-bg, #22345a);
}

.movement-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary, #64748b);
    margin-bottom: 6px;
    font-family: 'Inter', sans-serif;
}

.movement-content {
    background: var(--card-bg, #fff);
    padding: 16px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: var(--transition, 0.2s ease);
}

[data-theme="dark"] .movement-content {
    background: rgba(30, 41, 59, 0.5);
    border-color: var(--border, #334155);
}

.movement-item:hover .movement-content {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateX(4px);
    border-color: var(--primary-light, #34d399);
}

.movement-title {
    font-weight: 700;
    color: var(--text, #1e293b);
    font-size: 0.95rem;
    line-height: 1.4;
}

[data-theme="dark"] .movement-title {
    color: #f1f5f9;
}

.movement-desc {
    font-size: 0.85rem;
    color: var(--secondary, #64748b);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border, #e2e8f0);
    line-height: 1.5;
}

[data-theme="dark"] .movement-desc {
    border-color: var(--border, #334155);
    color: #94a3b8;
}

.parties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.party-card {
    border: 1px solid var(--border, #e2e8f0);
    padding: 14px;
    border-radius: 12px;
    background: var(--light, #f8fafc);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: var(--transition, 0.2s ease);
}

[data-theme="dark"] .party-card {
    background: rgba(30, 41, 59, 0.3);
    border-color: var(--border, #334155);
}

.party-card:hover {
    border-color: var(--primary, #10b981);
    background: var(--card-bg, #fff);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03);
}

.party-role {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary, #10b981);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.party-name {
    font-weight: 600;
    color: var(--text, #1e293b);
    font-size: 0.95rem;
}

[data-theme="dark"] .party-name {
    color: #f1f5f9;
}

/* ====================================================
   DISMISSED ALERTS MODAL — Scoped by ID (no conflicts)
   ==================================================== */

#dismissedModalContent {
    background: #1a2642;
    border: 1px solid #334155;
    border-radius: 16px;
    box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.7);
    width: 95%;
    max-width: 860px;
    margin: 5vh auto;
    display: flex;
    flex-direction: column;
    height: fit-content;
    /* Only as tall as its content */
    align-self: flex-start;
    /* Don't stretch if parent is flex */
    color: #f8fafc;
    font-family: 'Inter', sans-serif;
}

/* --- Header --- */
#dismissedModalHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}

#dismissedModalClose {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

#dismissedModalClose:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

/* --- Info Banner --- */
#dismissedModalBanner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 24px 0;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #34d399;
    flex-shrink: 0;
}

/* --- Table Card (the scrollable area) --- */
#dismissedListCard {
    margin: 16px 24px 16px;
    /* balanced top/bottom */
    border: 1px solid #334155;
    border-radius: 12px;
    overflow: hidden;
    /* clips table corners to match card border-radius */
    flex-shrink: 0;
}

/* Scroll wrapper inside the card so overflow:hidden above keeps border-radius intact */
#dismissedListCard>table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    display: block;
    max-height: 390px;
    overflow-y: auto;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #10b981 transparent;
}

/* thead must stay sticky — requires thead/tbody to be table-header-group/row-group */
#dismissedListCard>table thead {
    display: table-header-group;
}

#dismissedListCard>table tbody {
    display: table-row-group;
}

#dismissedListCard>table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #0f172a;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #334155;
    white-space: nowrap;
}

#dismissedListCard>table tbody tr {
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    transition: background 0.15s;
}

#dismissedListCard>table tbody tr:last-child {
    border-bottom: none;
}

#dismissedListCard>table tbody tr:hover {
    background: rgba(16, 185, 129, 0.04);
}

#dismissedListCard>table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    font-size: 0.875rem;
    color: #e2e8f0;
    background: #111827;
}

/* Keyword badge cell — prevent wrap */
#dismissedListCard>table tbody td:first-child {
    white-space: nowrap;
}

/* Process number cell */
#dismissedListCard>table tbody td:nth-child(2) a {
    color: #60a5fa;
    font-weight: 700;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    text-decoration: none;
    display: block;
    transition: color 0.15s;
}

#dismissedListCard>table tbody td:nth-child(2) a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* Person/CPF cell — allow more room */
#dismissedListCard>table tbody td:nth-child(3) {
    min-width: 160px;
}

/* ====================================================
   END DISMISSED ALERTS MODAL
   ==================================================== */

[data-theme="dark"] .modal-header {
    border-color: #334155;
}

[data-theme="dark"] .close-modal:hover {
    color: #fff;
}