/* ==========================================
   DESIGN SYSTEM & VARIABLES
   ========================================== */
:root {
    --bg-main: #f0f4f9;
    --bg-card: #ffffff;
    --border-card: #e5e9f0;
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --primary-blue: #2563eb;
    --primary-blue-hover: #1d4ed8;
    --blue-light: #eff6ff;
    --blue-border: #bfdbfe;
    
    --sentiment-positive: #22c55e;
    --sentiment-positive-bg: #dcfce7;
    --sentiment-neutral: #94a3b8;
    --sentiment-neutral-bg: #f1f5f9;
    --sentiment-negative: #ef4444;
    --sentiment-negative-bg: #fee2e2;
    
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Plus Jakarta Sans', 'Inter', sans-serif;
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   RESET & BASE STYLES
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.dashboard-wrapper {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================
   HEADER SECTION
   ========================================== */
.main-header {
    background-color: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--card-shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-svg {
    transition: transform 0.3s ease;
}

.logo-container:hover .logo-svg {
    transform: rotate(-5deg) scale(1.05);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.logo-brand {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
    color: #1e1b4b; /* Deep dark blue */
}

.logo-subbrand {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
    color: #1e1b4b;
}

.header-divider {
    width: 1px;
    height: 40px;
    background-color: var(--border-card);
}

.title-container h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 22px;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.title-container p {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
}

.filter-container {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-right: 16px;
}

/* ---- Segmented Toggle (Unit Filter) ---- */
.unit-toggle {
    display: flex;
    position: relative;
    background: #eef2f7;
    border-radius: 10px;
    padding: 3px;
    gap: 0;
    border: 1px solid #dde3ed;
}

.unit-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    height: calc(100% - 6px);
    width: calc(50% - 3px);
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.unit-toggle-slider.right {
    transform: translateX(100%);
}

.unit-toggle-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.25s ease;
    white-space: nowrap;
}

.unit-toggle-btn svg {
    opacity: 0.5;
    transition: opacity 0.25s ease;
}

.unit-toggle-btn.active {
    color: var(--primary-blue);
}

.unit-toggle-btn.active svg {
    opacity: 1;
    stroke: var(--primary-blue);
}

.unit-toggle-btn:hover:not(.active) {
    color: var(--text-secondary);
}

/* ---- Separator ---- */
.filter-separator {
    width: 1px;
    height: 28px;
    background: #dde3ed;
}

/* ---- Date Preset Pills ---- */
.date-presets {
    display: flex;
    gap: 4px;
}

.date-preset-pill {
    padding: 6px 12px;
    border: 1px solid #dde3ed;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.date-preset-pill:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    background: rgba(37, 99, 235, 0.04);
}

.date-preset-pill.active {
    background: var(--primary-blue);
    color: #ffffff;
    border-color: var(--primary-blue);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* ---- Custom Pill ---- */
.custom-pill {
    display: flex;
    align-items: center;
    gap: 5px;
}

.custom-pill svg {
    opacity: 0.6;
}

.custom-pill.active svg {
    opacity: 1;
    stroke: #ffffff;
}

/* ---- Loading Spinner ---- */
.date-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid #dde3ed;
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Custom Date Popup Overlay ---- */
.custom-date-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.custom-date-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.custom-date-popup {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
    width: 380px;
    max-width: 92vw;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.custom-date-overlay.active .custom-date-popup {
    transform: translateY(0) scale(1);
}

.custom-date-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid #f1f5f9;
}

.custom-date-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.custom-date-title svg {
    color: var(--primary-blue);
}

.custom-date-close {
    width: 30px;
    height: 30px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.custom-date-close:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.custom-date-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.custom-date-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.custom-date-label {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.custom-date-input {
    padding: 10px 14px;
    border: 1.5px solid #dde3ed;
    border-radius: 10px;
    background: #f8fafc;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: var(--transition-smooth);
    width: 100%;
    box-sizing: border-box;
}

.custom-date-input:focus {
    border-color: var(--primary-blue);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.custom-date-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px 18px;
    border-top: 1px solid #f1f5f9;
}

.custom-date-cancel {
    padding: 9px 20px;
    border: 1.5px solid #dde3ed;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.custom-date-cancel:hover {
    border-color: var(--text-muted);
    background: #f8fafc;
}

.custom-date-apply {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border: none;
    border-radius: 10px;
    background: var(--primary-blue);
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.custom-date-apply:hover {
    background: var(--primary-blue-hover);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.custom-date-apply:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid #dde3ed;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.logout-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

/* ==========================================
   LAYOUT GRID
   ========================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    align-items: stretch;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.grid-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================
   CARD STYLING
   ========================================== */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: #cbd5e1;
}

.card-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

/* ==========================================
   LEFT COLUMN CARDS
   ========================================== */

/* Card: Total Data */
.card-total-data {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card-header-small h2 {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.card-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.total-data-value {
    font-family: var(--font-body);
    font-size: 42px;
    font-weight: 800;
    color: var(--primary-blue);
    letter-spacing: -0.03em;
    line-height: 1;
}

.total-data-growth {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
    font-size: 12px;
}

.growth-label {
    color: var(--text-muted);
    font-weight: 500;
}

.growth-percentage {
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
}

.growth-percentage.positive {
    color: #10b981;
    background-color: #ecfdf5;
}

/* Card: Sumber Data */
.card-sumber-data {
    padding-bottom: 28px;
}

.sumber-data-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sumber-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sumber-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
}

.sumber-name {
    color: var(--text-secondary);
}

.sumber-value {
    color: var(--text-primary);
    font-weight: 700;
}

.sumber-progress-bar {
    height: 38px;
    background-color: var(--blue-light);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--blue-border);
}

.sumber-progress-bar .progress-fill {
    height: 100%;
    background-color: var(--primary-blue);
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Card: Top Media */
.top-media-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.media-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.media-row:hover {
    background-color: #f8fafc;
    padding-left: 6px;
    padding-right: 6px;
}

.media-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-blue);
    flex-shrink: 0;
}

.media-logo-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #ffffff;
    flex-shrink: 0;
}

.media-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.media-progress-bar-wrapper {
    flex-grow: 1;
    height: 10px;
    background-color: #f1f5f9;
    border-radius: 5px;
    overflow: hidden;
    margin: 0 8px;
}

.media-progress-bar-wrapper .media-progress-fill {
    height: 100%;
    background-color: var(--primary-blue);
    border-radius: 5px;
    width: 0%;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.media-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
    width: 75px;
    flex-shrink: 0;
}

/* ==========================================
   RIGHT COLUMN CARDS
   ========================================== */

/* Card: Pergerakan Data */
.card-pergerakan-data {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.pergerakan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.custom-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.legend-item:hover {
    background-color: #f1f5f9;
    color: var(--text-primary);
}

.legend-item.inactive {
    opacity: 0.35;
    text-decoration: line-through;
}

.legend-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.pergerakan-chart-container {
    flex: 1;
    min-height: 200px;
    position: relative;
}

/* Custom Yellow Tooltip Note */
.chart-note-tooltip {
    position: absolute;
    top: 50px;
    right: -10px;
    background-color: #fef08a; /* Soft bright yellow */
    color: #854d0e; /* Dark gold/yellow text */
    padding: 10px 14px;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    font-size: 12px;
    font-weight: 600;
    max-width: 130px;
    line-height: 1.4;
    border-left: 4px solid #eab308;
    z-index: 10;
    animation: bounceTooltip 3s infinite ease-in-out;
}

.chart-note-tooltip::before {
    content: '';
    position: absolute;
    top: 15px;
    left: -8px;
    border-width: 8px 8px 8px 0;
    border-style: solid;
    border-color: transparent #fef08a transparent transparent;
}

@keyframes bounceTooltip {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

/* Card: Sentimen Section */
.card-sentimen {
    padding-bottom: 32px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title-sentimen {
    margin-bottom: 24px;
}

.sentimen-container {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 32px;
    align-items: center;
    flex: 1;
}

@media (max-width: 768px) {
    .sentimen-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Donut Left Section */
.sentimen-donut-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.donut-chart-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
}

.donut-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
}

.donut-percent {
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
}

.sentimen-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.legend-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.legend-row:hover {
    transform: translateX(4px);
}

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

.legend-name {
    color: var(--text-secondary);
    width: 80px;
    flex-shrink: 0;
}

.legend-value {
    color: var(--text-primary);
    font-weight: 700;
    margin-left: auto;
    margin-right: 12px;
}

.legend-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-align: center;
    width: 60px;
}

/* Sentiment Colors classes */
.positive-dot { background-color: var(--sentiment-positive); }
.neutral-dot { background-color: var(--sentiment-neutral); }
.negative-dot { background-color: var(--sentiment-negative); }

.positive-badge {
    color: var(--sentiment-positive);
    background-color: var(--sentiment-positive-bg);
}
.neutral-badge {
    color: var(--sentiment-neutral);
    background-color: var(--sentiment-neutral-bg);
}
.negative-badge {
    color: var(--sentiment-negative);
    background-color: var(--sentiment-negative-bg);
}

/* Line trend right section */
.sentimen-trend-section {
    width: 100%;
    height: 100%;
    min-height: 250px;
    display: flex;
    align-items: center;
}

.sentimen-line-container {
    width: 100%;
    height: 250px;
}

/* Date Filter Styling */
.filter-container {
    margin-right: 12px;
}

.date-select {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background-color: #ffffff;
    border: 1.5px solid var(--border-card);
    border-radius: 8px;
    padding: 8px 12px;
    outline: none;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
}

.date-select:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.08);
}

.date-select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Card Footer Action */
.card-footer-action {
    display: flex;
    justify-content: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-card);
    margin-top: 12px;
}

.btn-link {
    background: none;
    border: none;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-blue);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.btn-link:hover {
    background-color: var(--blue-light);
    color: var(--primary-blue-hover);
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background-color: #ffffff;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-card);
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 700;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    color: var(--primary-blue);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-media-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Merged Sumber Data Section */
.sumber-data-section {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-card);
}

.sumber-section-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Large Modal styling for News Details */
.modal-card-large {
    max-width: 750px;
    width: 92%;
}

.modal-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* News List Items */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.news-item {
    background-color: #f8fafc;
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: var(--transition-smooth);
}

.news-item:hover {
    border-color: var(--primary-blue);
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.06);
}

.news-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.news-title-link {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.4;
    transition: var(--transition-smooth);
}

.news-title-link:hover {
    color: var(--primary-blue);
}

.news-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.news-source-tag {
    background-color: #e2e8f0;
    color: #475569;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.news-sentiment-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.news-sentiment-badge.pos {
    background-color: #dcfce7;
    color: #166534;
}

.news-sentiment-badge.neg {
    background-color: #fee2e2;
    color: #991b1b;
}

.news-sentiment-badge.net {
    background-color: #f1f5f9;
    color: #475569;
}

.news-snippet {
    font-size: 12.5px;
    color: #475569;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Make value badge clickable */
.media-value-clickable {
    cursor: pointer;
    color: var(--primary-blue) !important;
    font-weight: 700;
    transition: var(--transition-smooth);
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(37, 99, 235, 0.06);
}

.media-value-clickable:hover {
    background-color: rgba(37, 99, 235, 0.15);
    color: var(--primary-blue-hover) !important;
}

/* ==========================================
   MODAL SYSTEM
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card,
.modal-container {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.1);
    width: 640px;
    max-width: 94vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.modal-card-large {
    width: 720px;
}

.modal-overlay.active .modal-card,
.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 14px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.modal-header h2,
.modal-header h3,
.modal-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 3px;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.modal-body {
    padding: 16px 24px 24px;
    overflow-y: auto;
    flex: 1;
}

/* ---- Chart Detail Breakdown Grid ---- */
.chart-detail-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.breakdown-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

.breakdown-card:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

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

.breakdown-info {
    display: flex;
    flex-direction: column;
}

.breakdown-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.breakdown-value {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ---- Section divider in modal ---- */
.modal-section-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-section-title svg {
    color: var(--primary-blue);
}

/* ---- News Items ---- */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.news-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    transition: var(--transition-smooth);
}

.news-item:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.news-header-row {
    margin-bottom: 6px;
}

.news-title-link {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.news-title-link:hover {
    color: var(--primary-blue);
}

.news-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

.news-source-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: #dbeafe;
    color: var(--primary-blue);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.news-sentiment-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.news-sentiment-badge.pos {
    background: #dcfce7;
    color: #16a34a;
}

.news-sentiment-badge.neg {
    background: #fee2e2;
    color: #dc2626;
}

.news-sentiment-badge.net {
    background: #f1f5f9;
    color: #64748b;
}

.news-snippet {
    font-size: 12px;
    color: #475569;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Loading state for modal ---- */
.modal-loading {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.modal-loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 10px;
}
