/* Trend Radar Frontend */

.tr-dash {
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: #1a1a1a;
    line-height: 1.6;
}

/* Header */
.tr-dash-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e8e8e8;
}
.tr-dash-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #D85A30, #534AB7);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tr-dash-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.3px;
}
.tr-dash-subtitle {
    font-size: 14px;
    color: #777;
    margin: 2px 0 0;
}

/* Sections */
.tr-section {
    margin-bottom: 28px;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
}
.tr-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
}
.tr-section-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Icon wrap */
.tr-icon-wrap {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tr-icon-summary {
    background: #f0edfe;
    color: #534AB7;
}
.tr-icon-wrap .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Date badge */
.tr-date-badge {
    font-size: 11px;
    color: #999;
    font-weight: 500;
}

/* Summary */
.tr-summary-body {
    padding: 0 20px 20px;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}
.tr-summary-body p {
    margin: 0 0 12px;
}
.tr-summary-body p:last-child {
    margin-bottom: 0;
}
.tr-summary-body strong {
    color: #1a1a1a;
}

/* Agent sections */
.tr-agent-section .tr-agent-content {
    max-height: 200px;
    overflow: hidden;
    position: relative;
    padding: 4px 20px 0;
    font-size: 14px;
    line-height: 1.7;
    color: #444;
    transition: max-height 0.3s ease;
}
.tr-agent-section .tr-agent-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, #fafafa);
    pointer-events: none;
}
.tr-agent-section.expanded .tr-agent-content {
    max-height: 2000px;
}
.tr-agent-section.expanded .tr-agent-content::after {
    display: none;
}
.tr-agent-section .tr-agent-content p {
    margin: 0 0 16px;
}

/* Expand button */
.tr-expand-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #888;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}
.tr-expand-btn:hover {
    background: #f0f0f0;
    color: #333;
}
.tr-agent-section.expanded .tr-expand-btn svg {
    transform: rotate(180deg);
}

/* Domain tags */
.tr-agent-domains {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    padding: 0 20px 12px;
}
.tr-domain-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #888;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.tr-domain-more {
    font-size: 11px;
    color: #aaa;
    padding: 2px 4px;
}

/* Sources */
.tr-agent-sources {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 12px 20px 16px;
    border-top: 1px solid #eee;
    margin-top: 12px;
}
.tr-source-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #555;
    text-decoration: none;
    transition: all 0.15s;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tr-source-link:hover {
    background: #f0f0f0;
    color: #1a1a1a;
    border-color: #ccc;
}
.tr-source-link svg {
    flex-shrink: 0;
    opacity: 0.5;
}

/* Content formatting */
.tr-subhead {
    display: block;
    font-size: 15px;
    font-weight: 700;
    margin: 20px 0 6px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    color: #1a1a1a;
    letter-spacing: -0.2px;
}
.tr-agent-content > p:first-child .tr-subhead {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Bullet lists */
.tr-agent-content .tr-bullet-list {
    margin: 8px 0 14px;
    padding-left: 20px;
    list-style: none;
}
.tr-agent-content .tr-bullet-list li {
    position: relative;
    padding-left: 14px;
    margin-bottom: 6px;
    line-height: 1.65;
}
.tr-agent-content .tr-bullet-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #534AB7;
}

/* Numbered lists */
.tr-agent-content .tr-numbered-list {
    margin: 8px 0 14px;
    padding-left: 0;
    list-style: none;
}
.tr-agent-content .tr-numbered-list li {
    padding-left: 8px;
    margin-bottom: 8px;
    line-height: 1.65;
}
.tr-list-num {
    font-weight: 600;
    color: #534AB7;
    margin-right: 2px;
}

/* Footer */
.tr-dash-footer {
    text-align: center;
    padding: 20px 0;
    font-size: 12px;
    color: #aaa;
}
.tr-dash-footer a {
    color: #999;
    text-decoration: none;
}
.tr-dash-footer a:hover {
    color: #666;
}

/* Empty state */
.tr-empty {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}
.tr-empty h3 {
    font-size: 18px;
    color: #666;
    margin: 0 0 8px;
}
.tr-empty p {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 600px) {
    .tr-dash-header {
        gap: 10px;
    }
    .tr-dash-title {
        font-size: 18px;
    }
    .tr-section-header {
        padding: 12px 16px 10px;
    }
    .tr-summary-body,
    .tr-agent-section .tr-agent-content {
        padding-left: 16px;
        padding-right: 16px;
    }
    .tr-agent-domains,
    .tr-agent-sources {
        padding-left: 16px;
        padding-right: 16px;
    }
    .tr-stats-row {
        grid-template-columns: 1fr 1fr;
    }
    .tr-topics-grid {
        grid-template-columns: 1fr;
    }
    .tr-highlights-grid {
        grid-template-columns: 1fr;
    }
    .tr-chart-container {
        height: 220px;
    }
    .tr-topic-card {
        padding: 14px;
    }
}

/* ==========================================
   QUICK STATS ROW
   ========================================== */

.tr-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}
.tr-stat-card {
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 18px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tr-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}
.tr-stat-value.tr-stat-truncate {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tr-stat-value.tr-stat-growth {
    color: #0F6E56;
}
.tr-stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ==========================================
   CHART SECTION
   ========================================== */

.tr-chart-section {
    margin-bottom: 28px;
}
.tr-icon-chart {
    background: #e8f4fd;
    color: #185FA5;
}
.tr-chart-container {
    padding: 8px 20px 20px;
    height: 300px;
    position: relative;
}
.tr-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ==========================================
   TRENDING TOPICS GRID
   ========================================== */

.tr-topics-section {
    margin-bottom: 28px;
}
.tr-icon-topics {
    background: #fef3e8;
    color: #D85A30;
}
.tr-topics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 20px 20px;
}
.tr-topic-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 16px;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.tr-topic-card:hover {
    border-color: #d0d0d0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.tr-topic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.tr-topic-rank {
    font-size: 12px;
    font-weight: 700;
    color: #534AB7;
    background: #f0edfe;
    padding: 2px 8px;
    border-radius: 6px;
}
.tr-topic-growth {
    font-size: 12px;
    font-weight: 600;
    color: #0F6E56;
    background: #e8f5e8;
    padding: 2px 8px;
    border-radius: 6px;
}
.tr-topic-name {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
    line-height: 1.3;
    color: #1a1a1a;
}
.tr-topic-category {
    display: inline-block;
    font-size: 11px;
    color: #777;
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 10px;
}
.tr-topic-subtopics {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}
.tr-subtopic-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f8f7fe;
    border: 1px solid #e8e5f5;
    color: #534AB7;
    font-weight: 500;
}
.tr-topic-sources-count {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #999;
    margin-top: 8px;
}
.tr-topic-sources-count svg {
    opacity: 0.5;
}

/* ==========================================
   PLATFORM HIGHLIGHTS
   ========================================== */

.tr-highlights-section {
    margin-bottom: 28px;
}
.tr-icon-highlights {
    background: #fef8e8;
    color: #B8860B;
}
.tr-highlights-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 20px 20px;
}
.tr-highlight-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-left: 3px solid #534AB7;
    border-radius: 0 10px 10px 0;
    padding: 14px 16px;
}
.tr-highlight-platform {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}
.tr-highlight-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.tr-highlight-metric {
    font-size: 11px;
    font-weight: 500;
    color: #888;
    background: #f5f5f5;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: auto;
    text-transform: none;
    letter-spacing: 0;
}
.tr-highlight-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
    line-height: 1.4;
    color: #1a1a1a;
}
.tr-highlight-snippet {
    font-size: 13px;
    color: #666;
    margin: 0;
    line-height: 1.55;
}

/* ==========================================
   ACTION ITEMS
   ========================================== */

.tr-actions-section {
    margin-bottom: 28px;
}
.tr-icon-actions {
    background: #e8f5e8;
    color: #0F6E56;
}
.tr-actions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 20px 20px;
}
.tr-action-card {
    display: flex;
    gap: 14px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 14px 16px;
    align-items: flex-start;
}
.tr-action-urgency {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}
.tr-urgency-high .tr-action-urgency {
    background: #fde8e8;
    color: #B7374A;
}
.tr-urgency-medium .tr-action-urgency {
    background: #fef3e8;
    color: #B8860B;
}
.tr-urgency-low .tr-action-urgency {
    background: #e8f5e8;
    color: #0F6E56;
}
.tr-action-body {
    flex: 1;
    min-width: 0;
}
.tr-action-text {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 2px;
    line-height: 1.45;
}
.tr-action-why {
    font-size: 13px;
    color: #777;
    margin: 0;
    line-height: 1.5;
}

/* ==========================================
   DEEP DIVE (collapsible agent sections)
   ========================================== */

.tr-deepdive-header {
    text-align: center;
    margin-bottom: 12px;
}
.tr-deepdive-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.tr-deepdive-toggle:hover {
    background: #f0f0f0;
    color: #333;
    border-color: #ccc;
}
.tr-deepdive {
    display: none;
}
.tr-deepdive.expanded {
    display: block;
}
.tr-deepdive.expanded + .tr-dash-footer {
    margin-top: 0;
}
