/* Content Sections */
.content-section {
    display: none; /* Start hidden */
    height: calc(100% - 16px); /* Adjust for padding */
    padding: 16px 16px 8px 16px; /* Reduce bottom padding */
    overflow: hidden;
    flex-direction: column;
    position: absolute; /* Add absolute positioning */
    width: calc(100% - 32px); /* Account for padding */
    top: 0;
    left: 0;
    opacity: 0; /* Start with 0 opacity */
    transition: opacity 0.3s ease; /* Smooth transition */
    pointer-events: none; /* Prevent interaction when hidden */
}

.content-section.active {
    display: flex;
    opacity: 1;
    pointer-events: auto; /* Enable interaction when active */
}

/* Scrollable Content Area within Sections */
.scrollable-content {
    overflow-y: auto;
    flex: 1; /* Allow list to grow/shrink in flex container */
    -webkit-overflow-scrolling: touch;
    padding: 4px 4px 8px 0px; /* Top, Right, Bottom, Left padding */
    margin-bottom: 8px; /* Add margin to prevent content from touching tab bar */
    min-height: 0; /* Allow flex item to shrink below content size */
}

.scrollable-content::-webkit-scrollbar {
    width: 8px;
}

.scrollable-content::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.scrollable-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.scrollable-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Summary Section Specific Layout */
.summary-content {
    display: flex;
    flex-direction: column;
    flex: 1; /* Make summary-content take up the remaining space */
    gap: 16px;
    overflow: hidden; /* Ensure it contains the scrollable lists properly */
    min-height: 0; /* Allow flex container to shrink */
}

.settlements-container {
    display: flex;
    flex-direction: column;
    flex: 1; /* Allow this container to grow */
    min-height: 0; /* Important for nested flex children that scroll */
}

#settlementsList {
    flex: 1; /* Allow list to grow */
    overflow-y: auto; /* Enable vertical scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    padding-right: 4px; /* Space for scrollbar */
}

/* Section Specific Typography */
/* Styles for list titles */
#section-group h4,
#section-expenses h4,
#section-summary h4 {
     margin: 0 0 8px 0; /* Add bottom margin */
     color: var(--text-color);
     font-size: 16px; /* Slightly smaller than h3 */
     font-weight: 600;
}

/* Group content specific styles */
.group-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden; /* Add this to contain the scrollable content */
}

.group-content.active {
    display: flex;
}

/* Group list container needs to be scrollable */
.group-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 4px 8px 0px;
    margin-bottom: 8px;
}

/* Specific List container styles */
#expensesList, #settlementsList {
    margin-bottom: 0;
    padding-bottom: 8px; /* Keep padding at the bottom of the list */
    padding-left: 0; /* Ensure no left padding */
    padding-right: 4px; /* Keep right padding for scrollbar */
    border: none;
    padding-top: 4px;
}

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

.settlements-header h4 {
    margin: 0;
}

.filter-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
}