.hidden {
    display: none;
}

.positive {
    color: #D90429; /* Red for growth */
}

.negative {
    color: #2b9348; /* Green for decline */
}

html, body {
    height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
}

body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 4%;
    overflow-y: hidden;
}

body.with-results {
    overflow-y: auto;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    text-align: center;
}

#main-content {
    width: 100%;
    max-width: 720px; /* Increased width for the new design */
    margin: 0 auto 40px auto;
}

h1 {
    color: #343a40;
    font-size: 2.8em;
    font-weight: 600;
    margin-bottom: 35px;
}

h2 {
    text-align: center;
    color: #343a40;
    margin-bottom: 25px;
    font-size: 1.8em;
}

.search-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#search-history {
    max-width: 580px; /* Match search bar width more accurately */
    margin: 25px auto 0 auto; /* Center the block */
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

#clear-history-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

#clear-history-btn svg {
    width: 20px;
    height: 20px;
    color: #adb5bd; /* Sync with input clear icon color */
    transition: color 0.2s;
}

#clear-history-btn:hover svg {
    color: #495057; /* Sync with input clear icon hover color */
}

#history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.history-tag {
    background-color: #f0f2f5;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.history-tag:hover {
    background-color: #e9ecef;
}

#stock-input {
    width: 420px;
    padding: 14px 40px 14px 24px; /* Make space on the right for the icon */
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 16px;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#stock-input:focus {
    box-shadow: none;
    outline: 1px solid #80bdff; /* Use outline for a sharp border without layout shift */
    border-color: #80bdff;
}

#input-clear-icon {
    position: absolute;
    right: 15px;
    font-size: 24px;
    color: #adb5bd;
    cursor: pointer;
    transition: color 0.2s;
}

#input-clear-icon:hover {
    color: #495057;
}

#search-btn {
    padding: 14px 24px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    background-color: #007bff;
    border: 1px solid #007bff;
    color: white;
}

#search-btn:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}


#empty-state,
#no-results-state {
    text-align: center;
    padding: 90px 20px 30px;
    color: #6c757d;
}

#empty-state img,
#no-results-state img {
    max-width: 360px;
    width: 90%;
    height: auto;
    margin-bottom: 8px;
}

#empty-state p {
    margin: 0; /* Explicitly set top margin and reset others */
}

#content-container {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#content-container.hidden {
    display: none;
}

#stock-title {
    width: 100%;
    text-align: center;
}

.table-container {
    overflow-x: auto;
    margin-top: 15px;
}

#table-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

.financial-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 0 auto;
}

.financial-table th, .financial-table td {
    border: 1px solid #dee2e6;
    padding: 12px 14px;
    text-align: center;
    white-space: nowrap;
}

.financial-table td {
    font-weight: 600;
}

.financial-table thead th {
    background-color: #007bff;
    color: white;
    font-weight: 600;
}

.financial-table thead th:first-child {
    width: 100px;
}

.chart-section-header {
    width: 100%;
    text-align: left;
    margin-top: 40px; /* Add space above the header */
    margin-bottom: 15px;
}

.chart-section-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

#chart-controls {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.chart-toggle-btn {
    padding: 8px 20px;
    font-size: 14px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
    font-weight: 500;
}

.chart-toggle-btn.active {
    background-color: #007BFF;
    color: white;
    border-color: #007BFF;
    font-weight: 600;
}

.chart-toggle-btn:hover:not(.active) {
    border-color: #ccc;
}

.financial-table tbody th {
    background-color: #f7f9fa;
    font-weight: 600;
    text-align: center;
    width: 100px;
}

#chart-container {
    width: 100%;
    height: 450px;
    margin: 20px 0 0;
}

#analysis-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#analysis-section.hidden {
    display: none;
}

.error {
    color: #333; /* Standard text color */
    text-align: center;
    margin-bottom: 15px;
    display: none;
}
