/* --- General & Mobile-First Styles --- */
html {
    font-size: 16px;
}

body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    font-size: 1rem;
    line-height: 1.5;
}

.empty-state-message {
    text-align: center;
    color: #777;
    padding: 40px 20px;
    font-style: italic;
}

.container {
    width: 95%;
    margin: 10px auto;
    background-color: #fff;
    /* Changed from padding: 15px; */
    /* Now it's: 70px top, 15px right, 15px bottom, 15px left */
    padding: 70px 15px 15px 15px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h1, h2 {
    text-align: center;
    color: #333;
    font-size: 1.5rem;
}

h2 {
    font-size: 1.25rem;
}

/* --- FINAL, ROBUST APP HEADER --- */

.app-header {
    display: flex; /* Still using Flexbox */
    align-items: center; /* Vertically aligns all items */
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 10px; /* Adds a minimum space between all header items */
}

.header-left, .header-center, .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* This is the key change for the right section */
.header-right {
    /* This magic line tells this section to take up all available space
       to its left, effectively pushing it to the far right. */
    margin-left: auto;
}

/* This section prevents the welcome message from overlapping */
.header-center {
    /* This ensures the text doesn't wrap and cause layout issues */
    white-space: nowrap;
    /* This hides any text that overflows its container */
    overflow: hidden;
    /* This adds the "..." if the text is too long for the screen */
    text-overflow: ellipsis;
    
    font-weight: bold;
    color: #555;
}


/* --- (The rest of the styles are mostly the same, but included for completeness) --- */

#app-back-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    /* This prevents the button from shrinking too much */
    flex-shrink: 0; 
}
#app-back-button:hover {
    background-color: #5a6268;
}

.font-controls {
    display: flex; /* Make sure the font buttons are also a flex item */
}

.font-controls button {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}
.font-controls button:hover {
    background-color: #007bff;
    color: white;
}

.logout-link {
    color: #dc3545;
    text-decoration: none;
    font-weight: bold;
    white-space: nowrap; /* Prevents "Logout" from wrapping to two lines */
}
.logout-link:hover {
    text-decoration: underline;
}

/* Body and container padding remain the same */
body {
    padding-top: 60px;
}
.container {
    padding: 15px;
}



/* Style the new universal back button */
#app-back-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
}
#app-back-button:hover {
    background-color: #5a6268;
}

/* Style the font controls within the header */
.font-controls button {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    cursor: pointer;
    line-height: 1;
}
.font-controls button:hover {
    background-color: #007bff;
    color: white;
}

.logout-link {
    color: #dc3545; /* Red for a 'destructive' action like logging out */
    text-decoration: none;
    font-weight: bold;
}
.logout-link:hover {
    text-decoration: underline;
}

/* This is the final fix for the obscured text issue from before */
body {
    padding-top: 60px; /* Pushes the entire body down to make space for the sticky header */
}
.container {
    padding: 15px; /* We can now simplify the container padding again */
}





/* --- Checklist Card Styles --- */
#checklist-selection-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 20px;
}

.checklist-card {
    display: flex;
    align-items: center;
    padding: 20px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
}

.checklist-card .card-icon {
    font-size: 1.5rem;
    color: #007bff;
    width: 40px;
    text-align: center;
}

.checklist-card span {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.checklist-card.utilities-card .card-icon {
    color: #555;
}

.checklist-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #007bff;
}

.checklist-card:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: #f8f9fa;
}

/* --- THIS IS THE SECTION THAT FIXES THE CHECKED ITEM VISUALS --- */

#checklist {
    list-style: none;
    padding: 0;
}

#checklist li {
    padding: 12px;
    padding-left: 35px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    position: relative;
    font-size: 1rem;
}

/* THIS IS THE CRUCIAL MISSING RULE */
#checklist li.checked {
    color: #28a745;
    text-decoration: line-through;
    opacity: 0.7;
}

#checklist li.checked::before {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
}

/* --- OTHER BUTTONS --- */
#back-button, #reset-checklist {
    padding: 12px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    min-height: 44px;
    margin-top: 15px;
}

#back-button {
    background-color: #555;
    color: white;
}
#back-button:hover {
    background-color: #333;
}

#reset-checklist {
    background-color: #dc3545;
    color: white;
    margin-left: 10px;
}
#reset-checklist:hover {
    background-color: #c82333;
}

.utility-button {
    background-color: #28a745; /* Green for a positive action like 'Add' */
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    margin-right: 10px;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
.utility-button:hover {
    background-color: #218838; /* A darker green on hover */
}

/* --- RESPONSIVENESS --- */
@media (min-width: 768px) {
    #checklist-selection-container {
        grid-template-columns: 1fr 1fr;
    }
}