*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    direction: rtl;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* الهيدر */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header h1 i {
    margin-left: 15px;
    color: #ffd700;
}

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

/* الحاوية الرئيسية */
.app-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* قسم الإدخال */
.input-section {
    padding: 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #eaeaea;
}

.input-group {
    display: flex;
    gap: 10px;
}

#taskInput {
    flex: 1;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

#taskInput:focus {
    outline: none;
    border-color: #667eea;
}

#addBtn {
    padding: 0 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background 0.3s;
}

#addBtn:hover {
    background: #5a6fd8;
}



/* قسم الفلترة */
.filter-section {
    display: flex;
    justify-content: center;
    padding: 15px;
    background: #f1f3f5;
    border-bottom: 1px solid #eaeaea;
}

.filter-btn {
    padding: 8px 20px;
    margin: 0 5px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.filter-btn:hover:not(.active) {
    background: #e9ecef;
}

.tasks-section {
    margin-top: 2px;
    border-radius: 8px 8px 0 0;
    justify-content: space-between;
    padding: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    background: #FFFFFF;
    min-height: 300px;
    position: relative;
}

#taskList {
    list-style: none;
    padding: 0;
}


.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s;
    animation: fadeIn 0.3s ease;
}

.task-item:hover {
    background: #f8f9fa;
}

.task-item.completed {
    background: #f8fff8;
}

.task-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    margin-left: 15px;
    cursor: pointer;
}

.task-text {
    flex: 1;
    font-size: 1.1rem;
}

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

.task-actions {
    display: flex;
    gap: 10px;
}

.task-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.3s;
    color: #666;
}

.edit-btn:hover {
    background: #e3f2fd;
    color: #1976d2;
}

.delete-btn:hover {
    background: #ffebee;
    color: #d32f2f;
}


/* حالة عدم وجود مهام */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    display: none;
}

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

.empty-state p {
    margin: 10px 0;
    font-size: 1.2rem;
}

/* الفوتر */
.footer-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #eaeaea;
}

.stats {
    font-weight: bold;
    color: #555;
}

.action-btn {
    padding: 8px 15px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.action-btn:hover {
    background: #ff5252;
}

.action-btn i {
    margin-left: 5px;
}


/* نافذة التحرير */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 15px;
    text-align: center;
}

#editTaskInput {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    margin-bottom: 20px;
}

#editTaskInput:focus {
    outline: none;
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.save-btn {
    padding: 10px 20px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.cancel-btn {
    padding: 10px 20px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}



/* تأثيرات الحركة */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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


/* التصميم المتجاوب */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    #addBtn {
        padding: 12px;
    }
    
    .footer-section {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .task-actions {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .filter-section {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-btn {
        width: 100%;
        margin: 2px 0;
    }
}







/* نافذة التحرير */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 15px;
    text-align: center;
}

#editTaskInput {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    margin-bottom: 20px;
}

#editTaskInput:focus {
    outline: none;
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.save-btn {
    padding: 10px 20px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.cancel-btn {
    padding: 10px 20px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
