/* General Styling */
body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(to right, #2ecc71, #1abc9c);
    color: #fff;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* Search Section Styling */
.search-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    width: 100%;
}

#searchInput {
    padding: 8px 10px;
    flex: 1;
    margin-right: 10px;
    border: none;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.3s ease;
}

#searchBtn {
    padding: 8px 12px;
    background: linear-gradient(to right, #27ae60, #2ecc71);
    border: 1px solid #27ae60;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Input section and task buttons in a single line */
.input-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
}

#taskInput {
    padding: 8px 10px;
    flex: 1;
    margin-right: 10px;
    border: none;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.3s ease;
}

.buttons-right {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 150px; /* Ensure buttons remain on a single line */
    gap: 10px; /* Space between buttons */
}

.btn {
    padding: 8px 12px;
    font-size: 14px;
    background: linear-gradient(to right, #27ae60, #2ecc71);
    border: 1px solid #27ae60;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.btn:hover::after {
    opacity: 1;
}

.clear-btn {
    margin-top: 20px;
    background: linear-gradient(to right, #e74c3c, #c0392b);
    border: 1px solid #e74c3c;
}

/* Task List Styling */
#taskList {
    list-style: none;
    padding: 0;
    margin: 0;
    height: 700px; /* Fixed height */
    overflow-y: auto; /* Enable vertical scrolling */
    max-height: 700px;
}

.task-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden; /* Ensure task text is managed correctly */
    white-space: nowrap; /* Prevent line breaks */
    text-overflow: ellipsis; /* Handle overflow with ellipsis */
    transition: all 0.3s ease;
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(5px);
}

.task-text {
    flex-grow: 1;
    padding-right: 10px; /* Ensure space for buttons */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis; /* Ellipsis for overflowing text */
}

/* Popup Styling */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.popup-content {
    background: #fff;
    color: #333;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.popup-content input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#passwordInput, #editInput {
    display: inline-block;
    width: calc(100% - 50px);
}

#confirmPasswordBtn, #cancelPasswordBtn, #confirmEditBtn, #cancelEditBtn {
    margin-top: 10px;
}

/* Dark Mode Styling */
@media (prefers-color-scheme: dark) {
    body {
        background: #333;
        color: #fff;
    }

    .container {
        background: rgba(255, 255, 255, 0.1);
    }

    .btn {
        background: linear-gradient(to right, #1e7f43, #16a085);
        border: 1px solid #1e7f43;
    }

    .clear-btn {
        background: linear-gradient(to right, #c0392b, #e74c3c);
        border: 1px solid #c0392b;
    }

    .task-item {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* Mobile-Friendly Enhancements */
@media (max-width: 600px) {
    .container {
        width: 90%;
    }

    .input-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .buttons-right {
        width: 100%;
        justify-content: flex-start;
    }

    .task-item {
        flex-direction: column;
        text-align: left;
    }

    .task-text {
        white-space: normal; /* Allow wrapping on small screens */
    }

    /* Button Sizes */
    .btn {
        padding: 10px 15px;
        font-size: 16px;
    }

    .clear-btn {
        font-size: 16px;
    }
}

/* Basic body styles for light and dark themes */
body {
  transition: background-color 0.3s, color 0.3s, background-image 0.5s ease;
  margin: 0;
  font-family: Arial, sans-serif;
  padding: 20px;
}

/* Light theme (with gradient) */
body.light {
  background: linear-gradient(135deg, #f3f4f9, #e4e9f2); /* Soft light gradient */
  color: #333; /* Dark text for readability */
}

/* Dark theme */
body.dark {
  background-color: #121212; /* Deep dark background */
  color: #ffffff; /* Light text for good contrast */
}

/* Button Styling */
.theme-toggle-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: transparent;
  border: none;
  cursor: pointer;
  font-size: 24px;
  padding: 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s, transform 0.3s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn:hover {
  transform: scale(1.1);
  background-color: rgba(0, 0, 0, 0.1);
}

/* Icon Styling */
.icon {
  display: none;
  font-size: 20px;
  transition: opacity 0.3s;
}

/* Sun and Moon Icons */
#sun-icon {
  color: #ffdd00;
}

#moon-icon {
  color: #f1f1f1;
}

/* Show icons based on the theme */
body.light #sun-icon {
  display: inline;
  opacity: 0;
}

body.dark #moon-icon {
  display: inline;
  opacity: 0;
}

body.dark #sun-icon {
  display: inline;
  opacity: 1;
}

body.light #moon-icon {
  display: inline;
  opacity: 1;
}

/* Smooth transition between icon visibility */
.icon {
  opacity: 0;
  transition: opacity 0.5s ease;
}

body.light .theme-toggle-btn #moon-icon,
body.dark .theme-toggle-btn #sun-icon {
  opacity: 1;
}

footer {
    font-size: 0.8em; /* Adjust the size as needed */
    text-align: center; /* Center the text horizontally */
    margin-top: 20px; /* Space above the footer */
    background-color: #f1f1f1; /* Light gray background */
    padding: 10px 5px; /* Reduced padding: 10px top/bottom, 5px left/right */
    color: #333; /* Dark gray text color */
    border-radius: 10px; /* Rounded corners */
    width: 50%; /* Set width to 50% of the parent container */
    max-height: 17px; /* Set a maximum height for the footer */
    margin-left: auto; /* Center the footer horizontally */
    margin-right: auto; /* Center the footer horizontally */
    display: flex; /* Use flexbox for advanced alignment */
    flex-direction: column; /* Stack items vertically */
    justify-content: center; /* Center items vertically */
    align-items: center; /* Center items horizontally */
    overflow: hidden; /* Hide overflow if content exceeds max height */
    outline: outset;
    transition: background-color 0.3s ease, transform 0.3s ease; /* Animation for background color and scale */
}

footer:hover {
    background-color: #e0e0e0; /* Change background color on hover */
    transform: scale(1.05); /* Slightly scale up the footer on hover */
}

a {
    color: #007BFF; /* Link color */
    text-decoration: none; /* Remove underline */
    transition: color 0.3s ease; /* Animation for link color */
}

a:hover {
    text-decoration: underline; /* Underline on hover */
    color: #0056b3; /* Darker blue on hover */
}

@media (max-width: 600px) {
    footer {
        font-size: 0.6em; /* Slightly smaller on small screens */
        max-height: auto; /* Allow height to adjust on smaller screens */
    }
}
