/* FONT IMPORT */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@700&family=Montserrat:wght@400;500;600&display=swap');

/* THEME & VARIABLES */
:root {
    --primary-green: #556b2f;
    --dark-green: #2e4034;
    --background-light: #f4f4f0;
    --text-dark: #333;
    --text-muted-dark: #666;
    --border-color-light: #ddd;
    --module-bg-light: #fff;
    --hover-bg-light: #f9f9f9;
}

/* PAGE HEADER */
.lifelist-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--module-bg-light);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.lifelist-header h1 {
    font-family: 'Merriweather', serif;
    margin: 0 0 0.5rem 0;
}

.lifelist-header p {
    color: var(--text-muted-dark);
    max-width: 700px;
    margin: 0 auto 1.5rem auto;
}

.stats-and-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.lifelist-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted-dark);
}

.stat-item strong {
    color: var(--text-dark);
    font-weight: 600;
}

.lifelist-controls {
    display: flex;
    gap: 0.5rem;
    flex-grow: 1;
    justify-content: flex-end;
}

.lifelist-controls input[type="search"] {
    width: auto;
    flex-grow: 1;
    max-width: 300px;
    margin-bottom: 0;
}

.lifelist-controls button {
    background-color: #e9ecef;
    color: var(--text-dark);
    border: 1px solid #ced4da;
}

.lifelist-controls button:hover {
    background-color: #dee2e6;
}

/* LIFELIST CONTAINER AND ITEMS */
.lifelist-container {
    background-color: var(--module-bg-light);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.lifelist-container ul {
    list-style: none;
    padding-left: 20px;
    margin: 0;
    transition: max-height 0.3s ease-in-out;
    overflow: hidden;
}

.lifelist-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color-light);
}

.lifelist-item:last-child {
    border-bottom: none;
}

.item-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.item-header:hover {
    background-color: var(--hover-bg-light);
}

.toggle-icon {
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 10px;
    width: 15px;
    text-align: center;
    transition: transform 0.2s;
}

.toggle-icon::before {
    content: '\f0da'; /* fa-caret-right */
}

.toggle-icon.expanded::before {
    content: '\f0d7'; /* fa-caret-down */
}

.toggle-icon.leaf-node {
    opacity: 0.3;
}
.toggle-icon.leaf-node::before {
    content: '\f111'; /* fa-circle */
    font-size: 0.5em;
    vertical-align: middle;
}


.item-name {
    flex-grow: 1;
}

.item-name a {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 500;
}

.item-name a:hover {
    text-decoration: underline;
}

.item-name .scientific-name {
    font-style: italic;
    color: var(--text-muted-dark);
    margin-left: 8px;
    font-size: 0.9em;
}

.item-rank {
    font-size: 0.8rem;
    color: #fff;
    padding: 3px 8px;
    border-radius: 10px;
    background-color: #6c757d;
    margin-left: 10px;
}

/* Rank-specific colors */
.rank-Kingdom { background-color: #6f42c1; }
.rank-Phylum { background-color: #d63384; }
.rank-Class { background-color: #fd7e14; }
.rank-Order { background-color: #ffc107; color: #000; }
.rank-Family { background-color: #198754; }
.rank-Genus { background-color: #0dcaf0; color: #000; }
.rank-Species { background-color: #0d6efd; }
.rank-Subspecies { background-color: #343a40; }


.lifelist-item ul {
    max-height: 0;
}

.lifelist-item.expanded > ul {
    max-height: 10000px; /* A large number to allow for expansion */
}

/* Search Highlighting */
.lifelist-item.hidden-by-search {
    display: none;
}

.highlight {
    background-color: #fff3cd;
    color: #856404;
    padding: 2px;
    border-radius: 3px;
}

/* LOADING INDICATOR */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted-dark);
}
.loading-indicator .fa-spinner {
    font-size: 2rem;
    margin-bottom: 1rem;
}