:root {
    --bg-main: #09090b;
    --card-bg: #18181b;
    --card-hover: #27272a;
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --accent: #4facfe;
    --danger: #ef4444;
    --border: rgba(255, 255, 255, 0.05);
}

body {
    margin: 0; padding: 0;
    font-family: 'Alexandria', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    direction: rtl;
    padding-bottom: 120px; /* مساحة واسعة للنافار */
    overflow-x: hidden;
}

/* الإضاءة الخلفية (Glow) */
.ambient-glow {
    position: fixed; top: -10%; left: -10%; width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(79,172,254,0.05) 0%, rgba(0,0,0,0) 70%);
    z-index: -1; pointer-events: none;
}

.app-wrapper { max-width: 650px; margin: 0 auto; padding: 0 20px; }

/* الهيدر العائم */
.glass-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 25px 0; margin-bottom: 20px;
    background: transparent;
}
.header-info h1 { margin: 0; font-size: 32px; font-weight: 700; background: -webkit-linear-gradient(#fff, #a1a1aa); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
.header-info h1 span { font-size: 14px; font-weight: 400; color: var(--accent); -webkit-text-fill-color: var(--accent);}
.header-info p { margin: 5px 0 0; color: var(--text-muted); font-size: 13px; font-weight: 300; }

.header-stats { display: flex; align-items: center; gap: 15px; }
.streak-pill { background: rgba(255, 152, 0, 0.1); color: #FF9F0A; padding: 6px 14px; border-radius: 20px; font-weight: 600; font-size: 13px; border: 1px solid rgba(255, 152, 0, 0.2); }

/* Progress Ring */
.progress-ring-container { position: relative; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.progress-svg { position: absolute; transform: rotate(-90deg); }
#progress-circle { transition: stroke-dashoffset 1s cubic-bezier(0.25, 1, 0.5, 1); }
#progress-text { font-size: 10px; font-weight: 700; }

/* العناوين الداخلية */
.section-title-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 15px; }
.section-title-row h2 { margin: 0; font-size: 22px; font-weight: 600; }
.section-title-row .sub-text { color: var(--text-muted); font-size: 12px; }

/* إضافة المهام (Quick Add) */
.quick-add-panel { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 15px; margin-bottom: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.quick-add-row { display: flex; gap: 10px; margin-top: 10px; }
.full-width { width: 100%; box-sizing: border-box; }
.flex-2 { flex: 2; } .flex-1 { flex: 1; }

.neo-input {
    background: #27272a; border: 1px solid transparent; color: #fff;
    padding: 12px 15px; border-radius: 12px; font-family: inherit; font-size: 14px;
    transition: all 0.3s ease; color-scheme: dark;
}
.neo-input:focus { outline: none; border-color: var(--accent); background: #1f1f22; box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1); }
.icon-input { text-align: center; }

.neo-btn {
    border: none; border-radius: 12px; padding: 12px 20px; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.3s ease;
}
.neo-btn:active { transform: scale(0.95); }
.neo-btn.primary { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); color: #000; box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3); }
.neo-btn.secondary { background: #27272a; color: #fff; }
.neo-btn.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }

/* كروت المهام (Task Cards) */
.task-list { display: flex; flex-direction: column; gap: 12px; }
.task-card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; justify-content: space-between; align-items: center; transition: all 0.3s ease; border-right: 4px solid transparent; /* لون التصنيف */
}
.task-card:hover { background: var(--card-hover); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.task-card.completed { opacity: 0.5; }
.task-card.completed .task-title { text-decoration: line-through; color: var(--text-muted); }

.task-content-wrapper { display: flex; align-items: center; gap: 15px; flex: 1; }
.task-details { display: flex; flex-direction: column; gap: 4px; }
.task-title { margin: 0; font-size: 16px; font-weight: 600; transition: 0.3s; }
.task-meta { margin: 0; font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; align-items: center;}

.shift-text-btn { color: var(--text-muted); background: rgba(255,255,255,0.05); border: none; font-size: 12px; font-weight: 600; cursor: pointer; padding: 6px 12px; border-radius: 8px; transition: 0.3s; font-family: inherit;}
.shift-text-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Custom Checkbox (التحفة الفنية) */
.custom-checkbox { position: relative; display: inline-block; width: 24px; height: 24px; cursor: pointer; }
.custom-checkbox input { opacity: 0; width: 0; height: 0; }
.checkmark { position: absolute; top: 0; left: 0; height: 24px; width: 24px; background-color: transparent; border: 2px solid #52525b; border-radius: 8px; transition: all 0.3s ease; }
.custom-checkbox:hover input ~ .checkmark { border-color: var(--accent); }
.custom-checkbox input:checked ~ .checkmark { background: linear-gradient(135deg, #4facfe, #00f2fe); border-color: transparent; box-shadow: 0 0 10px rgba(79, 172, 254, 0.5); }
.checkmark:after { content: ""; position: absolute; display: none; left: 8px; top: 4px; width: 5px; height: 10px; border: solid #000; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.custom-checkbox input:checked ~ .checkmark:after { display: block; }

/* شريط التنقل السفلي العائم */
.floating-nav {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: rgba(24, 24, 27, 0.8); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 100px;
    display: flex; justify-content: space-between; gap: 5px; padding: 8px; box-shadow: 0 15px 40px rgba(0,0,0,0.5); z-index: 100;
}
.nav-item {
    background: transparent; border: none; color: var(--text-muted);
    display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 100px; cursor: pointer; transition: all 0.3s ease; font-family: inherit; font-weight: 600;
}
.nav-item:hover { color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.1); color: #fff; }
.nav-icon { font-size: 18px; }
.nav-text { font-size: 13px; }

@media (max-width: 480px) {
    .nav-text { display: none; } /* إخفاء النص في الشاشات الصغيرة لشكل أنظف */
    .nav-item { padding: 12px 25px; }
}

/* الكروت والإعدادات */
.neo-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin-bottom: 20px; }
.add-cat-row { display: flex; gap: 10px; margin-bottom: 20px; align-items: center; }
.neo-color { width: 42px; height: 42px; border: none; border-radius: 12px; padding: 0; background: transparent; cursor: pointer; }
.icon-btn { padding: 0; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.cat-list { display: flex; flex-direction: column; gap: 10px; }
.cat-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; background: #27272a; border-radius: 12px; border-right: 4px solid; }
.del-cat-btn { background: rgba(239, 68, 68, 0.1); border: none; color: var(--danger); padding: 8px 12px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: bold; transition: 0.3s;}
.del-cat-btn:hover { background: var(--danger); color: #fff; }

/* الـ Modal */
.neo-modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); align-items: center; justify-content: center; }
.modal-body { background: var(--card-bg); width: 90%; max-width: 400px; padding: 30px; border-radius: 24px; border: 1px solid var(--border); box-shadow: 0 25px 50px rgba(0,0,0,0.5); text-align: center; }
.modal-body h3 { margin: 0 0 10px; font-size: 22px; color: #fff; }
.modal-body p { margin: 0; color: var(--text-muted); font-size: 14px; }
.mt-15 { margin-top: 15px; }
.modal-actions { display: flex; gap: 15px; }

.logout-btn { margin-top: 30px; }

/* === تصميم صفحة تسجيل الدخول === */
.login-body { 
    display: flex; align-items: center; justify-content: center; 
    min-height: 100vh; padding: 20px; box-sizing: border-box; padding-bottom: 20px;
}
.login-wrapper { width: 100%; max-width: 400px; z-index: 10; }
.login-card { 
    background: var(--card-bg); padding: 40px 30px; 
    border-radius: 24px; border: 1px solid var(--border); 
    box-shadow: 0 25px 50px rgba(0,0,0,0.5); 
}
.login-header { text-align: center; margin-bottom: 30px; }
.login-header h1 { 
    margin: 0; font-size: 36px; font-weight: 700; 
    background: linear-gradient(135deg, #fff, #a1a1aa); 
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; 
}
.login-header h1 span { font-size: 14px; font-weight: 400; color: var(--accent); -webkit-text-fill-color: var(--accent); }
.login-header p { margin: 8px 0 0; color: var(--text-muted); font-size: 14px; }

.input-group label { display: block; margin-bottom: 8px; font-size: 13px; color: var(--text-muted); font-weight: 600;}
.error-text { color: var(--danger); font-size: 13px; margin-top: 15px; text-align: center; font-weight: 600; min-height: 20px; transition: 0.3s;}
/* أزرار الحذف والتعديل */
.task-actions { display: flex; align-items: center; gap: 6px; }
.icon-action-btn { 
    background: rgba(255,255,255,0.05); border: none; color: var(--text-main);
    width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.3s; font-size: 14px;
}
.icon-action-btn:hover { background: rgba(255,255,255,0.1); transform: scale(1.05); }
.icon-action-btn.delete-btn { color: var(--danger); background: rgba(239, 68, 68, 0.08); }
.icon-action-btn.delete-btn:hover { background: var(--danger); color: #fff; }

.future-badge {
    background: rgba(255,255,255,0.1); padding: 2px 6px; 
    border-radius: 6px; font-size: 10px; margin-right: 5px;
}

/* === ميزة طي المهام (Collapse) === */
.collapsible-header {
    cursor: pointer;
    padding: 10px;
    border-radius: 12px;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.collapsible-header:hover {
    background: rgba(255, 255, 255, 0.03);
}
.collapsible-content {
    transition: max-height 0.4s ease, opacity 0.4s ease;
    max-height: 2000px; /* لضمان استيعاب المهام */
    opacity: 1;
    overflow: hidden;
}
.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
}
#future-toggle-btn {
    transition: transform 0.3s ease;
}
#future-toggle-btn.rotated {
    transform: rotate(90deg); /* لف السهم لليسار لما يكون مقفول */
}

/* === ميزة التثبيت (Prioritization) === */
.task-card.pinned {
    border: 1px solid var(--accent);
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.15);
}
.icon-action-btn.active-pin { background: rgba(79, 172, 254, 0.2); color: var(--accent); }

/* === التحذير من التأجيل (Anti-Procrastination) === */
.danger-text { color: var(--danger); font-size: 11px; font-weight: bold; margin-top: 5px; display: block; }
.shift-danger { color: var(--danger) !important; background: rgba(239, 68, 68, 0.1) !important; }

/* === المراجعة الأسبوعية (Weekly Review) === */
.rating-stars { display: flex; justify-content: center; gap: 10px; margin-top: 15px; }
.rating-stars span { font-size: 30px; cursor: pointer; filter: grayscale(100%); transition: 0.2s; }
.rating-stars span.active { filter: grayscale(0%); transform: scale(1.15); }
textarea.neo-input { resize: vertical; min-height: 80px; }
/* =========================================
   📱 تظبيط أبعاد الموبايل (Mobile Responsiveness)
   ========================================= */
@media (max-width: 550px) {
    /* تظبيط صف إضافة المهام */
    .quick-add-row {
        flex-wrap: wrap; /* السماح للعناصر بالنزول لسطر جديد */
        gap: 10px;
    }
    .quick-add-row select {
        flex: 1 1 55%; /* ياخد مساحة أكبر شوية */
    }
    .quick-add-row input[type="time"] {
        flex: 1 1 35%;
    }
    .quick-add-row .add-btn {
        flex: 1 1 100%; /* الزرار ياخد العرض بالكامل */
        margin-top: 5px;
    }

    /* تظبيط كروت المهام عشان الكلام ميتضغطش */
    .task-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }
    .task-content-wrapper {
        width: 100%;
        align-items: flex-start;
    }
    .task-actions {
        width: 100%;
        justify-content: flex-end;
        border-top: 1px solid rgba(255,255,255,0.05);
        padding-top: 12px;
        margin-top: 5px;
    }

    /* تظبيط صف إضافة التصنيفات في الإعدادات */
    .add-cat-row {
        flex-wrap: wrap;
    }
    .add-cat-row #new-cat-name {
        flex: 1 1 100%;
        margin-bottom: 5px;
    }

    /* تظبيط الهيدر (شعلة الحماس والنسبة) */
    .header-stats {
        gap: 10px;
    }
    .streak-pill {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* تصغير العناوين نسبياً */
    .header-info h1 {
        font-size: 26px;
    }
}
