/* Custom Styles for Todo List App */

/* Screen Reader Only - for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Task Item Animations */
.task-item {
    animation: fadeInSlide 0.3s ease-out;
    transition: all 0.2s ease;
}

.task-item.removing {
    animation: fadeOutSlide 0.3s ease-in forwards;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutSlide {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* Task Item Hover Effect */
.task-item:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* Checkbox Styling */
.task-checkbox {
    cursor: pointer;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.375rem;
    border: 2px solid #d1d5db;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.task-checkbox:checked {
    background-color: #10b981;
    border-color: #10b981;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
}

.task-checkbox:hover {
    border-color: #9ca3af;
}

.task-checkbox:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Completed Task Styling */
.task-item.completed {
    background-color: #f9fafb;
}

.task-item.completed .task-text {
    color: #9ca3af;
    text-decoration: line-through;
}

/* Task Text */
.task-text {
    transition: all 0.2s ease;
    word-break: break-word;
}

/* Delete Button */
.delete-btn {
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 0.6;
    flex-shrink: 0;
}

.delete-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.delete-btn:focus {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Filter Button Styling */
.filter-btn {
    color: #6b7280;
    background-color: transparent;
}

.filter-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.filter-btn.active {
    background-color: #3b82f6;
    color: white;
}

.filter-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Empty State Animation */
#empty-state {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Error Message Animation */
#error-message:not(.hidden) {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus Visible Enhancement */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading State (for future use) */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
    .task-item {
        padding: 0.75rem;
    }

    .delete-btn {
        font-size: 1.25rem;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .task-checkbox {
        border-width: 3px;
    }

    .filter-btn.active {
        border: 2px solid white;
    }
}

/* 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;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .delete-btn,
    .filter-btn,
    #task-form,
    footer {
        display: none;
    }

    .task-item {
        page-break-inside: avoid;
    }
}
