/* =============================================================
   EXPLORADOR DE INOVACAO - MC TEA
   "Observatory" aesthetic: cosmic dark purple, glass-morphism
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&display=swap');

:root {
    --exp-bg-deep: #0f0c29;
    --exp-bg-mid: #302b63;
    --exp-bg-surface: #24243e;
    --exp-accent-purple: #6a11cb;
    --exp-accent-blue: #2575fc;
    --exp-glass: rgba(255, 255, 255, 0.06);
    --exp-glass-border: rgba(255, 255, 255, 0.1);
    --exp-glass-hover: rgba(255, 255, 255, 0.1);
    --exp-text-primary: #f0eef6;
    --exp-text-muted: rgba(255, 255, 255, 0.55);
    --exp-glow-purple: rgba(106, 17, 203, 0.4);
    --exp-glow-blue: rgba(37, 117, 252, 0.3);
    --exp-score-high: #10b981;
    --exp-score-mid: #f59e0b;
    --exp-score-low: #ef4444;
    --exp-src-parceria: #fb923c;
    --exp-src-finep: #60a5fa;
    --exp-src-vinnova: #34d399;
    --exp-src-edital: #a78bfa;
    --exp-radius: 14px;
    --exp-radius-pill: 50px;
    --exp-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --exp-font: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ======================== HERO STATE ======================== */

.explorador-hero {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--exp-bg-deep) 0%, var(--exp-bg-mid) 50%, var(--exp-bg-surface) 100%);
    position: relative;
    overflow: hidden;
    font-family: var(--exp-font);
}

/* Subtle animated grid pattern */
.explorador-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(106, 17, 203, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(37, 117, 252, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Floating dots (constellation effect) */
.explorador-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1.5px 1.5px at 10% 15%, rgba(255,255,255,0.25) 50%, transparent 50%),
        radial-gradient(1px 1px at 25% 60%, rgba(255,255,255,0.15) 50%, transparent 50%),
        radial-gradient(1.5px 1.5px at 45% 25%, rgba(255,255,255,0.2) 50%, transparent 50%),
        radial-gradient(1px 1px at 55% 80%, rgba(255,255,255,0.12) 50%, transparent 50%),
        radial-gradient(2px 2px at 70% 40%, rgba(167,139,250,0.3) 50%, transparent 50%),
        radial-gradient(1px 1px at 85% 20%, rgba(255,255,255,0.18) 50%, transparent 50%),
        radial-gradient(1.5px 1.5px at 90% 65%, rgba(37,117,252,0.25) 50%, transparent 50%),
        radial-gradient(1px 1px at 35% 90%, rgba(255,255,255,0.1) 50%, transparent 50%),
        radial-gradient(1px 1px at 60% 10%, rgba(255,255,255,0.15) 50%, transparent 50%),
        radial-gradient(1.5px 1.5px at 15% 75%, rgba(106,17,203,0.2) 50%, transparent 50%);
    animation: constellationDrift 60s linear infinite;
    pointer-events: none;
    opacity: 0.8;
}

@keyframes constellationDrift {
    0% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-15px) translateX(10px); }
    100% { transform: translateY(0) translateX(0); }
}

.hero-content {
    text-align: center;
    max-width: 720px;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 2;
}

.hero-icon {
    font-size: 2.8rem;
    margin-bottom: 1.2rem;
    background: linear-gradient(135deg, var(--exp-accent-purple), var(--exp-accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px var(--exp-glow-purple));
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { filter: drop-shadow(0 0 20px var(--exp-glow-purple)); }
    50% { filter: drop-shadow(0 0 30px var(--exp-glow-blue)); }
}

.hero-content h1 {
    font-family: var(--exp-font);
    color: var(--exp-text-primary);
    font-size: 2.6rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    letter-spacing: -0.5px;
    line-height: 1.15;
}

.hero-subtitle {
    color: var(--exp-text-muted);
    font-size: 1.05rem;
    font-weight: 300;
    margin-bottom: 2.2rem;
    letter-spacing: 0.2px;
}

/* ======================== SEARCH BOX ======================== */

.search-box-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--exp-glass-border);
    border-radius: var(--exp-radius);
    padding: 5px 6px 5px 22px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: border-color var(--exp-transition), box-shadow var(--exp-transition);
}

.search-box:focus-within {
    border-color: rgba(106, 17, 203, 0.5);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 3px rgba(106, 17, 203, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--exp-font);
    font-size: 0.95rem;
    font-weight: 400;
    padding: 13px 12px;
    background: transparent;
    color: var(--exp-text-primary);
    min-width: 0;
}

.search-box input::placeholder {
    color: var(--exp-text-muted);
    font-weight: 300;
}

.search-btn {
    background: linear-gradient(135deg, var(--exp-accent-purple), var(--exp-accent-blue));
    border: none;
    border-radius: 10px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    margin-left: 10px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px var(--exp-glow-purple);
}

.search-btn:active {
    transform: scale(0.97);
}

/* ======================== EXAMPLE CHIPS ======================== */

.hero-examples {
    margin-top: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.hero-examples > span {
    color: var(--exp-text-muted);
    font-size: 0.8rem;
    font-weight: 400;
    margin-right: 4px;
}

.example-chip {
    background: var(--exp-glass);
    border: 1px solid var(--exp-glass-border);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    padding: 6px 16px;
    cursor: pointer;
    font-family: var(--exp-font);
    font-size: 0.78rem;
    font-weight: 400;
    transition: all 0.2s ease;
    letter-spacing: 0.2px;
}

.example-chip:hover {
    background: var(--exp-glass-hover);
    border-color: rgba(167, 139, 250, 0.35);
    color: white;
    transform: translateY(-1px);
}

.example-chip:active {
    transform: translateY(0);
}

/* ======================== HERO COLLAPSE ANIMATION ======================== */

.explorador-hero.collapsing {
    animation: heroCollapse 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes heroCollapse {
    0% { min-height: calc(100vh - 56px); opacity: 1; }
    60% { min-height: 0; opacity: 0.3; }
    100% { min-height: 0; opacity: 0; display: none; }
}

.explorador-results.appearing {
    animation: resultsAppear 0.4s cubic-bezier(0, 0, 0.2, 1) forwards;
}

@keyframes resultsAppear {
    0% { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ======================== RESULTS STATE ======================== */

/* On small screens, hide the main navbar when explorador results are showing */
@media (max-width: 991.98px) {
    body.explorador-results-active .site-navigation {
        display: none !important;
    }
}

.explorador-results {
    font-family: var(--exp-font);
    min-height: calc(100vh - 56px);
    background: #f7f7fb;
}

/* ======================== RESULTS HEADER (sticky) ======================== */

.results-header {
    background: linear-gradient(135deg, var(--exp-accent-purple) 0%, var(--exp-accent-blue) 100%);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 4px 24px rgba(106, 17, 203, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.results-search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--exp-radius);
    padding: 3px 5px 3px 16px;
    max-width: 520px;
    flex: 1;
    transition: background var(--exp-transition);
}

.exp-cadastrar-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: var(--exp-radius-pill);
    background: rgba(255, 255, 255, 0.92);
    color: var(--exp-accent-purple);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.25s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.exp-cadastrar-btn:hover {
    background: #fff;
    color: var(--exp-accent-purple);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.3);
}

.exp-cadastrar-btn i {
    font-size: 0.75rem;
}

.exp-cadastrar-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.exp-cadastrar-text small {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.7;
}

.results-search-box:focus-within {
    background: rgba(255, 255, 255, 0.2);
}

.results-search-box input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: white;
    font-family: var(--exp-font);
    font-size: 0.88rem;
    font-weight: 400;
    padding: 9px 10px;
    min-width: 0;
}

.results-search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-btn-sm {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    margin-left: 8px;
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn-sm:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ======================== LOADING STATE ======================== */

.loading-container {
    text-align: center;
    padding: 80px 20px 40px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--exp-accent-purple);
    border-right-color: var(--exp-accent-blue);
    border-radius: 50%;
    animation: spinGlow 0.9s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spinGlow {
    0% { transform: rotate(0deg); filter: drop-shadow(0 0 4px var(--exp-glow-purple)); }
    50% { filter: drop-shadow(0 0 8px var(--exp-glow-blue)); }
    100% { transform: rotate(360deg); filter: drop-shadow(0 0 4px var(--exp-glow-purple)); }
}

.loading-container > p {
    font-family: var(--exp-font);
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.loading-sources {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.source-loading {
    font-family: var(--exp-font);
    font-size: 0.8rem;
    font-weight: 400;
    color: #9ca3af;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.source-loading.done {
    color: var(--exp-score-high);
}

.source-loading.done .fa-circle-notch {
    animation: none;
}

/* ======================== FILTER PANEL (CHECKBOXES + DROPDOWNS) ======================== */

.filter-panel {
    display: flex;
    gap: 10px;
    padding: 16px 24px 8px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.filter-category {
    position: relative;
}

.filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid #e2e4ea;
    background: white;
    border-radius: 22px;
    font-family: var(--exp-font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    color: #4b5563;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    margin: 0;
    white-space: nowrap;
}

.filter-checkbox:hover {
    border-color: #c4b5fd;
    background: #faf8ff;
}

.filter-checkbox input[type="checkbox"] {
    accent-color: var(--exp-accent-purple);
    width: 14px;
    height: 14px;
    cursor: pointer;
    margin: 0;
}

.filter-checkbox--todos {
    font-weight: 600;
}

.filter-checkbox--child {
    font-size: 0.75rem;
    padding: 5px 8px;
    border-radius: 6px;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    display: flex;
    width: 100%;
}

.filter-checkbox--child:hover {
    background: #f3f0ff !important;
    border: none !important;
    box-shadow: none !important;
}

.filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: white;
    border: 1px solid #e2e4ea;
    border-radius: 12px;
    padding: 8px;
    margin-top: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.filter-dropdown-toggle {
    font-size: 0.6rem;
    margin-left: 2px;
    transition: transform 0.2s;
    cursor: pointer;
    color: #9ca3af;
    padding: 6px 8px;
    margin: -6px -8px -6px 0;
    border-radius: 0 22px 22px 0;
}

.filter-dropdown-toggle:hover {
    color: #6b21a8;
    background: rgba(124, 58, 237, 0.08);
}

.filter-dropdown-toggle.open {
    transform: rotate(180deg);
}

.chip-count {
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}


/* ======================== TOOLBAR (view toggle + report button) ======================== */

.explorador-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 24px;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-mode-toggle {
    display: flex;
    gap: 8px;
    background: #f0eef5;
    border-radius: 10px;
    padding: 4px;
}

.view-btn {
    padding: 7px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-family: var(--exp-font);
    font-size: 0.78rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.view-btn:hover {
    color: var(--exp-accent-purple);
}

.view-btn.active {
    background: white;
    color: var(--exp-accent-purple);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-btn[data-mode="graph"] {
    border: 1.5px solid rgba(124, 58, 237, 0.25);
    color: #7c3aed;
    font-weight: 600;
}

.view-btn[data-mode="graph"]:hover {
    background: rgba(124, 58, 237, 0.08);
}

.view-btn[data-mode="graph"].active {
    background: var(--exp-accent-purple);
    color: #fff;
    border-color: var(--exp-accent-purple);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.search-limit-select {
    padding: 6px 10px;
    border: 1px solid #e0dfe5;
    border-radius: 8px;
    background: #f8f7fc;
    font-family: var(--exp-font);
    font-size: 0.78rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: border-color 0.2s;
    outline: none;
}

.search-limit-select:hover,
.search-limit-select:focus {
    border-color: var(--exp-accent-purple);
    color: var(--exp-accent-purple);
}

.btn-relatorio {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--exp-accent-purple), #5b21b6);
    color: white;
    font-family: var(--exp-font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-relatorio:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--exp-glow-purple);
}

.btn-share-graph {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: white;
    font-family: var(--exp-font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    margin-right: 8px;
    opacity: 0.85;
}

.btn-share-graph:hover {
    transform: translateY(-1px);
    opacity: 1;
    box-shadow: 0 4px 16px var(--exp-glow-purple);
}

/* SweetAlert share modal */
.share-btn-swal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition: all 0.2s;
}
.share-btn-swal:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

/* ======================== SORTABLE HEADERS ======================== */

.explorador-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.explorador-table thead th.sortable:hover {
    color: var(--exp-accent-purple);
}

.sort-arrow {
    font-size: 0.65rem;
    color: #ccc;
    margin-left: 4px;
}

.sort-arrow.active {
    color: var(--exp-accent-purple);
}

/* ======================== PAGINATION ======================== */

.pagination-wrapper {
    padding: 12px 24px;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-family: var(--exp-font);
    font-size: 0.82rem;
    color: #6b7280;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-size-select {
    border: 1px solid #e2e4ea;
    border-radius: 6px;
    padding: 4px 8px;
    font-family: var(--exp-font);
    font-size: 0.8rem;
    color: #4b5563;
    background: white;
    margin-right: 8px;
    cursor: pointer;
}

.page-btn {
    border: 1px solid #e2e4ea;
    background: white;
    border-radius: 6px;
    padding: 4px 10px;
    font-family: var(--exp-font);
    font-size: 0.8rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--exp-accent-purple);
    color: var(--exp-accent-purple);
}

.page-btn.active {
    background: var(--exp-accent-purple);
    color: white;
    border-color: var(--exp-accent-purple);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-ellipsis {
    padding: 4px 6px;
    color: #9ca3af;
    font-size: 0.8rem;
}

/* ======================== RESULTS SUMMARY (legacy, kept for compat) ======================== */

.results-summary {
    padding: 8px 24px 4px;
    font-family: var(--exp-font);
    font-size: 0.8rem;
    color: #9ca3af;
    font-weight: 400;
}

/* ======================== DESKTOP TABLE ======================== */

.explorador-table-wrapper {
    padding: 0 20px 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--exp-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.explorador-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

.explorador-table thead th {
    background: #fafafe;
    font-family: var(--exp-font);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #8b8fa3;
    border-bottom: 1px solid #eeedf2;
    padding: 14px 16px;
    white-space: nowrap;
}

.explorador-table tbody tr.result-row {
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f3f2f7;
}

.explorador-table tbody tr.result-row:hover {
    background: #f8f6ff;
}

.explorador-table tbody tr.result-row:last-child {
    border-bottom: none;
}

.explorador-table tbody td {
    padding: 14px 16px;
    font-size: 0.88rem;
    color: #374151;
    vertical-align: middle;
}

/* Score cell */
.score-cell {
    min-width: 80px;
}

.score-value {
    font-family: var(--exp-font);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.score-bar-container {
    width: 64px;
    background: #eeedf2;
    border-radius: 3px;
    height: 5px;
    overflow: hidden;
}

.score-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Type badges */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    font-family: var(--exp-font);
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.type-badge.parceria  { background: #fff7ed; color: #c2410c; }
.type-badge.projeto   { background: #eff6ff; color: #1d4ed8; }
.type-badge.edital    { background: #f5f3ff; color: #6d28d9; }
.type-badge.produto   { background: #ecfdf5; color: #047857; }

/* MC TEA logo inside type badge */
.type-badge-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
    border-radius: 2px;
}

/* Title column: sticky (frozen first column on horizontal scroll) */
.explorador-table thead th.col-title,
.explorador-table tbody td.cell-title {
    position: sticky;
    left: 0;
    z-index: 40;
    background: white;
    min-width: 180px;
    max-width: 280px;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
}

.explorador-table thead th.col-title {
    z-index: 50;
    background: #fafafe;
}

/* Title cell */
.cell-title {
    font-weight: 500;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Org cell */
.cell-org {
    color: #6b7280;
    font-size: 0.84rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Detail cell */
.cell-detail {
    color: #9ca3af;
    font-size: 0.82rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Action cell */
.cell-action {
    display: flex;
    align-items: center;
    gap: 8px;
}

.expand-icon {
    color: #c4c8d4;
    font-size: 0.7rem;
    transition: transform 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.expand-icon.rotated {
    transform: rotate(90deg);
    color: var(--exp-accent-purple);
}

.btn-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid #e2e4ea;
    color: #6b7280;
    font-size: 0.75rem;
    transition: all 0.15s;
    background: transparent;
}

.btn-action-link:hover {
    border-color: var(--exp-accent-purple);
    color: var(--exp-accent-purple);
    text-decoration: none;
}

/* Expandable detail row */
.detail-row {
    display: none;
}

.detail-row td {
    padding: 0 !important;
    border-bottom: 1px solid #f3f2f7;
}

.detail-content {
    padding: 18px 24px 14px;
    background: linear-gradient(160deg, #faf8ff 0%, #f3f0ff 40%, #eef2ff 100%);
    border-left: 3px solid var(--exp-accent-purple);
    font-family: var(--exp-font);
}

.detail-full-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(106, 17, 203, 0.12);
    line-height: 1.4;
}

.detail-content .row {
    margin-left: 0;
    margin-right: 0;
}

.detail-content .row > [class*="col"] {
    padding-left: 8px;
    padding-right: 8px;
}

.detail-content .detail-label {
    font-weight: 500;
    color: #8b8fa3;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 1px;
    line-height: 1.2;
}

.detail-content .detail-value {
    color: #1f2937;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 0;
    line-height: 1.35;
}

.detail-content a {
    color: var(--exp-accent-purple);
    font-weight: 500;
    font-size: 0.82rem;
}

.detail-content a:hover {
    color: var(--exp-accent-blue);
}

/* Expandable text fields */
.detail-expandable .detail-toggle-btn {
    font-size: 0.73rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--exp-accent-purple), var(--exp-accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.detail-expandable .detail-toggle-btn:hover {
    opacity: 0.75;
}

.detail-expandable .detail-full {
    line-height: 1.5;
}

/* ======================== TWO-COLUMN DETAIL LAYOUT (MC TEA) ======================== */

.detail-two-col {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
}

.detail-two-col.detail-two-col--single {
    grid-template-columns: 1fr;
    max-width: 400px;
}

/* --- Left column: metadata card --- */
.detail-meta-card {
    background: white;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 1px 4px rgba(106, 17, 203, 0.06), 0 0 0 1px rgba(106, 17, 203, 0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-meta-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.detail-meta-icon {
    font-size: 0.78rem;
    width: 26px;
    height: 26px;
    min-width: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f6ff;
    border-radius: 6px;
    margin-top: 1px;
}

.detail-meta-item .detail-label {
    font-size: 0.62rem;
    margin-bottom: 0;
}

.detail-meta-item .detail-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
    word-break: break-word;
}

/* --- Right column: text sections --- */
.detail-col-text {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-text-block {
    background: white;
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 1px 4px rgba(106, 17, 203, 0.06), 0 0 0 1px rgba(106, 17, 203, 0.06);
}

.detail-text-header {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--exp-accent-purple);
    margin-bottom: 6px;
}

.detail-text-icon {
    font-size: 0.68rem;
    opacity: 0.7;
}

.detail-text-body {
    color: #374151;
    font-size: 0.82rem;
    line-height: 1.55;
    font-weight: 400;
}

/* Grid for inline metadata inside text blocks (FINEP/Vinnova details) */
.detail-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
}

.detail-meta-inline {
    display: flex;
    flex-direction: column;
}

.detail-meta-inline .detail-label {
    font-size: 0.62rem;
    font-weight: 500;
    color: #8b8fa3;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 1px;
}

.detail-meta-inline .detail-value {
    font-size: 0.8rem;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.35;
}

/* Edital link button */
.detail-edital-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--exp-font);
    font-size: 0.82rem;
    font-weight: 600;
    color: white !important;
    background: linear-gradient(135deg, var(--exp-accent-purple), var(--exp-accent-blue));
    padding: 8px 20px;
    border-radius: var(--exp-radius-pill);
    transition: transform 0.15s, box-shadow 0.15s;
    text-decoration: none !important;
}

.detail-edital-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--exp-glow-purple);
    color: white !important;
    text-decoration: none !important;
}

/* --- Responsive: stack on smaller screens --- */
@media (max-width: 767.98px) {
    .detail-two-col {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .detail-meta-card {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px 16px;
    }

    .detail-meta-item {
        min-width: calc(50% - 16px);
    }

    .detail-meta-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ======================== MOBILE CARDS ======================== */

.explorador-cards-container {
    padding: 8px 12px 24px;
}

.mobile-result-card {
    background: white;
    border-radius: var(--exp-radius);
    padding: 16px 18px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-left: 4px solid transparent;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    font-family: var(--exp-font);
}

.mobile-result-card:active {
    transform: scale(0.99);
}

.mobile-result-card.parceria  { border-left-color: var(--exp-src-parceria); }
.mobile-result-card.projeto   { border-left-color: var(--exp-src-finep); }
.mobile-result-card.edital    { border-left-color: var(--exp-src-edital); }

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.mobile-card-score {
    font-weight: 700;
    font-size: 1.1rem;
    font-family: var(--exp-font);
    letter-spacing: -0.5px;
}

.mobile-card-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: #1f2937;
    margin-bottom: 4px;
    line-height: 1.3;
}

.mobile-card-org {
    color: #6b7280;
    font-size: 0.82rem;
    margin-bottom: 2px;
}

.mobile-card-detail-preview {
    color: #9ca3af;
    font-size: 0.78rem;
}

.mobile-card-details {
    display: none;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #f0eef5;
    font-size: 0.82rem;
}

.mobile-card-details .detail-label {
    font-weight: 500;
    color: #8b8fa3;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 1px;
}

.mobile-card-details .detail-value {
    color: #1f2937;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 6px;
}

/* Two-col inside mobile cards: use subtle bg instead of white-on-white */
.mobile-card-details .detail-two-col {
    grid-template-columns: 1fr;
    gap: 12px;
}

.mobile-card-details .detail-meta-card {
    background: #f8f6ff;
    box-shadow: none;
    border: 1px solid rgba(106, 17, 203, 0.08);
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.mobile-card-details .detail-meta-item {
    min-width: calc(50% - 16px);
}

.mobile-card-details .detail-text-block {
    background: #f8f6ff;
    box-shadow: none;
    border: 1px solid rgba(106, 17, 203, 0.08);
}

/* ======================== EMPTY STATE ======================== */

.empty-state {
    text-align: center;
    padding: 80px 20px;
    font-family: var(--exp-font);
}

.empty-state i {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 16px;
}

.empty-state p {
    color: #9ca3af;
    font-size: 0.95rem;
    font-weight: 400;
}

/* ======================== RESPONSIVE ======================== */

@media (max-width: 767.98px) {
    .hero-content h1 {
        font-size: 1.7rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.6rem;
    }

    .search-box {
        padding: 4px 4px 4px 16px;
    }

    .search-box input {
        font-size: 0.88rem;
        padding: 10px 8px;
    }

    .search-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 0.9rem;
    }

    .hero-examples > span {
        width: 100%;
        margin-bottom: 4px;
    }

    .results-header {
        padding: 8px 12px;
    }

    .exp-cadastrar-text {
        display: none;
    }

    .exp-cadastrar-btn {
        padding: 8px 10px;
        gap: 0;
    }

    .filter-chips {
        padding: 14px 12px 8px;
        gap: 6px;
    }

    .filter-chip {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .results-summary {
        padding: 6px 12px 2px;
    }

    .loading-sources {
        gap: 12px;
    }

    .source-loading {
        font-size: 0.75rem;
    }
}

@media (min-width: 992px) {
    .explorador-table thead th:first-child {
        border-top-left-radius: var(--exp-radius);
    }

    .explorador-table thead th:last-child {
        border-top-right-radius: var(--exp-radius);
    }
}

/* ======================== SCROLLBAR (results area) ======================== */

.explorador-results::-webkit-scrollbar {
    width: 6px;
}

.explorador-results::-webkit-scrollbar-track {
    background: transparent;
}

.explorador-results::-webkit-scrollbar-thumb {
    background: rgba(106, 17, 203, 0.2);
    border-radius: 3px;
}

.explorador-results::-webkit-scrollbar-thumb:hover {
    background: rgba(106, 17, 203, 0.35);
}

/* ======================== FONTE TAG (in Detalhe/Fonte column) ======================== */

.fonte-tag {
    display: inline-block;
    font-family: var(--exp-font);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 3px 10px;
    border-radius: 6px;
    white-space: nowrap;
}

.fonte-tag.parceria { background: #fff7ed; color: #c2410c; }
.fonte-tag.projeto  { background: #eff6ff; color: #1d4ed8; }
.fonte-tag.edital   { background: #f5f3ff; color: #6d28d9; }
.fonte-tag.produto  { background: #ecfdf5; color: #047857; }

/* ======================== DETAIL SECTION TITLE ======================== */

.detail-section-title {
    font-family: var(--exp-font);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--exp-accent-purple);
    padding-bottom: 5px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(106, 17, 203, 0.12);
    letter-spacing: 0.2px;
}

/* ======================== MOBILE TABLE (Lessie-style) ======================== */

@media (max-width: 767.98px) {
    /* Table wrapper: horizontal scroll, no padding */
    .explorador-table-wrapper {
        padding: 0 0 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Remove border-radius on mobile for edge-to-edge */
    .explorador-table {
        border-radius: 0;
        min-width: 520px; /* Force horizontal scroll */
    }

    /* Smaller font on mobile */
    .explorador-table thead th {
        font-size: 0.6rem;
        padding: 10px 10px;
    }

    .explorador-table tbody td {
        font-size: 0.78rem;
        padding: 10px 10px;
    }

    /* Mobile overrides for sticky title column */
    .explorador-table thead th.col-title,
    .explorador-table tbody td.cell-title {
        min-width: 160px;
        max-width: 200px;
    }

    /* Title text: max 3 lines, then ellipsis */
    .cell-title-text {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.35;
        font-size: 0.76rem;
        font-weight: 500;
        color: #1f2937;
    }

    /* Score cell smaller on mobile */
    .score-cell {
        min-width: 60px;
    }

    .score-value {
        font-size: 0.78rem;
    }

    .score-bar-container {
        width: 48px;
    }

    /* Type badge smaller */
    .type-badge {
        padding: 3px 8px;
        font-size: 0.65rem;
        gap: 4px;
    }

    .type-badge-logo {
        height: 12px;
    }

    /* Fonte tag smaller */
    .fonte-tag {
        font-size: 0.62rem;
        padding: 2px 7px;
    }

    /* Detail row: full width, no sticky */
    .explorador-table tbody tr.detail-row td {
        position: static;
        box-shadow: none;
    }

    /* Fix: results-header smaller on mobile to avoid clipping first row */
    .results-header {
        padding: 6px 10px;
        min-height: auto;
    }

    .results-search-box {
        padding: 3px 3px 3px 10px;
    }

    .results-search-box input {
        font-size: 0.82rem;
        padding: 7px 6px;
    }

    /* Expand icon smaller */
    .expand-icon {
        font-size: 0.65rem;
    }
}

/* Title text truncation (desktop fallback) */
@media (min-width: 768px) {
    .cell-title-text {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.4;
    }
}

/* ======================== ANIMATIONS FOR ROWS ======================== */

.explorador-table tbody tr.result-row {
    animation: rowFadeIn 0.3s ease both;
}

@keyframes rowFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.mobile-result-card {
    animation: cardFadeIn 0.3s ease both;
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ======================== ALGORITHM TOGGLE ======================== */

/* Hero version (below search box) */
.algorithm-toggle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}

.algorithm-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: var(--exp-radius-pill);
    font-family: var(--exp-font);
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--exp-text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid transparent;
    background: transparent;
    user-select: none;
}

.algorithm-toggle-label:hover {
    color: var(--exp-text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.algorithm-toggle-label.active {
    color: var(--exp-text-primary);
    background: rgba(106, 17, 203, 0.2);
    border-color: rgba(106, 17, 203, 0.4);
    font-weight: 500;
}

.algorithm-toggle-label i {
    font-size: 0.72rem;
}

/* Compact version (results header) */
.algorithm-toggle-row--compact {
    margin-top: 0;
    gap: 2px;
    flex-shrink: 0;
    margin-left: 4px;
}

.algorithm-toggle-row--compact .algorithm-toggle-label {
    padding: 4px 8px;
    font-size: 0;
    gap: 0;
    border-radius: 8px;
}

.algorithm-toggle-row--compact .algorithm-toggle-label i {
    font-size: 0.82rem;
}

.algorithm-toggle-row--compact .algorithm-toggle-label.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.algorithm-toggle-row--compact .algorithm-toggle-label:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ======================== RELATORIO INTELIGENTE MODAL ======================== */

.swal-relatorio-popup {
    max-width: 1200px !important;
    resize: both !important;
    overflow: auto !important;
    min-width: 400px;
    min-height: 300px;
}

.swal-relatorio-popup .swal2-actions {
    gap: 12px;
}

/* ======================== FILTER TOGGLE BUTTON (mobile) ======================== */

.filter-toggle-btn {
    display: none; /* hidden on desktop */
}

/* View button text: full on desktop, short on mobile */
.view-btn-short {
    display: none;
}

/* ======================== MOBILE: FILTER + TOOLBAR + PAGINATION ======================== */

@media (max-width: 767.98px) {
    /* --- Filter toggle button (mobile only) --- */
    .filter-toggle-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        margin: 10px 12px 0;
        padding: 7px 14px;
        border: 1px solid #e2e4ea;
        background: white;
        border-radius: 22px;
        font-family: var(--exp-font);
        font-size: 0.78rem;
        font-weight: 500;
        color: #4b5563;
        cursor: pointer;
        transition: all 0.2s;
    }

    .filter-toggle-btn:hover {
        border-color: #c4b5fd;
        background: #faf8ff;
    }

    .filter-toggle-arrow {
        font-size: 0.6rem;
        transition: transform 0.2s;
        color: #9ca3af;
    }

    .filter-toggle-btn.open .filter-toggle-arrow {
        transform: rotate(180deg);
    }

    /* Filter panel hidden by default on mobile, toggled by JS */
    .filter-panel.mobile-collapsed {
        display: none !important;
    }

    .filter-panel {
        gap: 6px;
        padding: 12px 12px 6px;
    }

    .filter-checkbox {
        font-size: 0.72rem;
        padding: 5px 10px;
        gap: 5px;
    }

    /* Dropdowns inline on mobile (not absolute) to avoid overflow */
    .filter-dropdown {
        position: static;
        box-shadow: none;
        border: none;
        border-left: 2px solid #e2e4ea;
        padding: 4px 0 4px 12px;
        margin-top: 4px;
        border-radius: 0;
        min-width: unset;
    }

    .explorador-toolbar {
        padding: 6px 12px;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    /* Abbreviated view button text on mobile */
    .view-btn-full {
        display: none;
    }

    .view-btn-short {
        display: inline;
    }

    .view-btn {
        padding: 5px 10px;
        font-size: 0.72rem;
    }

    .search-limit-select {
        padding: 4px 6px;
        font-size: 0.72rem;
    }

    /* Share button: icon only on mobile */
    .btn-share-graph span {
        display: none;
    }

    .btn-share-graph {
        padding: 6px 10px;
    }

    .btn-relatorio {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .btn-relatorio span {
        display: none;
    }

    .pagination-wrapper {
        padding: 8px 12px;
    }

    .pagination-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .pagination-controls {
        flex-wrap: wrap;
    }

    .page-size-select {
        font-size: 0.75rem;
        padding: 3px 6px;
    }

    .page-btn {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
}

/* ======================== GUEST SKELETON ROWS ======================== */

.skeleton-row {
    pointer-events: none;
}

.skeleton-bar {
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(90deg, #e2e4ea 25%, #f0f1f5 50%, #e2e4ea 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-bar--wide { width: 70%; }
.skeleton-bar--mid { width: 50%; }
.skeleton-bar--short { width: 30%; }
.skeleton-bar--score { width: 40px; height: 20px; border-radius: 10px; }
.skeleton-bar--badge { width: 60px; height: 22px; border-radius: 11px; }

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    pointer-events: none;
    padding: 16px;
    border: 1px solid #e2e4ea;
    border-radius: 12px;
    margin-bottom: 8px;
}

/* ======================== GUEST OVERLAY (table) ======================== */

.guest-overlay {
    position: relative;
    margin-top: -160px;
    padding: 64px 24px 32px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, white 60%);
    text-align: center;
    z-index: 10;
}

.guest-overlay-content p {
    font-size: 1.05rem;
    color: #4b5563;
    margin-bottom: 16px;
    font-weight: 500;
}

.guest-overlay-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.guest-overlay-actions .lbtn {
    padding: 10px 24px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.guest-overlay-actions .lbtn--primary {
    background: linear-gradient(135deg, #6a11cb, #2575fc);
    color: white;
}

.guest-overlay-actions .lbtn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(106, 17, 203, 0.3);
}

.guest-overlay-actions .lbtn--ghost {
    background: transparent;
    color: #6a11cb;
    border: 1px solid #e2e4ea;
}

.guest-overlay-actions .lbtn--ghost:hover {
    border-color: #c4b5fd;
    background: #faf8ff;
}

/* ======================== GUEST OVERLAY (graph) ======================== */

.guest-graph-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 32px 24px 24px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 30%, white 100%);
    z-index: 10;
}

.guest-graph-overlay p {
    color: #4b5563;
    margin-bottom: 12px;
    font-weight: 500;
}
