/* Logo */
.logo-container {
    position: relative;
    width: 240px;
    height: 90px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-container img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.logo-text {
    display: flex;
    align-items: center;
    font-size: 28px;
    font-weight: bold;
    flex-wrap: nowrap;
    line-height: 1;
}

.logo-text .cris,
.logo-text .plit {
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.logo-text .pay {
    color: var(--text-color);
    margin-left: 4px;
    transition: color 0.3s ease;
}

/* Hide the dark logo by default (light mode) */
.logo-container #darkLogo {
    opacity: 0;
}

/* Header Actions & Buttons */
.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-end;
    flex-grow: 0;
    flex-shrink: 0;
    width: auto;
}

.header-actions button { /* Specific override for buttons in header actions */
    flex-grow: 0;
    min-width: auto;
    margin: 0;
}

.icon-button {
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    border-radius: 6px;
    flex-shrink: 0;
    flex-grow: 0;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.icon-button i {
    color: inherit; /* Inherit color from parent button */
}

.icon-button:active {
    background-color: var(--bg-color); /* Use background color on press */
    color: var(--text-color);
    transform: scale(0.98);
}

/* Inputs and Selects */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

input, select {
    padding: 14px;
    border: 1px solid var(--border-color); /* Use variable */
    border-radius: 6px; /* Less rounded */
    background-color: var(--input-bg); /* Use variable */
    color: var(--text-color); /* Use variable */
    width: 100%;
    font-size: 16px;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease; /* Smooth transition */
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color); /* Use variable */
    box-shadow: 0 0 0 1px rgba(var(--primary-color-rgb), 0.1); /* Use RGB var with fallback */
}

/* General Button Style */
button {
    padding: 14px;
    border: none;
    border-radius: 6px; /* Less rounded */
    background-color: var(--primary-color); /* Use variable */
    color: white;
    cursor: pointer;
    font-weight: 500;
    font-size: 16px;
    width: 100%;
    touch-action: manipulation;
    transition: background-color 0.2s ease, transform 0.1s ease; /* Smooth transition */
}

button:active {
    transform: scale(0.98);
    background-color: var(--hover-color); /* Use variable */
}

/* Specific Button Styles */
.remove-button {
    background-color: var(--error-color); /* Use variable */
    padding: 8px 12px; /* Adjusted padding */
    font-size: 14px;
    width: auto; /* Make button width fit content */
    margin-left: 8px; /* Space to the left of the button */
    border-radius: 4px; /* Slightly more rounded for smaller button */
    flex-shrink: 0; /* Prevent button from shrinking */
    color: white; /* Text color for remove button */
}

.remove-button:active {
    background-color: var(--error-color); /* Keep its original color family */
    filter: brightness(0.9); /* Darken it slightly */
    transform: scale(0.98); /* Ensure transform is applied */
}

.edit-button {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 12px;
    font-size: 14px;
    width: auto;
    margin-left: 8px;
    border-radius: 4px;
    flex-shrink: 0;
    border: none; /* Ensure no border like other buttons */
    cursor: pointer; /* Ensure cursor pointer */
    touch-action: manipulation; /* Ensure responsiveness */
    transition: background-color 0.2s ease, transform 0.1s ease; /* Smooth transition */
}

.edit-button:active {
    background-color: var(--hover-color);
    transform: scale(0.98);
}

.reset-button { /* This is an .icon-button with specific error color */
    background-color: var(--error-color);
    border: none; /* Overrides .icon-button border */
    color: white;
    /* width, height, padding, flex-shrink, flex-grow inherited from .icon-button */
}

.reset-button i {
     color: white; /* Ensure icon is white */
}

.reset-button:active { /* Original style was to use primary hover color */
    background-color: var(--hover-color);
    transform: scale(0.98);
}

.dark-mode-toggle { /* This is an .icon-button with standard theming */
    /* Styles inherited from .icon-button are fine */
    /* Active state inherited from .icon-button:active */
}

/* Group Selector Styles */
.group-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.group-select-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    position: relative;
}

.group-select {
    flex: 1;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
    -webkit-appearance: none;
    appearance: none;
    height: 48px; /* Increased from 40px */
}

.new-group-button {
    width: 48px; 
    height: 48px; 
    min-width: 48px; 
    padding: 0;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.new-group-button i {
    font-size: 14px;
}

.new-group-button:active {
    transform: scale(0.98);
    background-color: var(--hover-color);
}

.group-content {
    display: none;
    flex-direction: column;
    flex: 1;
}

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

.group-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-group-button {
    display: none;
}

.edit-group-button.visible {
    display: flex;
}

/* List Item Styles */
.group-list li,
#expensesList li,
#settlementsList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--secondary-color); /* Use card background */
    padding: 12px 16px; /* Add padding inside the rectangle */
    margin-bottom: 8px; /* Space between items */
    border-radius: 8px; /* Rounded corners */
    box-shadow: var(--shadow); /* Optional shadow */
    border: 1px solid var(--border-color); /* Optional border */
    font-size: 16px;
    line-height: 1.4; /* Keep line height */
    border-bottom: none; /* Ensure no default bottom border */
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease; /* Smooth transition */
}

.group-list li:last-child,
#expensesList li:last-child,
#settlementsList li:last-child {
    margin-bottom: 0; /* No margin for the last item */
}

.info-item {
     /* Style for informational list items (e.g., "Añade personas...") */
    font-style: italic;
    opacity: 0.8;
    text-align: center;
    padding: 12px 16px; /* Match new li padding */
    margin-bottom: 8px; /* Add margin like other list items */
    background-color: transparent; /* Ensure no background */
    border: none; /* Ensure no border */
    box-shadow: none; /* Ensure no shadow */
    border-radius: 0; /* Ensure no border radius */
}

.info-item:last-child {
     margin-bottom: 0; /* No margin for the last info item */
}

/* Button containers within list items */
.group-list li > div,
#expensesList li > div {
    display: flex;
    gap: 8px; /* Space between buttons */
    flex-shrink: 0; /* Prevent button group from shrinking */
}

/* Text spans within list items */
#settlementsList li span, /* This was a general span, ok for settlements */
.group-list li > span, /* Target direct child span for text in group list */
#expensesList li > span { /* Target direct child span for text in expenses list */
    flex-grow: 1; /* Allow the text span to take available space */
    margin-right: 8px; /* Add space if a remove button were present */
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0; /* Allow text to shrink and wrap properly in flex context */
}

/* Settlement Toggle Button */
.settlement-toggle {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.settlement-toggle.completed {
    background-color: var(--primary-color);
    color: white;
}

.settlement-toggle i {
    font-size: 14px;
}

.settlement-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
}

/* Settlement List Item Styles */
#settlementsList li {
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

#settlementsList li.completed {
    opacity: 0.6;
    background-color: rgba(var(--primary-color-rgb), 0.1);
}

#settlementsList li.completed span {
    text-decoration: line-through;
    text-decoration-color: var(--primary-color);
}

/* Summary Box */
.summary-box {
    background-color: var(--secondary-color);
    padding: 16px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    flex-shrink: 0; /* Prevent shrinking */
}

.summary-box p { /* Previously .summary p */
    font-size: 16px;
    margin: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-box span { /* Previously .summary span */
    font-weight: 600;
    color: var(--primary-color); /* Use variable */
}

/* Collapsible styles (generic components, potentially for future use) */
.section-header-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 0;
}

.section-header-toggle h2 { /* This seems too generic, might not be used */
    margin: 0; /* Remove default h2 margin */
}

.toggle-icon {
    transition: transform 0.3s ease; /* Smooth rotation */
    font-size: 1.2em; /* Adjust icon size */
    color: var(--text-color); /* Use text color */
}

.section-header-toggle.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    max-height: 500px; /* Sufficient max-height for initial state */
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease; /* Smooth transition */
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0; /* Collapse state */
    opacity: 0;
}

.collapsible-content.expanded {
    max-height: 1000px; /* Larger max-height for sections that shouldn't collapse */
    overflow: visible; /* Allow content to overflow if needed */
}