.research-controls {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.research-controls label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--text-secondary);
}

.research-controls select {
    width: 100%;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* static/research.css */

/* Custom Dropdown for Lists */
.list-selector-container {
    position: relative;
    margin-bottom: 1rem;
}

.list-display {
    background-color: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s;
}

.list-display:hover {
    border-color: var(--primary-hover-color);
}

.list-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--background-primary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.list-item-name {
    flex-grow: 1;
}

.edit-list-icon {
    visibility: hidden;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-left: 1rem;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background-color: var(--background-tertiary-hover);
}
.list-item:hover .edit-list-icon {
    visibility: visible;
}

.dropdown-divider {
    height: 1px;
    margin: 4px 0;
    background-color: var(--border-color);
}

/* New styles for the simple ticker list in the sidebar */
.simple-ticker-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.simple-ticker-item {
    padding: 0.4rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.simple-ticker-item:hover {
    background-color: var(--bg-hover);
}

.simple-ticker-item.active {
    background-color: var(--primary-color);
    color: white;
}
/* Style for active row in the ticker summary table */
.ticker-summary-table tr.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

/* --- Ticker Summary Table --- */
.ticker-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.875rem; /* Slightly smaller font for density */
}

.ticker-summary-table th,
.ticker-summary-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap; /* Prevent columns from wrapping */
}

.ticker-summary-table thead th {
    background-color: var(--background-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-top: 1px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    white-space: normal; /* Allow headers to wrap if needed */
}

.ticker-summary-table tbody tr:hover {
    background-color: var(--background-tertiary-hover);
}

/* Column-specific alignments and widths */
.ticker-summary-table th:nth-child(2), .ticker-summary-table td:nth-child(2), /* Price */
.ticker-summary-table th:nth-child(3), .ticker-summary-table td:nth-child(3), /* Trending */
.ticker-summary-table th:nth-child(6), .ticker-summary-table td:nth-child(6) { /* RSI */
    text-align: right;
}

.ticker-summary-table th:last-child, .ticker-summary-table td:last-child { /* Analyst Ratings */
    width: 150px; /* Give the rating bar some space */
}

.trending-cell {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.weekly-arrow {
    font-size: 1.1em;
}

/* Analyst Rating Bar Styles */
.analyst-rating-cell {
    vertical-align: middle;
}

.rating-bar {
    display: flex;
    height: 18px;
    width: 100%;
    max-width: 120px; /* Constrain width */
    border-radius: 4px;
    overflow: hidden;
    background-color: var(--border-color);
}

.buy-bar { background-color: #28a745; }
.hold-bar { background-color: #ffc107; }
.sell-bar { background-color: var(--danger-color); }

#research-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* Reduce padding for the research page content area */
.main-content {
    padding-top: 1rem;
}

.ticker-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.ticker-link:hover {
    text-decoration: underline;
}

.research-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.research-header h3 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.research-search-container {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.ticker-search-form {
    display: flex;
    gap: 0.5rem;
}

.ticker-search-form input {
    width: 85px; /* Reduced width to fit within sidebar padding */
    font-size: 1.1rem;
}

.ticker-search-form button {
    /* Shrink button to fit in sidebar */
    width: 65px;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.btn-icon {
    background-color: var(--background-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-icon:hover {
    background-color: var(--background-tertiary-hover);
    border-color: var(--primary-color);
}

.charts-container {
    display: flex;
    flex-direction: column;
    height: 550px; /* Total height for both charts, reduced to bring fundamentals up */
    gap: 1rem;
}

.chart-wrapper {
    position: relative; /* Required for chart.js responsiveness */
}

.price-chart-wrapper {
    flex: 7; /* ~70% of the height */
    min-height: 0; /* Prevents flexbox overflow issues */
}

.rsi-chart-wrapper {
    flex: 3; /* ~30% of the height */
    min-height: 0; /* Prevents flexbox overflow issues */
}

.chart-time-range-selector {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

.time-range-option {
    cursor: pointer;
    font-weight: 500;
    padding: 2px 4px;
    transition: color 0.2s;
}

.time-range-option:hover {
    color: var(--text-primary);
}

.time-range-option.active {
    color: var(--primary-color);
    font-weight: 700;
}

/* --- Fundamentals Section --- */
.fundamentals-container {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.fundamentals-container h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.fundamentals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.fundamental-item {
    background-color: var(--background-secondary);
    padding: 0.75rem;
    border-radius: var(--border-radius);
}

.fundamental-item .label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: block;
}

.fundamental-item .value {
    font-size: 1.25rem;
    font-weight: 600;
}

.fundamental-item.text-value-item .value {
    font-size: 1.1rem;
    font-weight: 500;
}

.fundamental-item.cash-flow-item {
    grid-column: 1 / -1; /* Span all columns */
}

.cash-flow-years-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.cash-flow-year {
    text-align: center;
}

.cash-flow-year .year-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.cash-flow-year .year-value {
    font-size: 1.1rem;
    font-weight: 600;
}

/* --- Value Formatting --- */
.green-text {
    color: #28a745;
}

.red-text {
    color: var(--danger-color);
}
