/* General Body and Main Container Styling for Dark Mode */
body {
    font-family: sans-serif;
    margin: 20px;
    line-height: 1.6;
    background-color: #1a1a1a; /* Dark background */
    color: #f0f0f0; /* Light text color */
}

header {
    background-color: #333; /* Slightly lighter dark for header */
    color: #fff;
    padding: 15px 0;
    text-align: center;
    margin-bottom: 20px;
}

#logo {
    max-width: 150px; /* Adjust logo size */
    height: auto;
    display: block;
    margin: 0 auto 10px; /* Center logo and add space below */
}

img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -ms-user-drag: none;
}

a {
    color: #62b8ff; /* Lighter blue for links */
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
    color: #3e88c5; /* Slightly darker blue on hover */
}
a:visited {
    color: #168400; /* Lighter blue for visited links */
}
a:active {
    color: #896a03; /* Darker blue for active links */
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #2b2b2b; /* Darker main content background */
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); /* Darker shadow for contrast */
}

/* --- Buttons (Global and Specific) --- */
button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 20px;
    background-color: #007bff; /* Stays blue for primary action */
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #0056b3; /* Darker blue on hover */
}

/* --- Reminder List Styling --- */
#reminder-list h2 {
    margin-top: 0;
    border-bottom: 2px solid #555; /* Lighter border for contrast */
    padding-bottom: 10px;
    margin-bottom: 15px;
}

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

/* Ensure padding is consistent despite border-left */
#reminders li {
    border: 1px solid #444; /* Darker border */
    border-radius: 5px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    color: #e0e0e0; /* Lighter text for list items */
    padding-left: 10px;
    padding-right: 10px;
    background-color: 3a3a3a; /* Darker background for list items */
    transition: background-color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease; /* Smooth transition for hover effects */
}

/* --- Reminder Highlight Colors --- */
.past-reminder {
    background-color: #5f1010; /* Muted deep red background */
    border-left: 5px solid #9e3d3d; /* Complementary darker red border */
    color: #e0e0e0; /* Ensure text remains light and readable */
    /* Removed opacity: 0.7; to make it fully colored */
}

.upcoming-reminder {
    background-color: #573706; /* Muted warm orange/gold background */
    border-left: 5px solid #b58d3d; /* Complementary darker orange/gold border */
    color: #e0e0e0; /* Ensure text remains light and readable */
}

/* --- Completed Reminder Styling --- */
/* This must come AFTER highlight styles to override them when completed */
.completed-reminder {
    /* text-decoration: line-through;  */
    opacity: 0.8;
    background-color: #333 !important;
    border-left: 5px solid #666 !important;
}

/* Ensure completed items get their own text color */
.completed-reminder .reminder-text {
    color: #ebebeb !important; /* Lighter grey for the struck-through text */
    text-decoration: line-through !important; /* Apply strikethrough to text here */
}

.completed-reminder .reminder-datetime {
    color: #b0b0b0 !important; /* Lighter grey for datetime */
    text-decoration: none !important; /* IMPORTANT: Prevent strikethrough for datetime */
}

/* IMPORTANT: Prevent strikethrough for buttons within a completed reminder */
.completed-reminder .reminder-actions button {
    text-decoration: none !important; /* Ensure buttons are NOT struck through */
    opacity: 1 !important; /* Keep buttons fully opaque to be clearly clickable */
    color: #fff !important; /* Ensure their text color is bright, not dimmed */
}

.reminder-details {
    flex-grow: 1;
    margin-right: 15px;
}

.reminder-text {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.reminder-datetime {
    font-size: 0.9em;
    color: #ebd8d8; /* Slightly darker light text for date/time */
}

/* --- General Button Styling within Reminders (for consistency) --- */
.reminder-actions {
    display: flex;
    gap: 8px; /* Space between buttons */
    align-items: center;
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    margin-top: 5px; /* Add a little space if they wrap */
}

.reminder-actions .action-button { /* Generic class for all action buttons */
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    border: none;
    transition: background-color 0.3s ease;
    min-width: 70px; /* Give buttons a consistent minimum width */
}

.reminder-actions .edit-button {
    background-color: #013b78; /* Blue for edit */
    color: #fff;
}

.reminder-actions .edit-button:hover {
    background-color: #0056b3;
}

.reminder-actions .delete-button {
    background-color: #89000e; /* Red for delete */
    color: #fff;
}

.reminder-actions .delete-button:hover {
    background-color: #c82333;
}

/* --- Completion Button Styling --- */
.reminder-actions .complete-button {
    background-color: #005414; /* Green for "Complete" */
    color: #fff;
}

.reminder-actions .complete-button:hover {
    background-color: #218838;
}

/* --- Undo Complete Pop-up Styling --- */
.undo-complete-popup {
    display: none; /* Controlled by JS, but starts hidden */
    position: fixed;
    bottom: 20px;
    left: 50%; /* Center horizontally */
    transform: translateX(-50%) translateY(20px); /* Start slightly below, centered */
    background-color: #2c2c2c; /* Darker background for this popup */
    color: #e0e0e0;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1001; /* Higher than feedback popup */
    opacity: 0;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out; /* Smooth show/hide */
    white-space: nowrap; /* Prevent text wrapping */
    display: flex; /* Use flexbox for content alignment */
    align-items: center; /* Vertically align text and button */
    gap: 15px; /* Space between text and button */
}

.undo-complete-popup.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0); /* Slide up while centered */
}

.undo-complete-popup p {
    margin: 0; /* Remove default margin */
    font-size: 0.95rem;
}

.undo-complete-popup button {
    padding: 6px 15px;
    margin: 0;
    background-color: #007bff; /* Blue for undo button */
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.undo-complete-popup button:hover {
    background-color: #0056b3;
}

/* Responsive adjustment for small screens */
@media (max-width: 600px) {
    .undo-complete-popup {
        width: calc(100% - 40px); /* Take up more width on small screens */
        left: 20px; /* Position from left */
        transform: translateX(0) translateY(20px); /* No longer needs translateX(-50%) */
    }
    .undo-complete-popup.show {
        transform: translateX(0) translateY(0);
    }
}

.reminder-actions button {
    /* These inherit from the global button style initially for shared properties */
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 8px;
    transition: background-color 0.3s ease;
    width: auto;
    display: inline-block;
}

.reminder-actions .edit-button {
    background-color: #013b78; /* Blue for Edit */
}
.reminder-actions .edit-button:hover {
    background-color: #0056b3;
}

.reminder-actions .delete-button {
    background-color: #89000e; /* Red for Delete */
}

.reminder-actions .delete-button:hover {
    background-color: #c82333;
}

/* --- Footer Styling --- */
footer {
    text-align: center;
    margin-top: 20px;
    padding: 10px 0;
    color: #aaa; /* Lighter gray for footer text */
    font-size: 0.9rem;
}

footer a {
    color: #90caf9; /* Lighter blue for links */
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* --- Modal Styling --- */
/* Target the modal by its ID and class for higher specificity */
#add-reminder-modal.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    transition: opacity 0.3s ease;
    opacity: 0; /* Start hidden for transition */
}

/* This class is added by JavaScript to show the modal.
   Target by ID, then class, then .show for highest specificity. */
#add-reminder-modal.modal.show {
    /* background: #f00; */
    display: flex; /* Use flex to center the content */
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
    opacity: 1; /* Fully visible */
}

/* Ensure your .modal-content is styled correctly as well */
.modal-content {
    background-color: #2c2c2c;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    position: relative; /* For positioning the close button */
    box-sizing: border-box; /* Include padding in width calculation */
    max-height: 90vh; /* Limit height to viewport */
    overflow-y: auto; /* Enable scrolling if content is too long */
}

.modal-content h2 {
    border-bottom: 2px solid #555;
    color: #fff; /* Ensure heading is bright */
}

.close-button {
    color: #ccc; /* Lighter close button */
}

.close-button:hover,
.close-button:focus {
    color: #fff; /* White on hover */
}

/* --- Form Styling within modal for Dark Mode --- */
#reminder-form label {
    color: #e0e0e0; /* Lighter label text */
}

#reminder-form input[type="text"],
#reminder-form input[type="date"],
#reminder-form input[type="time"] {
    background-color: #4a4a4a; /* Darker input background */
    color: #f0f0f0; /* Light input text */
    border: 1px solid #666; /* Lighter border for visibility */
}

/* Style for save button */
#reminder-form button[type="submit"] {
    background-color: #28a745; /* Green color for save */
}

#reminder-form button[type="submit"]:hover {
    background-color: #218838;
}

/* Style for cancel button */
#reminder-form #cancel-reminder {
    background-color: #6c757d; /* Gray color for cancel */
}

#reminder-form #cancel-reminder:hover {
    background-color: #5a6268;
}


/* --- Basic Responsive Design for Dark Mode --- */
@media (max-width: 600px) {
    body {
        margin: 10px;
    }

    main {
        padding: 15px;
        border-radius: 0;
        box-shadow: none;
    }

    button {
        font-size: 0.9rem;
        padding: 8px 12px;
        margin-bottom: 15px;
    }

    #reminders li {
        padding: 10px;
        margin-bottom: 8px;
        flex-direction: column;
        align-items: flex-start;
    }

    .reminder-details {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .reminder-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
    .reminder-actions button {
        margin-left: 5px;
        margin-right: 0;
        padding: 7px 10px;
    }

    .modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 15px;
    }

    #reminder-form input[type="text"],
    #reminder-form input[type="date"],
    #reminder-form input[type="time"] {
        width: calc(100% - 20px);
    }
}

/* ------------------------------- */
/* --- Feedback Pop-up Styling --- */
.feedback-popup {
    display: block; /* Change to block, hide initially with opacity/pointer-events */
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #3b3b3b; /* Dark background */
    color: #e0e0e0; /* Light text */
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    max-width: 300px;
    text-align: center;
    z-index: 1000; /* Ensure it's above other content */
    opacity: 0; /* Start invisible for fade-in effect */
    transform: translateY(20px); /* Start slightly below for slide-up effect */
    transition: opacity 0.3s ease-out, transform 0.3s ease-out; /* Keep these for smooth show/hide */
    pointer-events: none; /* Make it unclickable when hidden */
}

.feedback-popup.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto; /* Make it clickable when visible */
}

.feedback-popup p {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.feedback-popup-actions {
    display: flex;
    justify-content: space-around;
    gap: 10px; /* Space between buttons */
}

.feedback-accept-button {
    flex-grow: 1; /* Make buttons share space */
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: center; /* Ensure text is centered for links */
    text-decoration: none; /* Remove underline for links */
    transition: background-color 0.3s ease;
    margin-bottom: 0; /* Override global button margin */
    background-color: #007bff; /* Blue for suggestion */
    color: #fff;
    border: none;
}

.feedback-button,
.feedback-dismiss-button {
    flex-grow: 1; /* Make buttons share space */
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: center; /* Ensure text is centered for links */
    text-decoration: none; /* Remove underline for links */
    transition: background-color 0.3s ease;
    margin-bottom: 0; /* Override global button margin */
}

.feedback-accept-button:hover {
    background-color: #0056b3;
}
.feedback-accept-button a:link {
    color: #fff; /* Ensure link color is white */
    text-decoration: none; /* Remove underline for links */
}
.feedback-accept-button a:hover {
    color: #fff; /* Ensure link color is white on hover */
    text-decoration: none; /* Add underline on hover for links */
}

.feedback-dismiss-button {
    background-color: #6c757d; /* Gray for dismiss */
    color: #fff;
    border: none;
}

.feedback-dismiss-button:hover {
    background-color: #5a6268;
}

/* Responsive adjustment for very small screens */
@media (max-width: 480px) {
    .feedback-popup {
        right: 10px;
        bottom: 10px;
        max-width: calc(100% - 40px); /* Adjust width to fit */
    }
}

/* --- Tag Input Styling in Form --- */
.form-group input[type="text"]#reminder-tag {
    /* Style consistency with other inputs */
    width: calc(100% - 20px); /* Adjust based on padding */
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #555;
    border-radius: 5px;
    background-color: #2c2c2c;
    color: #e0e0e0;
}

/* --- NEW: Tag Filter Dropdown Styling --- */
.tag-filter-dropdown-container {
    position: relative;
    /* margin-bottom: 10px; */
    padding: 10px;
    background-color: #2a2a2a;
    /* border-radius: 8px; */
    display: flex;
    justify-content: center;
    /* NEW: Add max-width to the container to prevent it from spanning too wide */
    max-width: 135px; /* Adjust this value as needed */
    margin-left: auto; /* Center the container itself */
    margin-right: auto; /* Center the container itself */
}

#tag-filter-toggle {
    background-color: #007bff;
    color: #e0e0e0;
    /* padding: 10px 20px; */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    /* NEW: Constrain the button's width */
    width: 100%; /* Make it fill its constrained container */
    max-width: 250px; /* Ensure it doesn't get ridiculously wide if container is larger */
    box-sizing: border-box; /* Include padding in the width calculation */
    margin-bottom: 0px; /* Remove bottom margin to align with other elements */
    /* NEW: Center the button text */
    text-align: center;
}
#tag-filter-toggle:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

#tag-filter-toggle.active .dropdown-arrow {
    transform: rotate(180deg); /* Rotate arrow when active */
}

.dropdown-arrow {
    transition: transform 0.2s ease;
}

#tag-filter-menu {
    position: absolute;
    top: 100%; /* Position below the toggle button */
    left: 50%;
    transform: translateX(-50%); /* Center horizontally */
    background-color: #333; /* Darker background for menu */
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    min-width: 200px;
    max-height: 250px; /* Limit height for scroll if many tags */
    overflow-y: auto; /* Enable scrolling */
    z-index: 100; /* Ensure it's above other content */
    padding: 10px 0; /* Vertical padding */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Class added by JS to show the menu */
#tag-filter-menu.tag-filter-menu-show {
    opacity: 1;
    visibility: visible;
}

.tag-filter-menu-item {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    cursor: pointer;
    color: #e0e0e0;
    transition: background-color 0.1s ease;
}

.tag-filter-menu-item:hover {
    background-color: #444; /* Highlight on hover */
}

.tag-filter-menu-item input[type="checkbox"] {
    margin-right: 10px;
    /* Basic styling for checkbox (can be customized further if needed) */
    appearance: none; /* Hide default checkbox */
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid #777;
    border-radius: 3px;
    background-color: #555;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.tag-filter-menu-item input[type="checkbox"]:checked {
    background-color: #007bff; /* Checked color */
    border-color: #007bff;
}

/* Checkmark for custom checkbox */
.tag-filter-menu-item input[type="checkbox"]:checked::after {
    content: '✓';
    color: #fff;
    font-size: 14px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.tag-filter-menu-item label {
    flex-grow: 1; /* Allow label to take available space */
    cursor: pointer; /* Ensure clicking label also toggles checkbox */
}

/* Special styling for the "All Tags" option */
.tag-filter-menu-item.all-tags-option {
    font-weight: bold;
    border-bottom: 1px solid #444; /* Separator */
    margin-bottom: 5px;
    padding-bottom: 10px;
}

/* Style for displaying tag on reminder list item */
.reminder-tag {
    font-size: 0.8em; /* Smaller font size */
    background-color: #4a4a4a; /* Slightly darker background */
    color: #bbb;
    padding: 3px 8px;
    border-radius: 10px; /* Pill shape */
    margin-left: 10px; /* Space from date/time or text */
    flex-shrink: 0; /* Prevent tag from shrinking */
}

/* Adjust reminder details to accommodate the tag */
.reminder-details {
    display: flex;
    flex-wrap: wrap; /* Allow details to wrap on smaller screens */
    align-items: center;
    flex-grow: 1;
    margin-right: 15px;
}

/* --- NEW: Search Bar Styling --- */
.search-bar-container {
    margin-bottom: 5px;
    padding: 10px; /* Consistent padding with tag filters */
    background-color: #2a2a2a; /* Consistent background */
    border-radius: 8px; /* Consistent border radius */
}

#search-reminders {
    width: calc(100% - 20px); /* Adjust for padding, similar to form inputs */
    padding: 12px; /* Slightly more padding for prominence */
    border: 1px solid #555;
    border-radius: 5px;
    background-color: #2c2c2c;
    color: #e0e0e0;
    font-size: 1rem;
    box-sizing: border-box; /* Include padding in width */
}

#search-reminders::placeholder {
    color: #aaa;
}

/* --- Tag Filter Section Styling (Refined) --- */
#tag-filters {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #2a2a2a;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* Increased gap for better spacing */
    justify-content: center;
    /* Removed redundant `margin-bottom` if already present on container */
}

.tag-filter-button {
    background-color: #555;
    color: #e0e0e0;
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
    white-space: nowrap; /* Prevent tag names from wrapping */
}

.tag-filter-button:hover {
    background-color: #666;
    transform: translateY(-1px);
}

.tag-filter-button.active {
    background-color: #007bff;
    font-weight: bold;
}