/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

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

/* Task Controls */
.task-controls {
    margin-bottom: 2rem;
}

.add-task-section {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.task-input {
    flex: 1;
    min-width: 200px;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.task-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.priority-select {
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    min-width: 180px;
}

.priority-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.2);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-text {
    background: transparent;
    color: #667eea;
    padding: 10px 15px;
}

.btn-text:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Filter Section */
.filter-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.filter-btn:hover:not(.active) {
    border-color: #667eea;
    color: #667eea;
}

.stats {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #666;
    font-size: 0.9rem;
}

/* Task List */
.task-list-container {
    position: relative;
    min-height: 300px;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    background: white;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

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

.task-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.task-checkbox.checked {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.task-content {
    flex: 1;
}

.task-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: #999;
}

.task-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #666;
}

.priority-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-high {
    background: #fee;
    color: #e74c3c;
}

.priority-medium {
    background: #ffeaa7;
    color: #f39c12;
}

.priority-low {
    background: #d1f7c4;
    color: #27ae60;
}

.task-actions {
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #f8f9fa;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #667eea;
    color: white;
}

/* Empty and Error States */
.empty-state, .error-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i, .error-state i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 20px;
}

.error-state i {
    color: #e74c3c;
}

.empty-state h3, .error-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

/* Footer */
.footer {
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    text-align: center;
    color: #666;
    border-top: 1px solid #e0e0e0;
}

.footer p {
    margin-bottom: 0.5rem;
}

.api-status {
    font-size: 0.9rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-indicator .fa-circle {
    font-size: 0.6rem;
}

.status-indicator.connected .fa-circle {
    color: #27ae60;
}

.status-indicator.disconnected .fa-circle {
    color: #e74c3c;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 15px;
    }
    
    .header {
        padding: 1.5rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .add-task-section {
        flex-direction: column;
    }
    
    .task-input, .priority-select, .btn {
        width: 100%;
    }
    
    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .stats {
        justify-content: center;
    }
    
    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .task-actions {
        align-self: flex-end;
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header .subtitle {
        font-size: 1rem;
    }
    
    .task-meta {
        flex-direction: column;
        gap: 5px;
    }
}

/* Animation for task completion */
@keyframes completeAnimation {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.task-item.completed {
    animation: completeAnimation 0.3s ease;
}