/* =========================================
   DASHBOARD LAYOUT
========================================= */

.research-dashboard {
    width: 100%;
}

.dashboard-section {
    margin-top: 3rem;
}

.deeper-title{

    margin-bottom:8px;

}

/* =========================================
   KPI CARDS
========================================= */

.dashboard-kpi {

    height: 170px;

    display: flex;

    flex-direction: column;

    justify-content: center;

    transition: .25s ease;

}

.dashboard-kpi:hover{

    transform: translateY(-3px);

}

.kpi-label{

    font-size: .85rem;

    color: #8b8b8b;

    margin-bottom: .75rem;

    font-weight: 500;

}

.kpi-value{

    font-size: 48px;

    font-weight: 700;

    color: var(--primary-color);

    line-height: 1;

    margin-bottom: .75rem;

}

.kpi-desc{

    font-size: .82rem;

    color: #9e9e9e;

}


/* =========================================
   DASHBOARD CARDS
========================================= */

.dashboard-card-header{

    display:flex;

    justify-content:space-between;

    align-items:center;

    margin-bottom:1rem;

}

.dashboard-card-header h6{

    margin:0;

    font-weight:600;

}


.kpi-value.theme-positive{

    color:#28a745;

}

.kpi-value.theme-negative{

    color:#dc3545;

}


/* =========================================
   SMALL CHIP
========================================= */

.dashboard-chip{

    padding:4px 10px;

    border-radius:999px;

    background:#f3efff;

    color:#8f75d8;

    font-size:.72rem;

    font-weight:600;

}


/* =========================================
   HEATMAP PLACEHOLDER
========================================= */

.heatmap-container{

    min-height:220px;

    display:flex;

    align-items:center;

    justify-content:center;

    border-radius:12px;

    background:#fafafa;

    border:1px dashed #dddddd;

    color:#9e9e9e;

    font-size:.9rem;

}

.heatmap-large{

    min-height:340px;

}

/* =========================================
   HEATMAP TABLE
========================================= */
/* =========================================
   MODERN HEATMAP
========================================= */

.heatmap-scroll{

    width:100%;

    overflow-x:auto;

    overflow-y:hidden;

    -webkit-overflow-scrolling:touch;

    padding-bottom:4px;

}

.heatmap-scroll::-webkit-scrollbar{

    height:6px;

}

.heatmap-scroll::-webkit-scrollbar-track{

    background:transparent;

}

.heatmap-scroll::-webkit-scrollbar-thumb{

    background:#c8c8c8;

    border-radius:3px;

}

.heatmap-scroll::-webkit-scrollbar-thumb:hover{

    background:#a8a8a8;

}

.heatmap-wrapper{

    min-width:max-content;

}

.heatmap-header{

    display:grid;

    gap:12px;

    margin-bottom:12px;

}

.heatmap-header > :first-child{

    position:sticky;

    left:0;

    z-index:2;

    background:#fff;

}

.heatmap-column-label{

    text-align:center;

    font-size:.78rem;

    color:#777;

    font-weight:600;

}

.heatmap-row{

    display:grid;

    gap:12px;

    align-items:center;

    margin-bottom:10px;

}

.heatmap-theme{

    position:sticky;

    left:0;

    z-index:1;

    font-size:.85rem;

    font-weight:600;

    color:#555;

    background:#fff;

    padding-right:8px;

    white-space:nowrap;

}

.heatmap-bar{

    height:34px;

    border-radius:11px;

    display:flex;

    justify-content:center;

    align-items:center;

    font-weight:600;

    font-size:.8rem;

    cursor:pointer;

    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;

    background-image: linear-gradient(
        180deg,
        rgba(255,255,255,0.12) 0%,
        rgba(0,0,0,0.06) 100%
    );

}

.heatmap-bar:hover{

    transform:translateY(-1px);

    filter:brightness(1.06);

    box-shadow:0 3px 10px rgba(93,53,184,.12);

}

/* Empty / lowest */
.heatmap-level-0{

    background-color:#f4f0ff;

    color:#4b4456;

}

/* Low */
.heatmap-level-1{

    background-color:#e6e0ff;

    color:#4b4456;

}

/* Low-mid */
.heatmap-level-2{

    background-color:#d4c9ff;

    color:#3a3445;

}

/* Mid */
.heatmap-level-3{

    background-color:#b8a5f7;

    color:#2d2738;

}

/* High */
.heatmap-level-4{

    background-color:#8b6ce8;

    color:#ffffff;

}

/* Highest */
.heatmap-level-5{

    background-color:#5d35b8;

    color:#ffffff;

}

/* =========================================
   RESEARCH FILTER BAR
========================================= */

.research-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-top: 2rem;
}

.research-filter-group {
    flex: 1 1 160px;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.research-filter-group label {
    font-size: .75rem;
    color: #8B8E98;
    font-weight: 600;
    margin-bottom: 0;
}

.research-filter-group .input_field {
    width: 100%;
    margin-bottom: 0;
    background-color: #fff;
}

.research-select {
    position: relative;
}

.research-select .input_field {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 32px;
    background-image: none;
    cursor: pointer;
}

.research-select > i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .75rem;
    color: #8B8E98;
    pointer-events: none;
}

.research-multi-select {
    position: relative;
}

.research-multi-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding-right: 12px;
    cursor: pointer;
}

.research-multi-trigger .research-multi-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .9rem;
    color: #555;
}

.research-multi-trigger i {
    font-size: .75rem;
    color: #8B8E98;
    transition: transform .2s ease;
    flex-shrink: 0;
}

.research-multi-select.is-open .research-multi-trigger i {
    transform: rotate(180deg);
}

.research-multi-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #f1f1f1;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
    max-height: 320px;
    display: flex;
    flex-direction: column;
}

.research-multi-select.is-open .research-multi-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.research-multi-search {
    position: relative;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.research-multi-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .85rem;
    color: #aaa;
}

.research-multi-search input {
    width: 100%;
    height: 36px;
    padding: 0 10px 0 32px;
    border: 1px solid #f1f1f1;
    border-radius: 8px;
    font-size: .85rem;
    color: #555;
    outline: none;
    background: #fafafa;
    transition: border-color .2s ease, background-color .2s ease;
}

.research-multi-search input:focus {
    border-color: #A18CD1;
    background: #fff;
}

.research-multi-search input::placeholder {
    color: #aaa;
}

.research-multi-options {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 2px;
}

.research-multi-options::-webkit-scrollbar {
    width: 5px;
}

.research-multi-options::-webkit-scrollbar-track {
    background: transparent;
}

.research-multi-options::-webkit-scrollbar-thumb {
    background: #e0d8f5;
    border-radius: 10px;
}

.research-multi-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: .85rem;
    color: #555;
    font-weight: 500;
    transition: background-color .15s ease;
}

.research-multi-options label:hover {
    background-color: #f6f4ff;
}

.research-multi-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #A18CD1;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.research-multi-options span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.research-multi-group {
    padding: 8px 8px 4px;
    font-size: .72rem;
    font-weight: 700;
    color: #A18CD1;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-top: 4px;
}

.research-multi-options label.is-hidden {
    display: none;
}

.research-filter-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    align-items: flex-end;
}

.research-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: .85rem;
    font-weight: 500;
    color: #8B8E98;
    background: transparent;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: color .2s ease, background-color .2s ease;
}

.research-reset-btn:hover {
    color: #A18CD1;
    background-color: #f3efff;
}

.research-reset-btn i {
    font-size: .9rem;
}

.research-custom-range {
    display: none;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.research-custom-range.is-visible {
    display: flex;
}

.research-filter-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 14px;
    background: #f9f8ff;
    border-radius: 10px;
    font-size: .8rem;
    color: #8f75d8;
    font-weight: 500;
}

.research-filter-info i {
    font-size: 1rem;
    margin-top: 1px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .research-filter-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
    }

    .research-reset-btn {
        width: 100%;
        justify-content: center;
    }

    .research-multi-panel {
        position: fixed;
        top: auto;
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-height: 60vh;
        z-index: 2000;
    }

    .research-header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .research-export-wrap {
        width: 100%;
    }

    .research-export-btn {
        width: 100%;
        justify-content: center;
    }
}


/* =========================================
   DASHBOARD HEADER / EXPORT
========================================= */

.research-header-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    text-align: left;
}

.research-header-text {
    flex: 1;
}

.research-header-text .page-title,
.research-header-text .page-subtitle {
    text-align: left;
}

.research-export-wrap {
    position: relative;
    flex-shrink: 0;
    margin-top: 6px;
}

.research-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    font-size: .85rem;
    font-weight: 500;
    color: #A18CD1;
    background: #fff;
    border: 1px solid #A18CD1;
    border-radius: 30px;
    cursor: pointer;
    transition: all .2s ease;
}

.research-export-btn:hover {
    color: #fff;
    background: #A18CD1;
}

.research-export-btn i {
    font-size: .85rem;
}

.research-export-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 100;
    min-width: 160px;
    background: #fff;
    border: 1px solid #f1f1f1;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.research-export-wrap.is-open .research-export-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.research-export-menu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: .85rem;
    font-weight: 500;
    color: #555;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .15s ease;
}

.research-export-menu button:hover {
    background: #f6f4ff;
    color: #A18CD1;
}


/* =========================================
   CARD ACTIONS
========================================= */

.research-card-actions {
    position: relative;
}

.research-card-menu-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #aaa;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

.research-card-menu-btn:hover {
    color: #A18CD1;
    background: #f6f4ff;
}

.research-card-menu-btn i {
    font-size: 1.1rem;
}

.research-card-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 50;
    min-width: 150px;
    background: #fff;
    border: 1px solid #f1f1f1;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.research-card-actions.is-open .research-card-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.research-card-menu button {
    display: block;
    width: 100%;
    padding: 7px 12px;
    font-size: .82rem;
    font-weight: 500;
    color: #555;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .15s ease;
}

.research-card-menu button:hover {
    background: #f6f4ff;
    color: #A18CD1;
}


/* =========================================
   FULL SCREEN MODAL
========================================= */

.research-fullscreen-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.research-fullscreen-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.research-fullscreen-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(4px);
}

.research-fullscreen-content {
    position: relative;
    z-index: 1;
    width: 92vw;
    max-width: 1200px;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(93, 53, 184, .12);
    padding: 28px;
    overflow: auto;
    transform: scale(.96);
    transition: transform .25s ease;
}

.research-fullscreen-modal.is-open .research-fullscreen-content {
    transform: scale(1);
}

.research-fullscreen-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #8B8E98;
    background: #f9f8ff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
    z-index: 2;
}

.research-fullscreen-close:hover {
    color: #A18CD1;
    background: #f3efff;
}

.research-fullscreen-body {
    width: 100%;
}

.research-fullscreen-body .heatmap-wrapper {
    min-width: 100%;
}


/* =========================================
   EXCEL EXPORT MODAL
========================================= */

.research-excel-modal {
    position: fixed;
    inset: 0;
    z-index: 3100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.research-excel-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.research-excel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(45, 39, 56, .35);
    backdrop-filter: blur(2px);
}

.research-excel-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(93, 53, 184, .14);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(.96);
    transition: transform .25s ease;
}

.research-excel-modal.is-open .research-excel-content {
    transform: scale(1);
}

.research-excel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #f1f1f1;
}

.research-excel-header h5 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #4b4456;
}

.research-excel-close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #8B8E98;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

.research-excel-close:hover {
    color: #A18CD1;
    background: #f6f4ff;
}

.research-excel-body {
    padding: 20px 22px;
    overflow-y: auto;
}

.research-excel-section {
    margin-bottom: 18px;
}

.research-excel-section:last-child {
    margin-bottom: 0;
}

.research-excel-section-title {
    font-size: .8rem;
    font-weight: 700;
    color: #8f75d8;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 10px;
}

.research-excel-radio,
.research-excel-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: .88rem;
    font-weight: 500;
    color: #555;
    cursor: pointer;
}

.research-excel-radio input,
.research-excel-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: #A18CD1;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.research-excel-custom-range {
    display: none;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    padding-left: 26px;
}

.research-excel-custom-range.is-visible {
    display: flex;
}

.research-excel-field {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.research-excel-field label {
    font-size: .75rem;
    color: #8B8E98;
    font-weight: 600;
}

.research-excel-field .input_field {
    margin-bottom: 0;
}

.research-excel-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid #f1f1f1;
}

.research-excel-footer .btn {
    padding: 8px 20px;
    font-size: .85rem;
    border-radius: 30px;
}


/* =========================================
   SKELETON / SHIMMER LOADING
========================================= */

.skeleton-box {
    background: linear-gradient(
        90deg,
        #f3f0ff 25%,
        #ebe6ff 50%,
        #f3f0ff 75%
    );
    background-size: 200% 100%;
    border-radius: 8px;
    animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.dashboard-kpi.is-loading .kpi-value {
    width: 70%;
    height: 48px;
    margin-bottom: .75rem;
}

.dashboard-kpi.is-loading .kpi-desc {
    width: 85%;
    height: 14px;
}

.heatmap-container.is-loading {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 12px;
    padding: 20px;
}

.heatmap-container.is-loading .skeleton-row {
    display: grid;
    gap: 12px;
    align-items: center;
}

.heatmap-container.is-loading .skeleton-theme {
    width: 140px;
    height: 16px;
}

.heatmap-container.is-loading .skeleton-bar {
    height: 34px;
    border-radius: 11px;
}

.insight-card.is-loading {
    min-height: 160px;
}

.insight-card.is-loading .skeleton-line {
    height: 12px;
    margin-bottom: 10px;
}

.research-fade-in {
    animation: fade-in .35s ease;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =========================================
   BOTTOM SECTION
========================================= */

.summary-card{

    min-height:420px;

}


/* =========================================
   AI RESEARCH ANALYSIS SECTION
   Separated from the filtered visualisations
========================================= */

.ai-research-section {
    margin-top: 5rem;
    padding-top: 2.75rem;
    border-top: 2px solid #d4c9ff;
}

.ai-research-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.ai-research-section-header .deeper-title {
    margin-bottom: 0.35rem;
}

.ai-scope-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: #f3efff;
    color: #8f75d8;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

.ai-scope-label {
    margin-left: 0.3em;
}

@media (max-width: 768px) {
    .ai-research-section-header {
        flex-direction: column;
    }

    .ai-scope-badge {
        width: 100%;
        justify-content: center;
    }
}
