/* Reset e Configurações Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores do tema claro */
    --primary-color: #6366f1;
    --primary-hover: #5856eb;
    --secondary-color: #f8fafc;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --placeholder-color: #94a3b8;

    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    --transition: all 0.2s ease-in-out;
}

/* Tema escuro */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --placeholder-color: rgba(255, 255, 255, 0.6);

    --border-color: #334155;
    --border-hover: #475569;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition);
    width: 100%;
}

.header.scrolled {
    padding: 0.25rem 0;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    transition: var(--transition);
    max-width: 1200px;
    margin: 0 auto;
}

.header.scrolled .header-content {
    padding: 0.5rem 2rem;
}

.app-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.header.scrolled .app-title {
    font-size: 1.25rem;
    gap: 0.5rem;
}

.app-title i {
    font-size: 2rem;
    transition: var(--transition);
}

.header.scrolled .app-title i {
    font-size: 1.25rem;
}

.theme-toggle {
    display: flex;
    align-items: center;
}

.theme-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.header.scrolled .theme-btn {
    padding: 0.5rem;
    font-size: 1rem;
}

.theme-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

/* Main Content */
.main {
    flex: 1;
    padding: 2rem;
}

.todo-container {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

/* Add Task Section */
.add-task-section {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    position: sticky;
    top: 0;
    z-index: 90;
    transition: var(--transition);
}

.add-task-section.scrolled {
    top: 60px;
    /* Altura do header compacto menor */
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-md);
}

.input-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.task-input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.task-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
    background: var(--bg-primary);
    border-color: rgba(255, 255, 255, 0.4);
}

.task-input::placeholder {
    color: var(--placeholder-color);
}

.add-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.125rem;
    backdrop-filter: blur(10px);
}

.add-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* Filters Section */
.filters-section {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-hover);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.task-counter {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Tasks Section */
.tasks-section {
    height: 60vh;
    max-height: 600px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scrollbar personalizada */
.tasks-section::-webkit-scrollbar {
    width: 8px;
}

.tasks-section::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.tasks-section::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.tasks-section::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

.tasks-container {
    padding: 1rem 0;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    animation: slideIn 0.3s ease-out;
}

.task-item:hover {
    background: var(--bg-secondary);
}

.task-item:last-child {
    border-bottom: none;
}

.task-item.completed {
    opacity: 0.7;
}

.task-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-right: 1rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}

.task-checkbox.checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.task-checkbox.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.task-content {
    flex: 1;
    margin-right: 1rem;
}

.task-text {
    font-size: 1rem;
    color: var(--text-primary);
    transition: var(--transition);
    word-break: break-word;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: var(--transition);
}

.task-item:hover .task-actions {
    opacity: 1;
}

.task-btn {
    background: transparent;
    border: none;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.task-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.task-btn.delete:hover {
    background: var(--danger-color);
    color: white;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1rem;
}

.empty-state.hidden {
    display: none;
}

/* Bulk Actions */
.bulk-actions {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.bulk-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bulk-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.bulk-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    width: 100%;
}

.footer p {
    max-width: 1200px;
    margin: 0 auto;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease-out;
}

.modal-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-confirm,
.btn-cancel {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.btn-confirm {
    background: var(--danger-color);
    color: white;
}

.btn-confirm:hover {
    background: #dc2626;
}

.btn-cancel {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsividade */
@media (max-width: 768px) {
    .main {
        padding: 1rem;
    }

    .header-content {
        padding: 1rem;
        max-width: none;
        margin: 0;
    }

    .header.scrolled .header-content {
        padding: 0.25rem 1rem;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .header.scrolled .app-title {
        font-size: 1.125rem;
    }

    .add-task-section {
        padding: 1.5rem;
    }

    .add-task-section.scrolled {
        top: 45px;
        /* Altura do header compacto menor no mobile */
        padding: 1rem 1.5rem;
    }

    .input-container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .task-input {
        width: 100%;
    }

    .add-btn {
        width: 100%;
        justify-content: center;
    }

    .filters-section {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .filter-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .task-item {
        padding: 1rem;
    }

    .tasks-section {
        height: 50vh;
        max-height: 400px;
    }

    .bulk-actions {
        padding: 1rem;
        flex-direction: column;
    }

    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .footer {
        padding: 1rem;
    }

    .footer p {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .tasks-section {
        height: 40vh;
        max-height: 300px;
    }

    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .task-checkbox {
        margin-right: 0;
    }

    .task-content {
        margin-right: 0;
        width: 100%;
    }

    .task-actions {
        opacity: 1;
        align-self: flex-end;
    }

    .filter-btn {
        flex: 1;
        justify-content: center;
    }
}