html {
  box-sizing: border-box;
}
*, *::before, *::after {
  box-sizing: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    background-color: #121212; /* Near black background */
    color: #e0e0e0; /* Light grey text for readability */
    line-height: 1.6;
}

.app-header {
    display: flex; /* Enable flexbox for alignment */
    align-items: center; /* Vertically align items in the center */
    background-color: #1f1f1f; /* Darker grey for header */
    /* color: white; h1 will now have its own color, hamburger button has its own */
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3); /* Adjusted shadow for dark theme */
    position: relative; /* For potential absolute positioning of elements if needed later */
}

.app-header h1 {
    color: #4a90e2; /* Match H2 color */
    margin: 0;
    font-size: 1.65rem; /* Slightly adjusted for balance */
    font-weight: 600;
    text-align: center; /* Center the title */
    flex-grow: 1; /* Allow title to take available space */
}

/* Sidebar toggle button is hidden by default (on larger screens) */
.sidebar-toggle-btn {
    display: none;
}

.container {
    display: flex;
    flex-wrap: nowrap; /* Keep sidebar and main content side-by-side above mobile breakpoint */
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1rem;
    gap: 1.5rem;
}

.sidebar {
    flex: 1 1 280px; /* Flex-grow, flex-shrink, flex-basis */
    min-width: 250px;
    background-color: #1e1e1e; /* Dark grey for sidebar */
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    align-self: flex-start; /* Stick to top */
}

.main-content {
    flex: 2 1 600px; /* Takes more space */
    background-color: #1e1e1e; /* Dark grey for main content */
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.sidebar h2, .main-content h2 { /* Changed .sidebar h3 to .sidebar h2 */
    margin-top: 0;
    color: #4a90e2; /* A nice blue for headings */
    margin-bottom: 1rem;
    font-weight: 600;
}
.main-content h2 {
    font-size: 1.5rem;
}
.sidebar h2 { /* Changed .sidebar h3 to .sidebar h2 */
    font-size: 1.25rem;
}


/* Forms */
.form-section div {
    margin-bottom: 1rem;
}

.form-section label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: #cccccc; /* Lighter grey for labels */
    font-size: 0.9rem;
}

.form-section input[type="text"],
.form-section input[type="date"],
.form-section select,
.form-section textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #444444; /* Darker border for inputs */
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 0.95rem;
    background-color: #2c2c2c; /* Dark input background */
    color: #e0e0e0; /* Light text in inputs */
}
.form-section input[type="text"]:focus,
.form-section input[type="date"]:focus,
.form-section select:focus,
.form-section textarea:focus {
    border-color: #4a90e2; /* Blue focus border */
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3); /* Blue focus shadow */
    outline: none;
}
/* Style for date input text color (can be tricky, browser dependent) */


.form-section textarea {
    resize: vertical;
    min-height: 60px;
}

.form-section button[type="submit"], .btn {
    background-color: #007ACC; /* Adjusted blue for >= 4.5:1 text contrast */
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s ease;
}
.form-section button[type="submit"]:hover, .btn:hover {
    background-color: #0062A3; /* Darker shade for hover, maintains good text contrast */
}

/* .btn-delete and .btn-edit now fully inherit their background color and hover state from .btn */
/* No specific background overrides are needed if they are to match the primary .btn style. */
/* .btn-edit still has its icon, .btn-delete has its icon. */

/* Other specific buttons retain their colors if different from the primary blue */
.btn-cancel { background-color: #555555; } /* Grey cancel button */
.btn-cancel:hover { background-color: #444444; }
.btn-clear-search {
    background-color: #95a5a6;
    margin-bottom: 1rem;
}
.btn-clear-search:hover { background-color: #7f8c8d; }


/* Activity List */
.activity-list .activity-item {
    padding: 1rem 0;
    display: grid;
    grid-template-areas: 
        "details actions"
        "description description";
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1rem;
    align-items: start;
}
.activity-details {
    grid-area: details;
    display: flex; /* Arrange type and timestamp horizontally */
    align-items: baseline; /* Align text nicely */
    flex-wrap: wrap; /* Allow wrapping if space is very tight */
}
.activity-description-full {
    grid-area: description;
    color: #bbbbbb; /* Lighter grey for description */
    font-size: 0.95rem;
    margin-top: 0.25rem;
}
.activity-actions { grid-area: actions; text-align: right; white-space: nowrap; }

.activity-timestamp {
    font-size: 0.85rem;
    color: #888888; /* Medium grey for timestamp */
    /* display: block; removed */
    /* margin-bottom: 0.25rem; removed */
}
.activity-type strong {
    font-size: 1rem;
    color: #d0d0d0; /* Light grey for activity type */
}
.activity-separator {
    margin: 0 0.4em; /* Add some space around the hyphen */
    color: #888888; /* Match timestamp color */
}

.activity-actions .btn, .activity-actions form {
    margin-left: 0.5rem;
}
.activity-actions .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}

hr.activity-separator {
    border: 0;
    height: 1px;
    background-color: #333333; /* Darker separator line */
    margin: 0; /* Removed margin for tighter list */
}
hr { /* General hr in sidebar */
    border: 0;
    height: 1px;
    background-color: #333333; /* Darker separator line */
    margin: 1.5rem 0;
}


/* Flash Messages */
.flashes {
    list-style-type: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
}
.flashes li {
    padding: 0.8rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 6px;
    border: 1px solid transparent;
}
/* Dark theme flash messages */
.flashes li.success {
    background-color: #2a4b37; /* Dark green */
    color: #a3d9b1;
    border-color: #385f46;
}
.flashes li.error {
    background-color: #5c2a2f; /* Dark red */
    color: #f1b0b7;
    border-color: #73373e;
}
.flashes li.info {
    background-color: #2a4a5c; /* Dark blue/info */
    color: #a3cce0;
    border-color: #385d73;
}



/* Edit form specific styling */
.edit-form div { margin-bottom: 1rem; }
.edit-form .btn-cancel { margin-left: 0.5rem; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    .sidebar, .main-content {
        flex-basis: auto; /* Reset basis for stacking */
        width: 100%;
    }
    .activity-list .activity-item {
        grid-template-areas: 
            "details"
            "description"
            "actions";
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .activity-actions {
        text-align: left;
        margin-top: 0.5rem;
    }
    .activity-actions .btn, .activity-actions form {
        margin-left: 0;
        margin-right: 0.5rem;
        margin-bottom: 0.5rem; /* Space out buttons if they wrap */
    }

    /* Show and style sidebar toggle button (in header) for small screens */
    .sidebar-toggle-btn {
        display: inline-flex; /* Override to show the button on small screens */
        align-items: center;
        justify-content: center;
        background-color: #333; /* Slightly different from header for visibility */
        color: white;
        border: none;
        padding: 0.5rem; /* Adjust padding as needed */
        margin-right: 1rem; /* Space between button and title */
        font-size: 1rem;
        cursor: pointer;
        border-radius: 4px; /* Optional: slight rounding */
        line-height: 1; /* Ensure icon is centered well */
    }
    .sidebar-toggle-btn:hover, .sidebar-toggle-btn:focus {
        background-color: #444; /* Darker hover for toggle button */
        outline: none;
    }

    /* Initially hide the form sections on small screens */
    .sidebar .sidebar-form-sections {
        display: none;
    }

    /* Class to show the form sections when toggled by JS */
    .sidebar .sidebar-form-sections.is-visible {
        display: block;
    }
}
