/* styles/pages/market-pulse.css */

/* market-pulse.css - Add to the .mp-modal-header styles */
.mp-modal-actions {
    display: flex;
    gap: 8px; /* Space between buttons */
    align-items: center;
}

.mp-action-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--theme-text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.mp-action-button:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--theme-text);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Specific style for the copy button */
#mp-copy-report-btn.copied {
    /* Green highlight to confirm copy */
    color: var(--theme-bullish);
    border-color: var(--theme-bullish);
}

/* --- Subscription Settings (from old CSS) --- */
.market-pulse-subscriptions {
    margin-top: 5px; /* Reduced top margin */
    margin-bottom: 10px; /* Add small bottom margin */
}

.market-pulse-subscriptions .subscription-option {
    padding: 15px;
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    background-color: var(--theme-section-bg);
    transition: background-color 0.2s ease;
    margin-bottom: 12px; /* Space between options */
}

.market-pulse-subscriptions .subscription-option:last-child {
    margin-bottom: 0;
}

.market-pulse-subscriptions .subscription-option:hover {
    background-color: var(--theme-section-hover-bg);
}

/* Ensure toggle styles are included if not covered globally */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px; /* Adjusted width */
    height: 24px; /* Adjusted height */
    flex-shrink: 0; /* Prevent shrinking in flex container */
}

.toggle-switch input.mp-subscription-toggle {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc; /* Default off color */
    transition: .4s;
    border-radius: 24px; /* Rounded slider */
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

/* Checked State */
.mp-subscription-toggle:checked + .toggle-slider {
    background-color: var(--theme-accent); /* Use theme accent */
}

.mp-subscription-toggle:checked + .toggle-slider:before {
    transform: translateX(26px); /* Move thumb */
}

/* Focus State */
.mp-subscription-toggle:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--theme-accent); /* Use theme accent */
}

/* Label Layout */
.toggle-switch-label {
    display: flex;
    flex-direction: row; /* Horizontal layout */
    align-items: center;
    justify-content: space-between;
    gap: 15px; /* Space between text and toggle */
    cursor: pointer;
    width: 100%;
    text-align: left; /* Align text to the left */
}

.subscription-name {
    font-weight: 600;
    color: var(--theme-text);
    font-size: 1rem;
}

.subscription-desc {
    color: var(--theme-text-secondary);
    font-size: 0.9rem;
    flex-grow: 1; /* Take available space */
}

.schedule-info {
    display: block;
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--theme-text-secondary);
    font-style: italic;
}

/* --- Report Viewer Modal --- */
/* Structural styles (might overlap with modals.css/reports.css, ensure consistency) */
.mp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none; /* Use JS to add 'visible' class */
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    z-index: 2001; /* High z-index */
}

.mp-modal-overlay.visible {
    display: flex;
}

.mp-modal-content {
    background-color: var(--theme-background);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    width: 95%;
    max-width: 900px; /* Slightly wider for reports */
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.mp-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--theme-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--theme-section-bg);
}

.mp-modal-header h3 {
    margin: 0;
    color: var(--theme-accent);
    font-size: 1.3rem;
    /* Allow title to truncate if too long */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 30px); /* Account for close button */
}

.mp-close-modal {
    background: none;
    border: none;
    color: var(--theme-text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    flex-shrink: 0; /* Prevent shrinking */
}

.mp-close-modal:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--theme-text);
}

.mp-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    background-color: var(--theme-section-bg);
    color: var(--theme-text);
    line-height: 1.6;
}

/* --- Report Content Styles --- */

/* Sentiment Badge */
.mp-sentiment-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px; /* Pill shape */
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 20px; /* Space below badge */
    text-align: center;
    border: 1px solid;
}

.mp-sentiment-badge.bullish {
    background-color: rgba(0, 200, 83, 0.15); /* Green tint */
    color: var(--theme-bullish); /* Use theme bullish color */
    border-color: var(--theme-bullish);
}

.mp-sentiment-badge.bearish {
    background-color: rgba(255, 61, 113, 0.15); /* Red tint */
    color: var(--theme-bearish); /* Use theme bearish color */
    border-color: var(--theme-bearish);
}

.mp-sentiment-badge.neutral {
    background-color: rgba(255, 170, 0, 0.15); /* Amber tint */
    color: var(--theme-neutral); /* Use theme neutral color */
    border-color: var(--theme-neutral);
}


/* Formatted Text Blocks */
.mp-formatted-text {
    line-height: 1.7;
    font-size: 0.95rem;
    color: var(--theme-text);
}

.mp-formatted-text br {
    margin-bottom: 0.5em;
}

.mp-formatted-text p {
    margin-top: 0;
    margin-bottom: 1em;
}

.mp-formatted-text ul,
.mp-formatted-text ol {
    margin-top: 0.5em;
    margin-bottom: 1em;
    padding-left: 20px;
}

.mp-formatted-text li {
    margin-bottom: 0.3em;
}

/* Summary Text */
.mp-summary-text {
    background: rgba(74, 144, 226, 0.05); /* Subtle theme accent tint */
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--theme-accent);
    margin: 10px 0 20px 0; /* Add margin below summary */
    font-size: 1rem;
    line-height: 1.8;
}

/* Story Cards */
.mp-stories-list {
    margin-bottom: 25px; /* Space below stories list */
}

.mp-story-card {
    background: var(--theme-background); /* Slightly different from section bg */
    border: 1px solid var(--theme-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.mp-story-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--theme-accent);
}

/* Story Header */
.mp-story-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap; /* Wrap on small screens */
    gap: 10px; /* Gap between title and importance */
}

.mp-story-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--theme-text);
    flex-grow: 1; /* Take available space */
    min-width: 0; /* Allow truncation */
}

.mp-story-title:hover {
    text-decoration: underline; /* Optional: underline on hover */
}

/* Importance Score */
.mp-story-importance {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--theme-text-secondary);
    flex-shrink: 0; /* Prevent shrinking */
    white-space: nowrap; /* Keep stars together */
}

.mp-importance-score {
    font-size: 0.85em;
    color: inherit;
    margin-left: 5px; /* Space between stars and score text */
}

/* Stars */
.mp-star {
    color: #ccc; /* Default empty star color */
    font-size: 1em;
}

.mp-star.filled {
    color: var(--theme-accent); /* Filled star color */
}

/* Story Summary */
.mp-story-summary {
    margin-bottom: 15px;
}

.mp-story-text {
    margin: 10px 0;
    padding: 0;
    line-height: 1.6;
    font-size: 0.9rem;
    color: var(--theme-text);
}

/* Story Sources */
.mp-story-sources {
    font-size: 0.85rem;
}

.mp-story-sources strong {
    color: var(--theme-text);
    margin-right: 5px;
}

.mp-story-sources ul {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mp-story-sources li {
    margin: 0;
}

/* Source Badges */
.mp-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid var(--theme-border);
    background: var(--theme-section-bg);
    font-size: 0.8rem;
    cursor: pointer;
    margin-right: 6px;
    margin-bottom: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mp-source-badge:hover {
    background: var(--theme-section-hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mp-source-badge.news { 
    background: rgba(33, 150, 243, 0.1); 
    border-color: rgba(33, 150, 243, 0.3); 
    color: #2196f3;
}

.mp-source-badge.youtube { 
    background: rgba(244, 67, 54, 0.1); 
    border-color: rgba(244, 67, 54, 0.3); 
    color: #f44336;
}

.mp-source-badge.twitter { 
    background: rgba(3, 169, 244, 0.1); 
    border-color: rgba(3, 169, 244, 0.3); 
    color: #03a9f4;
}

.mp-source-badge.unknown { 
    background: rgba(158, 158, 158, 0.1); 
    border-color: rgba(158, 158, 158, 0.3); 
    color: #9e9e9e;
}

.mp-source-icon {
    font-size: 0.9em;
}

.mp-source-identifier {
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* --- Key Metrics Section --- */
.mp-key-metrics {
    margin-top: 25px; /* Space above key metrics */
    padding-top: 20px;
    border-top: 1px solid var(--theme-border);
}

.mp-key-metrics h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--theme-border);
    color: var(--theme-text);
}

/* Metrics Grid */
.mp-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Responsive grid */
    gap: 15px;
    margin-bottom: 20px;
}

/* Metric Card */
.mp-metric-card {
    background-color: var(--theme-section-bg);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.mp-metric-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Metric Icon */
.mp-metric-icon {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

/* Metric Value */
.mp-metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--theme-accent);
    margin-bottom: 5px;
    line-height: 1.2;
}

/* Metric Label */
.mp-metric-label {
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
    font-weight: 500;
}

/* Top Assets */
.mp-top-assets {
    margin-top: 15px;
}

.mp-top-assets h5 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--theme-text);
    font-size: 1rem;
}

.mp-asset-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* Space between tags */
}

.mp-asset-tag {
    background-color: rgba(74, 144, 226, 0.1); /* Theme accent tint */
    color: var(--theme-accent);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 20px; /* Pill shape */
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.mp-no-assets {
    color: var(--theme-text-secondary);
    font-style: italic;
    font-size: 0.85rem;
}


/* --- Report Footer --- */
.mp-report-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px dashed var(--theme-border);
    text-align: center;
}

.mp-generated-at {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--theme-text-secondary);
    font-style: italic;
    font-size: 0.85rem;
}

.mp-generated-at i {
    color: var(--theme-accent);
}


/* --- General Styles / Placeholders --- */
.mp-empty-state {
    text-align: center;
    padding: 30px;
    background: var(--theme-section-bg);
    border-radius: 8px;
    border: 2px dashed var(--theme-border);
    margin: 15px 0;
    color: var(--theme-text-secondary);
    font-style: italic;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .mp-modal-content {
        max-width: 95vw; /* Wider on mobile */
    }

    .mp-modal-header h3 {
       font-size: 1.1rem;
    }

    .mp-modal-body {
        padding: 15px;
    }

    .mp-story-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .mp-story-importance {
        align-self: flex-end; /* Align importance to the right on new line */
    }

    .mp-metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Smaller min width */
        gap: 10px;
    }

    .mp-metric-card {
        padding: 12px;
    }

    .mp-metric-icon {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    .mp-metric-value {
        font-size: 1.5rem;
    }

    .mp-asset-tags {
        gap: 6px;
    }

    .mp-asset-tag {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    .subscription-desc {
        font-size: 0.85rem;
    }

    .schedule-info {
        font-size: 0.75rem;
    }

    .toggle-switch-label {
        gap: 10px; /* Reduce gap on mobile */
    }
}

@media (max-width: 480px) {
    .mp-modal-header h3 {
       font-size: 1rem;
    }

    .mp-story-title {
        font-size: 1rem;
    }

    .mp-source-identifier {
        max-width: 100px; /* Further limit width on small screens */
    }

    .mp-metric-card {
        padding: 10px;
    }

    .mp-metric-value {
        font-size: 1.3rem;
    }

    .mp-metric-label {
        font-size: 0.8rem;
    }

    .subscription-name {
        font-size: 0.95rem;
    }
}