/* =====================================================
   RESEARCH PAGE - VIS Rating
   ===================================================== */

/* Tab Navigation & Tab Content: reuses rr- classes from rating-results.css */

/* ===== Section Header ===== */
.rs-section-header {
    margin-bottom: 40px;
}

.rs-section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--secondary-color);
    margin-bottom: 12px;
}

.rs-section-label svg {
    width: 16px;
    height: 16px;
}

.rs-section-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.2;
}

.rs-section-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ===== Featured Reports Section ===== */
.rs-featured-section {
    padding: 72px 0 40px;
}

.rs-featured-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    height: 500px;
}

/* Featured Main Card */
.rs-featured-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    min-width: 0; /* prevent grid blowout */
}

.rs-featured-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--secondary-color);
}

.rs-featured-main {
    grid-row: 1 / 2;
    height: 500px;
}

.rs-featured-image {
    position: relative;
    overflow: hidden;
    height: 280px;
}

.rs-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.rs-featured-card:hover .rs-featured-image img {
    transform: scale(1.05);
}

.rs-featured-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(var(--primary-rgb), 0.6) 100%);
}

.rs-featured-badge-wrap {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 2;
}

.rs-report-type {
    display: inline-block;
    padding: 5px 14px;
    background: rgba(var(--secondary-rgb), 0.9);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
    backdrop-filter: blur(8px);
}

.rs-featured-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.rs-featured-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.rs-tag {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(var(--secondary-rgb), 0.08);
    color: var(--secondary-color);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}

.rs-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.rs-featured-title {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.rs-featured-main .rs-featured-title {
    font-size: 1.35rem;
}

.rs-featured-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 16px;
    flex: 1;
}

.rs-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-top: auto;
    transition: var(--transition);
}

.rs-featured-card:hover .rs-read-more {
    gap: 10px;
}

/* Side Cards */
.rs-featured-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 500px;
    min-width: 0; /* prevent grid blowout */
}

.rs-featured-compact {
    flex: 1;
    flex-direction: column;
    justify-content: center;
}

.rs-featured-compact .rs-featured-body {
    padding: 20px 24px;
}

.rs-featured-compact .rs-featured-title {
    font-size: 0.95rem;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rs-featured-sapo {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.rs-featured-compact .rs-read-more {
    font-size: 0.8rem;
}

/* ===== Reports Table Section ===== */
.rs-reports-section {
    padding: 40px 0 72px;
}

/* Toolbar */
.rs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.rs-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.rs-chip {
    padding: 7px 18px;
    border: 1px solid var(--border-color);
    border-radius: 100px;
    background: #fff;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.rs-chip:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.rs-chip.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #fff;
}

.rs-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    min-width: 280px;
    transition: var(--transition);
}

.rs-search-bar:focus-within {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(var(--secondary-rgb), 0.1);
}

.rs-search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.rs-search-bar input {
    border: none;
    outline: none;
    font-family: var(--font-main);
    font-size: 0.88rem;
    color: var(--text-dark);
    width: 100%;
    background: transparent;
}

.rs-search-bar input::placeholder {
    color: var(--text-subtle);
}

/* Table */
.rs-table-wrapper {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: visible;
    position: relative;
}

/* Hide overflow only for the scroll area */
.rs-table-scroll {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.rs-table-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.rs-table-scroll::-webkit-scrollbar-track {
    background: var(--surface-color);
}

.rs-table-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.rs-table-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-subtle);
}

.rs-table-head {
    position: sticky;
    top: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: 110px 1fr 180px 140px 90px;
    gap: 0;
    padding: 14px 24px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Allow popover to overflow outside table wrapper */
.rs-table-head > .rr-filter-popover {
    position: absolute;
}

.rs-table-head span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rs-col-filter,
.rs-col-search {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    opacity: 0.5;
    transition: var(--transition);
}

.rs-col-filter:hover,
.rs-col-search:hover {
    opacity: 1;
}

.rs-col-filter.is-selected,
.rs-col-search.is-selected {
    opacity: 1;
    background: rgba(255, 255, 255, 0.26);
    border-radius: 3px;
}

.rs-col-filter svg,
.rs-col-search svg {
    width: 14px;
    height: 14px;
    stroke: #fff;
}

.rs-table-row {
    display: grid;
    grid-template-columns: 110px 1fr 180px 140px 90px;
    gap: 0;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    align-items: center;
}

.rs-table-row:last-of-type {
    border-bottom: none;
}

.rs-table-row:hover {
    background: rgba(var(--secondary-rgb), 0.03);
}

.rs-cell {
    font-size: 0.88rem;
}

.rs-cell-date {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.rs-cell-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--text-dark);
    padding-right: 16px;
    line-height: 1.45;
}

.rs-cell-title strong {
    font-weight: 600;
    font-size: 0.9rem;
}

.rs-cell-title > span {
    font-weight: 400;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.rs-table-row:hover .rs-cell-title strong {
    color: var(--secondary-color);
}

.rs-type-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.rs-cell-sector {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.rs-cell-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

/* Table Footer / Pagination */
.rs-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 0.82rem;
    color: var(--text-muted);
    background: var(--surface-color);
    position: relative;
    z-index: 1;
}

.rs-pagination {
    display: flex;
    gap: 4px;
}

.rs-page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-dark);
    font-size: 0.82rem;
    font-family: var(--font-main);
    cursor: pointer;
    transition: var(--transition);
}

.rs-page-btn:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.rs-page-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #fff;
}

/* ===== Infographic Section ===== */
.rs-infographic-section {
    padding: 72px 0 40px;
}


/* KPI Row */
.rs-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 36px;
}

.rs-kpi-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    position: relative;
}

.rs-kpi-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: rgba(var(--secondary-rgb), 0.2);
}

.rs-kpi-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--secondary-rgb), 0.08);
    border-radius: 12px;
    color: var(--secondary-color);
    flex-shrink: 0;
}

.rs-kpi-content {
    display: flex;
    flex-direction: column;
}

.rs-kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.rs-kpi-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.rs-kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

.rs-kpi-trend {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
}

.rs-kpi-trend.positive {
    color: #059669;
    background: rgba(5, 150, 105, 0.08);
}

.rs-kpi-trend.negative {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

/* Charts Grid */
.rs-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.rs-chart-wide {
    grid-column: 1 / -1;
}

.rs-chart-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.rs-chart-card:hover {
    box-shadow: var(--shadow-sm);
}

.rs-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.rs-chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.rs-chart-period {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 4px 10px;
    background: var(--surface-color);
    border-radius: 4px;
}

.rs-chart-body {
    padding: 20px 24px 24px;
}

/* Horizontal Bar Chart */
.rs-hbar-chart {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rs-hbar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rs-hbar-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    min-width: 100px;
    text-align: right;
}

.rs-hbar-track {
    flex: 1;
    height: 28px;
    background: var(--surface-color);
    border-radius: 6px;
    overflow: hidden;
}

.rs-hbar-fill {
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    min-width: 40px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Donut Chart */
.rs-donut-chart {
    display: flex;
    align-items: center;
    gap: 32px;
}

.rs-donut-svg {
    width: 180px;
    height: 180px;
    flex-shrink: 0;
}

.rs-donut-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rs-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.rs-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Vertical Bar Chart */
.rs-bar-chart-vertical {
    display: flex;
    gap: 0;
    height: 260px;
}

.rs-vbar-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-right: 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: right;
    min-width: 36px;
    padding-bottom: 28px;
}

.rs-vbar-container {
    display: flex;
    gap: 8px;
    flex: 1;
    align-items: flex-end;
    border-left: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0 8px 0 12px;
    position: relative;
}

.rs-vbar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
}

.rs-vbar {
    width: 100%;
    max-width: 40px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--primary-light), var(--primary-color));
    position: relative;
    transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.rs-vbar-alt {
    background: linear-gradient(180deg, var(--secondary-color), #005ecb);
}

.rs-vbar-accent {
    background: linear-gradient(180deg, var(--accent-color), var(--secondary-color));
}

.rs-vbar-val {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.rs-vbar-x {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.rs-chart-legend-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 16px;
    padding-left: 48px;
}

.rs-bar-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.rs-legend-sq {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.rs-bar-legend-unit {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-subtle);
    font-style: italic;
}

/* Rate List */
.rs-rate-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rs-rate-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rs-rate-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rs-rate-name {
    font-size: 0.84rem;
    color: var(--text-dark);
    font-weight: 500;
}

.rs-rate-val {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-dark);
}

.rs-rate-bar {
    height: 8px;
    background: var(--surface-color);
    border-radius: 4px;
    overflow: hidden;
}

.rs-rate-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Infographic Note */
.rs-infographic-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

.rs-infographic-note svg {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 2px;
}

.rs-infographic-note p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* CTA section — shared CSS in style.css (.cta-section, .cta-grid, .cta-card, .cta-card-icon, .cta-title, .cta-desc) */

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .rs-featured-grid {
        grid-template-columns: 1fr;
        height: auto;
        gap: 20px;
    }

    .rs-featured-main {
        height: auto;
    }

    .rs-featured-side {
        height: auto;
    }

    .rs-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .rs-table-head {
        position: sticky;
        top: 0;
        grid-template-columns: 90px 1fr 140px 90px;
    }

    .rs-table-row {
        grid-template-columns: 90px 1fr 140px 90px;
    }

    .rs-table-head span:nth-child(4),
    .rs-table-row .rs-cell-sector {
        display: none;
    }
}

@media (max-width: 768px) {
    .tabs-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 12px 20px;
        font-size: 0.82rem;
    }

    .rs-featured-section,
    .rs-reports-section,
    .rs-infographic-section {
        padding: 40px 0 24px;
    }

    .rs-section-header {
        margin-bottom: 24px;
    }

    .rs-section-title {
        font-size: 1.5rem;
    }

    .rs-section-desc {
        font-size: 0.88rem;
    }

    /* Featured grid mobile */
    .rs-featured-grid {
        gap: 14px;
    }

    .rs-featured-image {
        height: 220px;
    }

    .rs-featured-body {
        padding: 18px 20px;
    }

    .rs-featured-main .rs-featured-title {
        font-size: 1.15rem;
    }

    .rs-featured-title {
        font-size: 1rem;
    }

    .rs-featured-side {
        gap: 14px;
    }

    .rs-featured-compact .rs-featured-body {
        padding: 14px 18px;
    }

    .rs-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .rs-search-bar {
        min-width: 100%;
    }

    .rs-filter-chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .rs-table-head {
        position: sticky;
        top: 0;
        grid-template-columns: 110px minmax(360px, 1fr) 190px 90px;
        min-width: 780px;
        padding: 12px 16px;
    }

    .rs-table-row {
        grid-template-columns: 110px minmax(360px, 1fr) 190px 90px;
        min-width: 780px;
        padding: 12px 16px;
    }

    /* Mobile: wrapper scroll everything except footer */
    .rs-table-wrapper {
        overflow-x: auto;
        /* Hide scrollbar but keep scroll functionality */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    .rs-table-wrapper::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .rs-table-wrapper .rr-table-toolbar {
        min-width: 780px;
        width: 780px;
    }

    /* Reset individual overflow - let parent handle scroll */
    .rs-table-scroll {
        overflow-x: visible !important;
        overflow-y: visible !important;
        max-height: none !important;
    }

    /* Footer stays fixed - doesn't scroll with table */
    .rs-table-footer {
        position: sticky;
        left: 0;
    }

    .rs-table-head span:nth-child(4),
    .rs-table-row .rs-cell-sector {
        display: none;
    }

    .rs-kpi-row {
        grid-template-columns: 1fr;
    }

    .rs-charts-grid {
        grid-template-columns: 1fr;
    }

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

    .cta-card {
        padding: 28px;
    }

    .cta-section {
        padding: 56px 0;
    }

    .rs-donut-chart {
        flex-direction: column;
        align-items: center;
    }

    .rs-chart-legend-bar {
        flex-wrap: wrap;
        padding-left: 0;
    }

    .rs-bar-legend-unit {
        margin-left: 0;
        width: 100%;
        margin-top: 4px;
    }

    /* Vertical bar chart — scroll horizontally on mobile */
    .rs-chart-body:has(.rs-bar-chart-vertical) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 16px;
    }

    .rs-bar-chart-vertical {
        min-width: 520px;
    }

    /* Chart header — stack on mobile when title wraps */
    .rs-chart-header {
        flex-wrap: wrap;
        gap: 6px;
        align-items: flex-start;
        padding: 16px 16px 0;
    }

    .rs-chart-title {
        flex: 1 1 100%;
    }

    .rs-chart-period {
        flex-shrink: 0;
    }

    .rs-chart-body {
        padding: 16px 16px 20px;
    }
}

@media (max-width: 480px) {
    .rs-featured-grid {
        gap: 12px;
    }

    .rs-featured-image {
        height: 180px;
    }

    .rs-featured-body {
        padding: 14px 16px;
    }

    .rs-featured-main .rs-featured-title {
        font-size: 1.05rem;
    }

    .rs-featured-compact .rs-featured-body {
        padding: 12px 16px;
    }

    .rs-featured-side {
        gap: 10px;
    }

    .rs-hbar-label {
        min-width: 80px;
        font-size: 0.75rem;
    }

    .rs-kpi-card {
        padding: 18px;
    }

    .rs-kpi-value {
        font-size: 1.3rem;
    }

    .rs-table-footer {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .rs-vbar-val {
        font-size: 0;
    }
}
