:root {
    --primary: #1B5E4C;
    --secondary: #27A383;
    --accent: #FFD700;
    --text: #1A1A2E;
    --bg: #F5F7FA;
    --card: #FFFFFF;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding-bottom: 100px;
    overflow-x: hidden;
    direction: rtl;
    text-align: right;
}

.container { max-width: 480px; margin: 0 auto; padding: 16px; position: relative; z-index: 1; }

.top-wave {
    position: fixed; top: 0; left: 0; width: 100%; height: 320px;
    background: linear-gradient(135deg, #0F3D3E 0%, #1B5E4C 50%, #27A383 100%);
    z-index: 0; 
    clip-path: ellipse(150% 100% at 50% 0%);
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}

.islamic-pattern {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(60deg, #1B5E4C 0px, #1B5E4C 1px, transparent 1px, transparent 6px), 
                repeating-linear-gradient(-60deg, #1B5E4C 0px, #1B5E4C 1px, transparent 1px, transparent 6px);
    opacity: 0.3;
}

.header {
    text-align: center; padding: 20px 0; color: white; position: relative; z-index: 2;
}
.header h1 { font-family: 'Amiri', serif; font-size: 1.8rem; margin: 12px 0 6px; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.header p { opacity: 0.9; font-size: 0.95rem; }
.header .app-logo img { width: 100px; height: 100px; border-radius: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }

.stats-grid { display: flex; justify-content: space-between; gap: 12px; margin: 16px 0; }
.stat-card {
    flex: 1; background: var(--card); border-radius: 16px; padding: 16px; text-align: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08); display: flex; flex-direction: column; align-items: center;
}
.stat-icon { font-size: 1.8rem; margin-bottom: 6px; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 1rem; color: #666; margin-top: 4px; font-weight: 700; }

.card {
    background: var(--card); border-radius: 16px; padding: 20px;
    margin-bottom: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); position: relative; z-index: 1;
}

.stat-card.special {
    background: linear-gradient(135deg, #abccc3 0%, #92b8b1 100%);
    color: white;
    border: none;
    box-shadow: 0 8px 25px rgba(171, 204, 195, 0.35);
    transform: translateY(-2px);
    transition: all 0.3s ease;
    margin-bottom: 16px !important; 
}

.stat-card.special .stat-label,
.stat-card.special .stat-value,
.stat-card.special small {
    color: white !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.stat-card.special .stat-value {
    font-size: 1.2rem !important;
    font-weight: 900;
}

.progress-card { background: linear-gradient(135deg, #FFFFFF, #F8F9FA); }
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.progress-label { font-weight: 700; color: var(--primary); }
.progress-percent { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.progress-track { height: 24px; background: #E8EAED; border-radius: 12px; overflow: hidden; }
.progress-fill {
    height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 12px; transition: width 1s ease; display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 0.8rem;
}
.progress-info { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.85rem; color: #666; }

.input-group { margin-bottom: 16px; }
.input-label { font-weight: 700; color: var(--primary); margin-bottom: 6px; display: block; }
select {
    width: 100%; padding: 14px 16px; border: 2px solid #E8EAED; border-radius: 12px;
    font-family: 'Tajawal', sans-serif; font-size: 1rem; background: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%231B5E4C' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center; padding-right: 48px;
    -webkit-appearance: none; appearance: none;
}
select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(27,94,76,0.1); }

.btn-save { 
    width: 100%; 
    padding: 16px; 
    border: none; 
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), #FFA500); 
    color: #FFFFFF;
    font-weight: 800; 
    font-size: 1.1rem; 
    cursor: pointer; 
    box-shadow: 0 6px 20px rgba(255,215,0,0.4);
    font-family: 'Tajawal', sans-serif !important; /* هذا السطر هو الأهم */
    direction: rtl;
    unicode-bidi: embed;
}

.btn-save:active { 
    transform: scale(0.97); 
}
.current-position {
    background: #FFF9E6; border: 2px solid var(--accent); border-radius: 16px;
    padding: 16px; margin: 16px 0; text-align: center;
}
.current-position-title { font-weight: 700; color: #996515; margin-bottom: 6px; }
.current-position-text { font-weight: 800; color: var(--primary); font-size: 1.2rem; }
.current-position-date { font-size: 0.8rem; color: #996515; margin-top: 4px; }
.current-position-highlight {
    font-weight: bold; color: #0d5e0d; font-size: 1em; direction: rtl; text-align: center; line-height: 1.8;
    font-family: "Amiri", serif;
}

.reading-stats-card {
    background: linear-gradient(135deg, #FFFFFF, #F8F9FA);
    border-radius: 16px; padding: 20px; margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.reading-stats-title {
    font-weight: 800; font-size: 1.3rem; color: var(--primary); text-align: center;
    margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--accent);
}

.daily-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.daily-stat-card {
    background: var(--card); border-radius: 16px; padding: 16px; text-align: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.daily-stat-icon { font-size: 1.8rem; margin-bottom: 6px; }
.daily-stat-value { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.daily-stat-label { font-size: 0.8rem; color: #666; margin-top: 4px; font-weight: 700; }

.khatam-divider {
    height: 2px; background: linear-gradient(90deg, transparent, #FFA500, transparent);
    margin: 24px 0;
}

.mode-switcher {
    text-align: center; margin: 20px 0 16px; padding: 18px;
    background: #d4f5ec; border-radius: 20px; border: 2px solid transparent;
    background-clip: padding-box; position: relative; box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}
.mode-switcher::before {
    content: ''; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(135deg, #1B5E4C, #27A383); border-radius: 22px; z-index: -1;
}

.mode-label { font-weight: 400; color: var(--primary); margin-bottom: 12px; }
.mode-buttons { display: flex; gap: 12px; justify-content: center; }
.mode-btn {
    font-family: 'Tajawal', serif !important; font-weight: 700; font-size: 0.95rem;
    letter-spacing: 0.5px; padding: 9px 13px; border-radius: 30px; border: none;
    background: #abccc3; color: #FFFFFF; transition: all 0.3s;
}
.mode-btn.active {
    background: linear-gradient(135deg, #27A383, #1B5E4C); color: white;
    box-shadow: 0 8px 25px rgba(39,163,131,0.4);
}

.khatam-master-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px; padding: 16px; margin: 16px 0;
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.3); color: white;
    position: relative; overflow: hidden;
}
.khatam-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.khatam-item {
    background: rgba(255,255,255,0.18); border-radius: 16px; padding: 14px;
    text-align: center; backdrop-filter: blur(10px);
}
.khatam-item-icon { font-size: 32px; margin-bottom: 6px; }
.khatam-item-label { font-size: 0.85em; opacity: 0.95; margin-bottom: 4px; }
.khatam-item-value { font-size: 2.4em; font-weight: 900; text-shadow: 0 2px 6px rgba(0,0,0,0.4); }

.khatam-total-full {
    background: rgba(255,255,255,0.22); border-radius: 16px; padding: 16px;
    display: flex; align-items: center; backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.25);
}
.khatam-total-icon { font-size: 48px; margin-left: 14px; }
.total-label { font-weight: 600; opacity: 0.95; font-size: 1em; }
.total-value { font-size: 3.2em; font-weight: 900; line-height: 1; margin: 6px 0; }
.total-sub { opacity: 0.85; font-size: 0.85em; }

.notification-toggle {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFEB3B 100%);
    border-radius: 16px; padding: 16px; display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 4px 15px rgba(255,193,7,0.2); transition: all 0.4s ease; position: relative; overflow: hidden; margin: 16px 0;
}
.notification-toggle.active {
    background: linear-gradient(135deg, #E8F5E8 0%, #accbc3 100%);
    box-shadow: 0 6px 20px rgba(76,175,80,0.3);
}
.notification-title { font-weight: 700; color: #FF8F00; margin-bottom: 6px; font-size: 1.1em; }
.notification-toggle.active .notification-title { color: #155724; }
.notification-status { color: #5D4037; font-size: 0.95em; }
.notification-toggle.active .notification-status { color: #155724; font-weight: 500; }

.bell-icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    font-size: 28px; opacity: 0; transition: all 0.5s ease;
}
.notification-toggle.active .bell-icon { opacity: 1; animation: ring 2s infinite; }

.alert { padding: 14px; border-radius: 14px; margin-bottom: 16px; text-align: center; font-weight: 700; display: none; }
.alert.show { display: block; }
.alert.success { background: #D4EDDA; border: 2px solid #28A745; color: #155724; }
.alert.error { background: #F8D7DA; border: 2px solid #E74C3C; color: #721C24; }

.floating-btn {
    position: fixed; bottom: 24px; left: 24px; width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--accent), #FFA500); border-radius: 50%;
    box-shadow: 0 6px 20px rgba(255,215,0,0.5); font-size: 1.8rem;
    display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 100; color: #1A1A2E;
}
.floating-btn:active { transform: scale(0.9); }

.quran-footer { margin: 30px auto 50px; text-align: center; direction: rtl; }
.ayah-main {
    font-family: 'Amiri', serif; font-size: 1.4rem; color: #0F3D3E; margin-bottom: 10px;
    line-height: 2; text-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.duaa { margin-top: 10px; }
.footer-note {
    font-family: 'Tajawal', sans-serif; font-size: 1rem; color: #0F3D3E;
    margin: 9px 0; opacity: 0.92; font-weight: 500; line-height: 1.6;
}

/* ===== تثبيت الشارت النهائي وإجباره على الظهور دائماً ===== */
#progressChart {
    width: 100% !important;
    height: auto !important;
    min-height: 200px;
    max-height: 250px !important;
    margin: 20px 0 !important;
    display: block !important; /* إجبار الظهور دائماً */
    opacity: 1 !important;
    transform: scaleY(1) !important;
    visibility: visible !important;
}

@media screen and (max-width: 480px) {
    #progressChart {
        max-height: 200px !important;
    }
    .stat-card.special { padding: 14px !important; }
    .stat-card.special .stat-value { font-size: 1.1rem !important; }
}
/* حاوية الأيقونات */
.icon-tools {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 20px 0;
    flex-wrap: wrap;
}

/* الزر الدائري باللون الأخضر اللي طلبت */
.icon-tool-btn {
    width: 45px;
    height:45px;
    border-radius: 50%;
    background: #accbc3;                    /* لون الخلفية داخل الدائرة */
    border: 1px solid #1e8c6e;              /* حدود بلون أغمق قليلاً للعمق */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.35s ease;
    box-shadow: 0 6px 20px rgba(39, 163, 131, 0.35);
}

/* تأثير الـ hover */
.icon-tool-btn:hover {
    background: #1B5E4C;
    transform: translateY(-6px) scale(1.08);
    box-shadow: 0 12px 30px rgba(39, 163, 131, 0.5);
}

/* لون الأيقونة داخل الدائرة */
.icon-svg {
    width: 32px;
    height: 32px;
    stroke: #1B5E4C;               /* اللون الداخلي للرسم */
    stroke-width: 2.3;
    fill: none;
    transition: all 0.35s ease;
}

.icon-tool-btn:hover .icon-svg {
    stroke: white;
    transform: scale(1.15);
}

/* النص التوضيحي عند الـ hover (اختياري - شكله فخم مع الألوان الجديدة) */
.icon-tool-btn::after {
    content: attr(title);
    position: absolute;
    bottom: -38px;
    background: #1B5E4C;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.icon-tool-btn:hover::after {
    opacity: 1;
}
