* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    contain: layout style;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
    background: linear-gradient(135deg, #1d3557 0%, #457b9d 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-display: swap;
}

.todo-container {
    background: rgba(29, 53, 87, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(168, 218, 220, 0.2);
    contain: layout style;
}

.todo-header {
    text-align: center;
    margin-bottom: 32px;
}

.todo-title {
    color: #f1faee;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
}

.input-section {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.todo-input {
    flex: 1;
    background: rgba(29, 53, 87, 0.8);
    border: 1px solid rgba(168, 218, 220, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: #f1faee;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    will-change: transform, background-color, border-color;
    min-width: 200px;
}

.todo-input::placeholder {
    color: #a8dadc;
}

.todo-input:focus {
    border-color: #e63946;
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
    will-change: auto;
}

.date-input {
    background: rgba(29, 53, 87, 0.8);
    border: 1px solid rgba(168, 218, 220, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: #f1faee;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    will-change: transform, background-color, border-color;
    min-width: 150px;
}

.date-input:focus {
    border-color: #e63946;
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
    will-change: auto;
}

.date-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.add-btn {
    background: #e63946;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f1faee;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    will-change: transform, background-color, border-color;
}

.add-btn:hover {
    background: #d62d20;
    transform: translateY(-1px);
}

.filter-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-label {
    color: #a8dadc;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 1px solid rgba(168, 218, 220, 0.3);
    border-radius: 6px;
    padding: 4px 8px;
    color: #a8dadc;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    will-change: transform, background-color, border-color;
}

.filter-btn:hover {
    border-color: #457b9d;
    color: #457b9d;
}

.filter-btn.active {
    background: #457b9d;
    border-color: #457b9d;
    color: #f1faee;
}

.delete-all-btn {
    background: transparent;
    border: 1px solid rgba(230, 57, 70, 0.5);
    border-radius: 6px;
    padding: 6px 12px;
    color: #e63946;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    will-change: transform, background-color, border-color;
}

.delete-all-btn:hover {
    background: rgba(230, 57, 70, 0.1);
    border-color: #e63946;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(168, 218, 220, 0.2);
}

.todo-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.todo-table th {
    background: rgba(29, 53, 87, 0.8);
    color: #a8dadc;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(168, 218, 220, 0.2);
    white-space: nowrap;
}

.todo-table td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(168, 218, 220, 0.1);
    vertical-align: middle;
}

.todo-table tbody tr:last-child td {
    border-bottom: none;
}

.todo-table tbody tr {
    transition: background-color 0.2s ease;
    will-change: layout style;
}

.todo-table tbody tr:hover {
    background: rgba(29, 53, 87, 0.3);
}

/* Added proper styling for table content elements */
.todo-task {
    color: #f1faee;
    font-size: 14px;
    font-weight: 500;
}

.todo-task.completed {
    text-decoration: line-through;
    opacity: 0.6;
}

.todo-date {
    color: #a8dadc;
    font-size: 13px;
}

.todo-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-completed {
    background: rgba(168, 218, 220, 0.2);
    color: #a8dadc;
}

.status-pending {
    background: rgba(230, 175, 57, 0.2);
    color: #e6b839ff;
}

.todo-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: transparent;
    border: 1px solid rgba(168, 218, 220, 0.3);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a8dadc;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    will-change: transform, background-color, border-color;
}

.action-btn.complete-btn:hover {
    border-color: #457b9d;
    color: #457b9d;
    background: rgba(69, 123, 157, 0.1);
}

.action-btn.delete-btn:hover {
    border-color: #e63946;
    color: #e63946;
    background: rgba(230, 57, 70, 0.1);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #a8dadc;
    font-size: 14px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate3d(0, 10px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .todo-container {
        padding: 24px;
        margin: 10px;
    }

    .input-section {
        flex-direction: column;
    }

    .todo-input,
    .date-input {
        min-width: 100%;
    }

    .filter-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .filter-left {
        width: 100%;
        justify-content: space-between;
    }

    .delete-all-btn {
        align-self: flex-end;
    }

    .todo-table {
        min-width: 500px;
    }
}

@media (max-width: 640px) {
    .todo-title {
        font-size: 24px;
    }

    .todo-table {
        min-width: 450px;
    }

    .todo-table th,
    .todo-table td {
        padding: 12px 8px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .todo-container {
        padding: 16px;
    }

    .todo-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .input-section {
        gap: 8px;
    }

    .filter-buttons {
        gap: 2px;
    }

    .filter-btn {
        padding: 6px 8px;
        font-size: 10px;
    }

    .todo-table {
        min-width: 400px;
    }

    .todo-table th,
    .todo-table td {
        padding: 10px 6px;
        font-size: 12px;
    }
}

/* Added focus management for better accessibility */
.todo-input:focus,
.date-input:focus,
.add-btn:focus,
.filter-btn:focus,
.delete-all-btn:focus,
.action-btn:focus {
    outline: 2px solid #e63946;
    outline-offset: 2px;
}

/* Improved high contrast mode support */
@media (prefers-contrast: high) {
    .todo-container {
        border: 2px solid #f1faee;
    }

    .todo-input,
    .date-input {
        border: 2px solid #a8dadc;
    }
}

/* Added reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
