/* Basic Styling & Dark Theme Placeholder */

body {
    background-color: #1a1a1a; /* Dark background */
    color: #e0e0e0; /* Light text */
    font-family: sans-serif;
    margin: 0;
    padding: 0;
}

h1, h2, h3 {
    color: #ffffff;
}

h1 {
    text-align: center; /* Center the main title */
    margin-top: 20px; /* Add some space above */
    margin-bottom: 20px; /* Add some space below */
}

/* Add more specific styles for layout, chart, forms, etc. later */

#chart {
    min-height: 600px; /* Ensure space for the chart */
    width: 100%; /* Optional: Ensure it takes full width */
    /* Add other chart container styles if needed */
}

/* --- Tab Navigation Styles --- */
.tab-navigation {
    border-bottom: 1px solid #555;
    margin-bottom: 15px;
    overflow: hidden; /* Clear floats */
}

.tab-navigation button.tab-link {
    background-color: #333; /* Dark background for inactive tabs */
    color: #ccc; /* Light text */
    border: 1px solid #555;
    border-bottom: none; /* Remove bottom border */
    outline: none;
    cursor: pointer;
    padding: 10px 15px;
    transition: 0.3s;
    font-size: 1em;
    border-radius: 5px 5px 0 0; /* Rounded top corners */
    margin-right: 5px; /* Space between tabs */
    float: left; /* Align tabs horizontally */
}

.tab-navigation button.tab-link:hover {
    background-color: #444; /* Slightly lighter on hover */
}

.tab-navigation button.tab-link.active {
    background-color: #1e1e1e; /* Match plot background or slightly lighter */
    color: #fff; /* White text for active tab */
    border-color: #555;
    border-bottom: 1px solid #1e1e1e; /* Overlap content border */
    position: relative;
    top: 1px; /* Align with content border */
}

/* --- Tab Content Styles --- */
.tab-content {
    padding: 15px;
    border: 1px solid #555;
    border-top: none; /* Remove top border as tabs cover it */
    background-color: #282828; /* Slightly different background for content */
    border-radius: 0 0 5px 5px; /* Rounded bottom corners */
    /* display: none; is handled by inline style initially */
    color: #ddd; /* Default text color for tab content */
    clear: both; /* Ensure content clears floated tabs */
}

/* Add styles for news analysis content later */
#news-analysis-content h2 {
    margin-top: 0;
    color: #eee;
}

/* Center the main H2 title of the News Analysis Tab */
#NewsAnalysisTab > h2 {
    text-align: center;
    margin-bottom: 20px; /* Add space below title */
}

#news-analysis-content .category-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #333;
    border: 1px solid #444;
    border-radius: 4px;
}
/* ... more specific styles for charts, scores, drivers etc. will be added later ... */

/* --- News Analysis Specific Styles --- */
.driver-tag {
    display: inline-block;
    /* background-color: #007bff; REMOVE default blue */
    color: white;
    padding: 5px 10px;
    margin: 3px;
    border-radius: 15px; /* Pill shape */
    font-size: 0.9em;
    border: 1px solid transparent; /* Add border for consistency */
}

/* Sentiment colors for driver tags */
.driver-tag.bullish {
    background-color: #5cb85c;
    border-color: #4cae4c;
}
.driver-tag.bearish {
    background-color: #d9534f;
    border-color: #d43f3a;
}
.driver-tag.neutral {
    background-color: #777777;
    border-color: #666666;
}
.driver-tag.mixed {
    background-color: #6c757d;
}

/* --- NEW: Header Bar Styles --- */
.header-bar {
    width: 100%;
    display: flex;
    justify-content: flex-start; /* Aligns items to the left */
    padding: 10px 20px;
    box-sizing: border-box;
    margin-top: 20px; /* RE-ADD space from the top */
}

.header-bar h1 {
    margin: 0;
    font-size: 1.5em;
}

.header-btn {
    position: absolute;
    top: 20px;
    left: 72px; /* MODIFIED: Increased from 20px */
    z-index: 10;
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.header-btn:hover {
    background-color: #0056b3;
}
/* --- END NEW --- */

/* --- Category Details Styles --- */
#category-details-container h3 {
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
    margin-top: 25px; /* Add space above details */
    margin-bottom: 15px;
}

/* --- Category Section Styling --- */
.category-section {
    margin-bottom: 20px;
    padding: 0; /* Remove padding here, apply to inner divs */
    background-color: #333; /* Add a default background */
    border: 1px solid #555; /* Slightly darker border */
    border-radius: 5px;
    overflow: hidden; /* Contain header background */
}

/* Apply padding to header and content */
.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px; /* Add padding here */
    margin-bottom: 0; /* Remove bottom margin */
    border-bottom: 1px solid rgba(0,0,0,0.2); /* Separator based on background */
}
.category-section > div:not(.category-header):not(.category-footer) {
     padding: 5px 15px 10px 15px; /* Padding for content */
}

/* Sentiment Backgrounds for the whole section */
.category-section.bullish { background-color: #344e41; border-color: #588157; } /* Darker Muted Green */
.category-section.bearish { background-color: #582f33; border-color: #a44a51; } /* Darker Muted Red */
.category-section.neutral { background-color: #383838; border-color: #555; }    /* Darker Gray */
.category-section.mixed { background-color: #383838; border-color: #555; }   /* Darker Gray for Mixed */

/* Adjust header text color for contrast */
.category-section.bullish .category-header h4,
.category-section.bearish .category-header h4 {
    color: #f0f0f0;
}
.category-section.mixed .category-header h4 {
     color: #f5f5f5;
}

.category-header h4 {
    margin: 0;
    color: #eee;
}

.category-score {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: bold;
    margin-left: 10px; /* Space from title */
}

/* Score Colors Span */
.score-bullish { background-color: #5cb85c; color: white; } /* Muted Green */
.score-bearish { background-color: #d9534f; color: white; } /* Muted Red */
.score-neutral { background-color: #777777; color: white; }    /* Medium Gray */
.score-mixed { background-color: #777777; color: white; }   /* Medium Gray for Mixed */
.score-n-a, .score-parse-error { background-color: #444; color: #aaa; font-style: italic; }

.key-drivers h5, .extracted-data h5 {
    margin-top: 15px;
    margin-bottom: 8px;
    color: #ccc;
    font-size: 0.95em;
    /* border-bottom: 1px dotted #555; */ /* Remove bottom border */
    /* padding-bottom: 3px; */
}

.key-drivers ul, .extracted-data ul {
    list-style-type: none;
    padding-left: 0;
    margin-top: 5px;
    margin-bottom: 5px;
}

.key-drivers li, .extracted-data li {
    margin-bottom: 10px;
    font-size: 0.95em;
    line-height: 1.4;
    padding-left: 10px;
    border-left: 2px solid #555; /* Indentation effect */
}
.key-drivers li strong { /* Headline */
    color: #eee;
    display: block; /* Headline on its own line */
    margin-bottom: 3px;
    font-weight: normal; /* Make headline text normal weight */
}

.extracted-data {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #555; /* Separator */
}

.mini-chart-container {
    width: 100%;
    max-width: 600px;
    height: 300px; /* Keep increased height */
    margin-top: 10px;
    margin-bottom: 10px;
    background-color: rgba(50, 50, 50, 0.5); /* Slight background */
    border: 1px solid #444;
    border-radius: 3px;
}

.no-data-note {
    font-style: italic;
    color: #888;
    font-size: 0.9em;
    margin-top: 10px;
}

/* --- Category Details Footer/Button --- */
.category-footer {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dotted #555;
    text-align: right;
}

.view-headlines-btn {
    background-color: #555;
    color: #eee;
    border: 1px solid #777;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.view-headlines-btn:hover {
    background-color: #666;
}

/* --- Headlines Popup Modal --- */
/* Styles added directly via JS for simplicity, but could be moved here */
/* Example:
#headlines-popup-overlay { ... }
#headlines-popup-overlay > div { ... }
*/

.summary-points ul {
    list-style-type: none;
    padding-left: 5px; /* Slight indent */
}
.summary-points li {
    border-left: none; /* Remove previous border */
    padding-left: 0;
    margin-bottom: 6px; /* Tighter spacing */
}

.sentiment-icon {
    display: inline-block;
    width: 1.2em; /* Ensure space */
    text-align: center;
    margin-right: 4px;
    font-weight: bold;
}
.sentiment-bullish { color: #5cb85c; } 
.sentiment-bearish { color: #d9534f; } 
.sentiment-neutral { color: #777777; } /* Match neutral score bg */

/* --- Chart Styling --- */
#category-distribution-chart {
    max-width: 90%; /* Limit width */
    margin-left: auto;  /* Center align */
    margin-right: auto; /* Center align */
    margin-bottom: 20px; /* Keep bottom margin */
}

/* Layout for side-by-side positioning charts */
.chart-container-horizontal {
    display: flex; /* Arrange children horizontally */
    flex-wrap: wrap; /* Allow wrapping on smaller screens if needed */
    gap: 20px; /* Add some space between the charts */
    margin-top: 20px; /* Space above the chart container */
    justify-content: space-around; /* Distribute space */
}

.chart-item {
    flex: 1; /* Allow items to grow and shrink */
    min-width: 300px; /* Ensure a minimum width */
    min-height: 250px; /* Ensure charts have some height */
    /* Add border or background for debugging if needed */
    /* border: 1px solid red; */ 
}

/* Styles for News Analysis Tab */
/* ... (keep existing styles) ... */ 

/* --- Chart Area Layout --- */
.chart-area-container {
    position: relative; /* Needed for absolute positioning of children like avatar/indicators */
}

/* --- Avatar Video Player --- */
#avatar-container {
    position: absolute;
    top: 10px;    /* Adjust for some padding from the top */
    right: 10px;   /* Adjust for some padding from the right */
    width: 200px;  /* Slightly smaller to fit better */
    height: auto;
    z-index: 1100; /* Ensure it's above other elements */
}

#avatar-video, #avatar-canvas {
    width: 100%;     /* Make the video fill the container */
    height: auto;
    display: block;  /* Remove any extra space below the video */
}

/* --- NEW: Avatar Video Controls --- */
#avatar-controls {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 5px 10px;
    display: flex;
    gap: 10px;
    z-index: 25; /* Higher than canvas */
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease;
}

#avatar-container:hover #avatar-controls {
    opacity: 1; /* Show on hover */
}

.avatar-control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}
/* --- END NEW --- */

/* --- NEW: Chatbot UI Styles --- */

#chat-fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 60px;
    font-size: 28px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1000;
    transition: background-color 0.3s;
}

#chat-fab:hover {
    background-color: #0056b3;
}

#chat-window {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 370px;
    max-height: 500px;
    background-color: #2c2c2c;
    border: 1px solid #555;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 1000;
    flex-direction: column;
    overflow: hidden;
}

#chat-window.open {
    display: flex;
}

.chat-header {
    background-color: #333;
    color: #eee;
    padding: 10px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #555;
}

.chat-close-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 20px;
    cursor: pointer;
}

.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #242424;
}

.chat-message {
    margin-bottom: 12px;
    max-width: 90%;
    line-height: 1.4;
}

.chat-message.user {
    background-color: #007bff;
    color: white;
    padding: 8px 12px;
    border-radius: 15px 15px 0 15px;
    margin-left: auto; /* Align to the right */
}

.chat-message.bot {
    background-color: #444;
    color: #eee;
    padding: 8px 12px;
    border-radius: 15px 15px 15px 0;
    margin-right: auto; /* Align to the left */
}
.chat-message.bot.thinking {
    font-style: italic;
    color: #999;
}

.chat-input-area {
    display: flex;
    padding: 10px;
    border-top: 1px solid #555;
    background-color: #333;
}

#chat-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #666;
    border-radius: 5px;
    background-color: #555;
    color: #eee;
    outline: none;
}

#chat-send-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 0 15px;
    margin-left: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}
#chat-send-btn:hover {
    background-color: #0056b3;
}
/* --- END Chatbot Styles --- */
/* --- NEW Styles for Collapsible Section --- */
.collapsible-section {
    width: 100%;
    margin-top: 20px;
    border: 1px solid #555;
    border-radius: 5px;
    background-color: #282828;
}

.collapsible-section summary {
    font-size: 1.2em;
    font-weight: bold;
    padding: 15px;
    cursor: pointer;
    outline: none;
    list-style: none; /* For Webkit/Safari */
}

.collapsible-section summary::-webkit-details-marker {
    display: none; /* Hide the default arrow in Chrome/Safari */
}

.collapsible-section[open] > summary {
    border-bottom: 1px solid #555;
}

/* --- NEW styles for color-coded headers --- */
.category-header.bullish {
    background-color: #2a4c3a; /* Dark, muted green */
    color: #c8e6c9; /* Light green text */
}

.category-header.bearish {
    background-color: #5d3a3a; /* Dark, muted red */
    color: #ffcdd2; /* Light red text */
}

.category-header.mixed, .category-header.neutral {
    background-color: #424242; /* Dark grey */
    color: #e0e0e0; /* Light grey text */
}

/* Ensure the h4 inside the colored header has the correct color */
.category-header h4 {
    color: inherit !important; 
}

/* --- NEW Styles for Daily Briefing Popup --- */
.briefing-bar {
    text-align: center;
    margin-bottom: 20px;
}

#briefing-popup-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1.1em;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#briefing-popup-btn:hover {
    background-color: #0056b3;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.popup-modal {
    background-color: #333;
    color: #eee;
    padding: 20px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    border: 1px solid #555;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.popup-header h3 {
    margin: 0;
    color: #fff;
}

.popup-close-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 24px;
    cursor: pointer;
}

.popup-content h4 {
    color: #00aaff;
    margin-top: 15px;
    margin-bottom: 5px;
}

.popup-content p, .popup-content ul {
    margin: 0 0 15px 0;
    line-height: 1.6;
}

.popup-content ul {
    padding-left: 20px;
}
 