:root {
    --bg-primary: #121212;
    --bg-secondary: #1E1E1E;
    --bg-tertiary: #2A2A2A;
    --text-primary: #EAEAEA;
    --text-secondary: #B3B3B3;
    --accent-primary: #4CAF50; /* Green for buy/positive */
    --accent-secondary: #F44336; /* Red for sell/negative */
    --accent-neutral: #FFC107; /* Yellow for hold/neutral */
    --border-color: #383838;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
}

.search-container {
    position: relative; /* Added for positioning autocomplete dropdown */
    display: flex;
    gap: 0.5rem;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%; /* Position right below the input */
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background-color: var(--bg-tertiary);
}

.suggestion-item.active { /* For keyboard navigation */
    background-color: var(--bg-tertiary);
}

#ticker-search {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
}

#search-btn {
    background-color: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#search-btn:hover {
    background-color: #45a049;
}

.dashboard {
    padding: 2rem;
}

.placeholder {
    text-align: center;
    padding: 4rem 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-secondary);
}

.placeholder h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
        "main-chart main-chart main-chart recommendation"
        "main-chart main-chart main-chart fundamentals"
        "technicals technicals options news"
        "technicals technicals options news";
    gap: 1.5rem;
}

.card {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    height: 100%;
    max-height: 400px; /* Constrain card height */
    overflow-y: auto; /* Add scroll for overflowing content if any */
}

/* Specific styling for the chart canvas to respect its parent's dimensions */
.item-main-chart canvas {
    height: 100% !important; /* Ensure canvas takes full height of its parent */
    width: 100% !important;  /* Ensure canvas takes full width */
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
}

.ticker {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.item-main-chart { grid-area: main-chart; }
.item-recommendation { grid-area: recommendation; }
.item-fundamentals { grid-area: fundamentals; }
.item-technicals { grid-area: technicals; }
.item-options { grid-area: options; }
.item-news { grid-area: news; }

.recommendation-content .signal {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    padding: 2rem;
    border-radius: 8px;
    color: white;
}
.recommendation-content .buy { background-color: var(--accent-primary); }
.recommendation-content .sell { background-color: var(--accent-secondary); }
.recommendation-content .hold { background-color: var(--accent-neutral); }

.data-list {
    list-style: none;
}
.data-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.data-list li span:first-child {
    color: var(--text-secondary);
}
.data-list li span:last-child {
    font-weight: 600;
}

.news-feed {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}
.news-feed li {
    margin-bottom: 1rem;
}
.news-feed a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}
.news-feed a:hover {
    color: var(--accent-primary);
}
.news-feed .sentiment {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 0.5rem;
}
.news-feed .positive { background-color: var(--accent-primary); }
.news-feed .negative { background-color: var(--accent-secondary); }
.news-feed .neutral { background-color: var(--accent-neutral); }


.footer {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        grid-template-areas:
            "main-chart main-chart"
            "recommendation fundamentals"
            "technicals options"
            "news news";
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
    }
    .grid-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "main-chart"
            "recommendation"
            "fundamentals"
            "technicals"
            "options"
            "news";
    }
}