body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background-color: #f9f9f9;
    color: #333;
}

#password-protection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #007BFF, #0056b3);
    color: white;
    font-family: 'Roboto', sans-serif;
    text-align: center;
}

#password-protection h1 {
    font-size: 3rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#password-protection input {
    padding: 15px;
    font-size: 1.2rem;
    border: none;
    border-radius: 10px;
    margin-bottom: 20px;
    width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#password-protection button {
    padding: 15px 30px;
    font-size: 1.2rem;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#password-protection button:hover {
    background-color: #218838;
    transform: scale(1.05);
}

#diary-app {
    padding: 20px;
}

header {
    background-color: #545659;
    color: white;
    padding: 10px 20px;
}

.header-row {
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
}

h1 {
    margin-right: auto;
}

.nav-search-group {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
    left: -340px; /* Adjust group position for better overall balance */
}

.search-container {
    margin-left: 32px;
    display: flex;
    align-items: center;
}

#search-bar {
    height: 44px;
    font-size: 1.1rem;
    padding: 0 18px;
    border-radius: 8px 0 0 8px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    outline: none;
    width: 240px;
    background: #fff;
    transition: box-shadow 0.2s;
}

#search-bar:focus {
    box-shadow: 0 4px 16px rgba(0,123,255,0.18);
    border-color: #007BFF;
}

#search-bar::placeholder {
    color: #888;
    font-size: 1.1rem;
    opacity: 1;
}

#search-button {
    height: 44px;
    border-radius: 0 8px 8px 0;
    margin-left: 0;
    font-size: 1.1rem;
    padding: 0 22px;
}

.date-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

#reminder-badge {
    margin: 0 10px !important;
    display: inline-block !important;
}

#logout-button {
    margin: 0;
}

main {
    min-height: calc(100vh - 80px); /* Account for header height */
    position: relative;
}

.content {
    display: flex;
    gap: 30px;
    margin: 20px;
    align-items: flex-start;
    min-height: calc(100vh - 140px); /* Adjusted to account for header and margins */
    position: relative;
}

.sections {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0; /* Allow shrinking if needed */
}

aside#saved-tasks-window {
    flex: 1;
    min-width: 280px;
    max-width: 320px;
    background-color: #f4f4f4;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 20px;
    height: calc(100vh - 120px);
    overflow-y: auto;
}

/* Custom scrollbar styling for saved tasks panel */
#saved-tasks-window::-webkit-scrollbar {
    width: 8px;
}

#saved-tasks-window::-webkit-scrollbar-track {
    background: #f4f4f4;
    border-radius: 4px;
}

#saved-tasks-window::-webkit-scrollbar-thumb {
    background: #007BFF;
    border-radius: 4px;
}

#saved-tasks-window::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

aside#saved-tasks-window h3 {
    text-align: center;
    margin-bottom: 10px;
}

aside#saved-tasks-window ul {
    list-style-type: none;
    padding: 0;
}

aside#saved-tasks-window ul li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 5px 0;
    padding: 10px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

aside#saved-tasks-window ul li:hover {
    background-color: #e0e0e0;
}

aside#saved-tasks-window ul li .task-actions {
    display: flex;
    gap: 5px;
}

aside#saved-tasks-window ul li .task-actions button {
    padding: 5px 10px;
    font-size: 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

aside#saved-tasks-window ul li .task-actions button.edit {
    background-color: #ffc107;
    color: #fff;
}

aside#saved-tasks-window ul li .task-actions button.complete {
    background-color: #28a745;
    color: #fff;
}

aside#saved-tasks-window ul li .task-actions button.pending {
    background-color: #17a2b8;
    color: #fff;
}

aside#saved-tasks-window ul li .task-actions button.reminder {
    background-color: #007bff;
    color: #fff;
}

aside#saved-tasks-window ul li.section-header {
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    background: #e3e6f3;
    color: #2a2a2a;
    border-left: 4px solid #007BFF;
    letter-spacing: 1px;
    margin: 12px 0 6px 0;
    padding: 8px 10px;
    border-radius: 4px;
    display: block;
}

section {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    height: fit-content;
    min-height: 200px; /* Ensure minimum height for each section */
}

.sections > section:last-child {
    margin-bottom: 0; /* Remove margin from last section */
}

textarea {
    width: 100%;
    height: 80px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    resize: none;
    font-family: 'Roboto', sans-serif;
}

button {
    padding: 10px 15px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
}

button:hover {
    background-color: #0056b3;
}

ul {
    list-style-type: none;
    padding: 0;
}

ul li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 5px 0;
    padding: 10px;
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

ul li:hover {
    background-color: #e0e0e0;
}

ul li .task-actions {
    display: flex;
    gap: 5px;
}

ul li .task-actions button {
    padding: 5px 10px;
    font-size: 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

ul li .task-actions button.edit {
    background-color: #ffc107;
    color: #fff;
}

ul li .task-actions button.complete {
    background-color: #28a745;
    color: #fff;
}

ul li .task-actions button.pending {
    background-color: #17a2b8;
    color: #fff;
}

ul li .task-actions button.reminder {
    background-color: #007bff;
    color: #fff;
}

ul li .task-actions button.pin {
    background-color: #ffeb3b;
    color: black;
}

ul li.pinned {
    background-color: #ffeb3b;
    font-weight: bold;
}

textarea, input, button {
    font-family: 'Roboto', sans-serif;
}

.reminder-badge {
    display: inline-block !important;
    background-color: #ff4444 !important;
    color: white !important;
    font-size: 0.9rem !important;
    font-weight: bold !important;
    border-radius: 50% !important;
    width: 25px !important;
    height: 25px !important;
    text-align: center !important;
    line-height: 25px !important;
    margin-left: 10px !important;
    cursor: pointer !important;
    border: 2px solid #fff !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    vertical-align: middle !important;
}

.notification-container {
    position: relative;
    display: inline-block;
}

.reminder-popup {
    position: absolute;
    top: 35px; /* just below the badge */
    right: 0;
    left: auto;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px;
    width: 300px;
    z-index: 1000;
    color: #222 !important;
}

.popup-arrow {
    position: absolute;
    top: -10px;
    right: 18px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #fff;
    filter: drop-shadow(0 -1px 1px #ddd);
}

.reminder-popup h3 {
    margin: 0 0 10px;
    font-size: 1.2rem;
    text-align: center;
    color: #222 !important;
}

.reminder-popup ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.reminder-popup ul li {
    padding: 5px 10px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #222 !important;
}

.reminder-popup ul li:last-child {
    border-bottom: none;
}

.reminder-popup ul li button {
    background-color: #007BFF;
    color: #fff !important;
    border: none;
    border-radius: 3px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.8rem;
}

reminder-popup ul li button:hover {
    background-color: #0056b3;
}

@media (max-width: 800px) {
    .content {
        flex-direction: column;
        gap: 0;
        margin: 8px;
    }
    .sections {
        width: 100%;
        gap: 12px;
    }
    aside#saved-tasks-window {
        position: static;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin-top: 16px;
        height: auto;
        box-shadow: none;
    }
    section {
        min-height: 120px;
        padding: 12px;
    }
    .header-row {
        flex-direction: column;
        gap: 8px;
        padding: 0 4px;
    }
    .nav-search-group {
        left: 0;
        flex-direction: column;
        gap: 8px;
    }
    .search-container {
        margin-left: 0;
        width: 100%;
    }
    #search-bar {
        width: 100%;
        min-width: 0;
    }
    button, input, textarea {
        font-size: 1rem;
    }
}

@media (max-width: 500px) {
    h1, h2, h3 {
        font-size: 1.1rem;
    }
    .header-row {
        padding: 0 2px;
    }
    section {
        padding: 8px;
    }
    button {
        padding: 8px 10px;
    }
}