/* --- Settings Page Layout --- */
.settings-layout {
    display: grid;
    grid-template-columns: 260px 1fr; /* Sidebar and content */
    overflow: hidden;
    height: 100%; /* Fill the parent grid cell from style.css */
}

.settings-sidebar {
    background-color: var(--background-primary);
    padding: 2rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.settings-sidebar h2 {
    font-size: 1.5rem;
    margin-top: 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.settings-sidebar li a {
    display: block;
    padding: 0.85rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    margin-bottom: 0.5rem;
}

.settings-sidebar li a:hover {
    background-color: var(--background-secondary);
    color: var(--text-primary);
}

.settings-sidebar li a.active {
    background-color: var(--primary-color);
    color: var(--background-primary);
}

.settings-content {
    padding: 2rem 3rem;
    overflow-y: auto;
}

.settings-section h3 {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border-color);
}

.integration-group {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.integration-group:last-of-type {
    border-bottom: none;
}
.integration-group h4 {
    font-size: 1.2rem;
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
}
.integration-group p {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
}
.integration-group .setting-item {
    padding-left: 0;
    padding-right: 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
}

.settings-section > .setting-item:first-of-type {
    border-top: none;
}

/* Remove border from setting-item inside an integration-group as it has its own structure */
.integration-group > .setting-item {
    border-top: none;
}

.setting-item label {
    font-size: 1rem;
    font-weight: 500;
}

.settings-section.hidden {
    display: none;
}

/* --- Password Modal Form --- */
#change-password-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#change-password-form .form-group {
    display: flex;
    flex-direction: column;
}

#change-password-form label {
    margin-bottom: 0.25rem;
    font-weight: 500;
}

#password-message {
    min-height: 1.2em;
    text-align: center;
    font-weight: 500;
}

.message.success { color: #28a745; }
.message.error { color: var(--danger-color); }

/* --- Integration Form Specifics --- */
#robinhood-form {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#robinhood-form .form-group {
    display: flex;
    flex-direction: column;
}

#robinhood-form label {
    margin-bottom: 0.25rem;
    font-weight: 500;
}

/* --- Report Specific Styles --- */
.report-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center; /* Center chart horizontally */
}
.report-controls {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes items to opposite ends */
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.5rem;
    background-color: var(--background-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.report-controls-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.report-controls-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.report-control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Space between label and select */
}

.report-controls .summary-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Right-aligns the content of the summary item */
}

.report-controls .summary-label {
    font-size: 0.8rem;
}

.chart-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.75rem;
    margin-top: 0.5rem;
}

.chart-legend-toggles {
    display: inline-flex;
    background-color: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 3px;
    gap: 4px;
}

.chart-legend-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: #8a99ad;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.chart-legend-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.chart-legend-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, #1cc88a 0%, #36b9cc 100%);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.legend-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
}

.chart-container {
    position: relative;
    width: 100%;
    max-width: 950px; /* Adjusted for better proportions */
    height: 450px; /* Set a fixed height for the canvas */
}

.message.info {
    color: #007bff; /* Blue for info messages */
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.report-table th, .report-table td {
    padding: 0.4rem 1rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.report-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);
}

.report-table tbody tr:hover {
    background-color: var(--background-secondary);
}

/* Right-align all numeric columns for better readability */
.report-table td:not(:first-child) {
    text-align: right;
}

/* Styles for the nested weekly income details table */
.detail-table {
    width: 98%; /* Slightly inset for visual separation */
    margin: 0.5rem auto;
    border-collapse: collapse;
}
.detail-table th, .detail-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.8rem;
}
.detail-table td:last-child, .detail-table th:last-child {
    text-align: right;
}
