* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
}

body.dark {
    background-color: #1a1a1a;
    color: #ffffff;
}

.container {
    width: 100%;
    max-width: 600px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

body.dark .container {
    background: #2d2d2d;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    color: #1a73e8;
}

body.dark h1 {
    color: #4a90e2;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    padding: 5px;
    position: absolute;
    top: 10px;
    right: 10px;
}

.todo-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#todo-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

body.dark #todo-input {
    background-color: #3d3d3d;
    border-color: #555;
    color: #fff;
}

button {
    padding: 10px 20px;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #1557b0;
}

body.dark button {
    background-color: #4a90e2;
}

body.dark button:hover {
    background-color: #357abd;
}

.todo-list {
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #f8f9fa;
    margin-bottom: 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
    transform: translateX(0);
}

body.dark .todo-item {
    background-color: #3d3d3d;
}

.todo-item.completed {
    background-color: #e8f5e9;
    opacity: 0.7;
    order: 1;
    animation: slideToBottom 0.3s ease;
}

body.dark .todo-item.completed {
    background-color: #2a4d2e;
}

.todo-item:not(.completed) {
    order: 0;
}

.todo-item .todo-text {
    flex: 1;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: #666;
    opacity: 0.6;
}

body.dark .todo-item.completed .todo-text {
    color: #999;
}

.todo-actions {
    display: flex;
    gap: 5px;
}

.todo-actions button {
    padding: 5px 10px;
    font-size: 14px;
}

@keyframes slideToBottom {
    0% { transform: translateY(0); }
    50% { transform: translateY(10px); }
    100% { transform: translateY(0); }
}

.ad-container {
    margin-top: 50px; /* Space from the todo list */
    padding: 20px;
    text-align: center;
    position: relative;
    bottom: 0;
    width: 100%;
    min-height: 100px; /* Ensures space for ad to load */
}

/* Ensure ad stays below content */
body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    flex: 0 0 auto;
}