/* ===== التنسيق العام لمنصة منهاج ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0a0f1e 0%, #0c1222 50%, #0a0f1e 100%);
    color: #e2e8f0;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    direction: rtl;
    text-align: right;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(251, 191, 36, 0.08) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* ===== القائمة الجانبية ===== */
.sidebar {
    width: 280px;
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid rgba(251, 191, 36, 0.15);
    padding: 2rem 1.2rem;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    height: 100vh;
    box-shadow: -8px 0 25px rgba(0,0,0,0.3);
    z-index: 50;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.brand-container {
    text-align: center;
    margin-bottom: 3rem;
}
.main-logo-img {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    box-shadow: 0 10px 25px rgba(251,191,36,0.25);
}
.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 1px;
}
.nav-links { list-style: none; }
.nav-links li {
    padding: 14px 18px;
    margin: 8px 0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 500;
    color: #94a3b8;
}
.nav-links li.active {
    background: linear-gradient(95deg, rgba(251,191,36,0.18), rgba(251,191,36,0.05));
    color: #fbbf24;
    border-right: 3px solid #fbbf24;
}
.nav-links li:hover:not(.active) {
    background: rgba(251,191,36,0.08);
    color: #fbbf24;
    transform: translateX(-5px);
}

/* ===== المحتوى الرئيسي ===== */
.main-content {
    flex: 1;
    margin-right: 280px;
    padding: 2rem;
    overflow-y: auto;
    height: 100vh;
    position: relative;
    z-index: 1;
}

.glass-header {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 32px;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.user-info h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to left, #fff, #fbbf24);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 6px;
}
.user-info p { color: #94a3b8; font-size: 0.95rem; }
.date-info { text-align: left; }
#clock {
    font-size: 2rem;
    font-weight: 800;
    font-family: monospace;
    background: linear-gradient(135deg, #fbbf24, #ffedd5);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hijri-date, .gregorian-date { font-size: 0.85rem; color: #cbd5e1; }

/* ===== شبكة البطاقات ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 1.5rem;
}

/* ===== أكورديون البطاقات ===== */
.accordion-controls {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.acc-control-btn {
    background: rgba(251,191,36,0.1);
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.3);
    border-radius: 14px;
    padding: 8px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s;
}
.acc-control-btn:hover {
    background: rgba(251,191,36,0.2);
    transform: translateY(-1px);
}
.card.accordion .card-header.acc-toggle {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.card.accordion .card-header.acc-toggle span {
    flex: 1;
}
.card.accordion .acc-chevron {
    transition: transform 0.3s ease;
    color: #fbbf24;
    font-size: 0.95rem;
    margin-right: auto;
    margin-left: 0;
}
.card.accordion:not(.collapsed) .acc-chevron {
    transform: rotate(180deg);
}
.card.accordion .card-body {
    overflow: hidden;
    max-height: 4000px;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease, padding-top 0.3s ease;
    opacity: 1;
    margin-top: 1.2rem;
}
.card.accordion.collapsed .card-body {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}
.card.accordion.collapsed .card-header.acc-toggle {
    margin-bottom: 0;
}
.card {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(251, 191, 36, 0.12);
    border-radius: 28px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}
.card:hover {
    border-color: rgba(251, 191, 36, 0.3);
    transform: translateY(-3px);
}
.card-header {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-right: 3px solid #fbbf24;
    padding-right: 12px;
}
.progress-section { margin-bottom: 20px; }
.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: #cbd5e1;
}
.progress-bar-container {
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    overflow: hidden;
    height: 10px;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 20px;
    box-shadow: 0 0 10px rgba(251,191,36,0.4);
}

/* ===== العناصر داخل البطاقات ===== */
.task-category { margin-bottom: 14px; }
.task-category h4 {
    color: #cbd5e1;
    font-size: 0.95rem;
    margin: 12px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.task-item:hover { background: rgba(251,191,36,0.08); }
.task-item.completed .task-name {
    text-decoration: line-through;
    opacity: 0.55;
}
.task-check {
    width: 22px;
    height: 22px;
    border: 2px solid #fbbf24;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}
.task-check.checked {
    background: #fbbf24;
    position: relative;
}
.task-check.checked::after {
    content: "✓";
    color: #000;
    font-size: 14px;
    display: flex;
    justify-content: center;
    line-height: 1.2;
}
.task-name { flex: 1; }
.task-time {
    font-size: 0.75rem;
    color: #94a3b8;
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 8px;
}
.task-time.warning { color: #fbbf24; background: rgba(251,191,36,0.1); }
.task-points {
    font-size: 0.75rem;
    color: #fbbf24;
    font-weight: 700;
}

.stats-wide { grid-column: span 2; }

.prayer-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    margin: 5px 0;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    transition: all 0.2s;
}
.prayer-item.active {
    background: rgba(251,191,36,0.15);
    color: #fbbf24;
    border-right: 2px solid #fbbf24;
    font-weight: 600;
}

.action-btn {
    width: 100%;
    padding: 10px;
    background: rgba(251,191,36,0.15);
    border: 1px solid rgba(251,191,36,0.4);
    border-radius: 12px;
    color: #fbbf24;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
}
.action-btn:hover { background: rgba(251,191,36,0.25); transform: translateY(-1px); }

.stats-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.tab-btn {
    padding: 8px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    color: #94a3b8;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.9rem;
}
.tab-btn.active {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0a0f1e;
    border-color: #fbbf24;
    font-weight: 700;
}

.chart-wrap {
    margin-top: 14px;
    background: rgba(0,0,0,0.2);
    border-radius: 14px;
    padding: 10px;
    height: 220px;
    position: relative;
}
.chart-wrap canvas { max-height: 200px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 18px;
}
.stat-box {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(251,191,36,0.1);
    border-radius: 16px;
    padding: 14px;
    text-align: center;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fbbf24;
    margin-bottom: 4px;
}
.stat-label { color: #94a3b8; font-size: 0.85rem; }

.marquee-footer {
    grid-column: 1 / -1;
    background: rgba(0,0,0,0.4);
    border-radius: 60px;
    padding: 12px 20px;
    overflow: hidden;
    white-space: nowrap;
    border: 1px solid rgba(251,191,36,0.2);
    margin-top: 1rem;
}
.marquee-text {
    display: inline-block;
    animation: scrollText 28s linear infinite;
    color: #fde68a;
    font-weight: 500;
}
@keyframes scrollText {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

button { cursor: pointer; }

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    background: rgba(251,191,36,0.9);
    color: #0a0f1e;
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 1.2rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    cursor: pointer;
}

@media (max-width: 980px) {
    .stats-wide { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
    .sidebar {
        transform: translateX(100%);
        width: 260px;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-right: 0; padding: 1rem; padding-top: 4.5rem; }
    .glass-header { padding: 1.2rem; flex-direction: column; text-align: center; }
    .date-info { text-align: center; }
    .dashboard-grid { grid-template-columns: 1fr; gap: 1rem; }
    #clock { font-size: 1.6rem; }
    .user-info h1 { font-size: 1.4rem; }
}

@media (max-width: 480px) {
    .card { padding: 1.2rem; border-radius: 22px; }
    .card-header { font-size: 1rem; }
}

/* ========== النافذة المنبثقة المخصصة (MinhajModal) ========== */
.minhaj-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 18, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.22s ease;
    padding: 1rem;
}
.minhaj-modal-overlay.show { opacity: 1; }

.minhaj-modal {
    background: linear-gradient(160deg, #111827 0%, #0c1222 100%);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 24px;
    padding: 2rem 1.6rem 1.4rem;
    max-width: 460px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0,0,0,0.55), 0 0 30px rgba(251,191,36,0.12);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    direction: rtl;
}
.minhaj-modal-overlay.show .minhaj-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.minhaj-modal-icon {
    width: 78px;
    height: 78px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: #fbbf24;
    background: rgba(251,191,36,0.12);
    border: 2px solid rgba(251,191,36,0.4);
    animation: minhajPulse 1.6s ease-in-out infinite;
}
@keyframes minhajPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(251,191,36,0.5); }
    50% { transform: scale(1.06); box-shadow: 0 0 0 16px rgba(251,191,36,0); }
}
.minhaj-modal-title {
    color: #fbbf24;
    font-size: 1.4rem;
    margin-bottom: 0.7rem;
    font-weight: 800;
}
.minhaj-modal-msg {
    color: #cbd5e1;
    font-size: 1.05rem;
    line-height: 1.85;
    margin-bottom: 1.4rem;
}
.minhaj-modal-msg strong { color: #fde68a; }
.minhaj-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.minhaj-modal-btn {
    padding: 12px 26px;
    border-radius: 14px;
    border: 0;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 120px;
}
.minhaj-modal-btn.confirm {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0a0f1e;
    box-shadow: 0 8px 18px rgba(251,191,36,0.3);
}
.minhaj-modal-btn.confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(251,191,36,0.45);
}
.minhaj-modal-btn.cancel {
    background: rgba(148,163,184,0.12);
    color: #cbd5e1;
    border: 1px solid rgba(148,163,184,0.25);
}
.minhaj-modal-btn.cancel:hover {
    background: rgba(239,68,68,0.18);
    color: #fca5a5;
    border-color: rgba(239,68,68,0.4);
}

/* ألوان مختلفة حسب النوع */
.minhaj-modal-success .minhaj-modal-icon { color: #4ade80; background: rgba(74,222,128,0.12); border-color: rgba(74,222,128,0.4); }
.minhaj-modal-success .minhaj-modal-title { color: #86efac; }
.minhaj-modal-warning .minhaj-modal-icon { color: #fb923c; background: rgba(251,146,60,0.12); border-color: rgba(251,146,60,0.4); }
.minhaj-modal-warning .minhaj-modal-title { color: #fdba74; }
.minhaj-modal-prayer .minhaj-modal-icon { color: #fbbf24; background: rgba(251,191,36,0.18); border-color: rgba(251,191,36,0.5); }
.minhaj-modal-confirm .minhaj-modal-icon { color: #60a5fa; background: rgba(96,165,250,0.12); border-color: rgba(96,165,250,0.4); }
.minhaj-modal-confirm .minhaj-modal-title { color: #93c5fd; }
.minhaj-modal-reminder .minhaj-modal-icon { color: #c084fc; background: rgba(192,132,252,0.12); border-color: rgba(192,132,252,0.4); }
.minhaj-modal-reminder .minhaj-modal-title { color: #d8b4fe; }

/* شبكة اختيار مدة التركيز */
.focus-duration-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 1.4rem;
}
.focus-dur-btn {
    padding: 14px 8px;
    border-radius: 14px;
    border: 1px solid rgba(251,191,36,0.3);
    background: rgba(251,191,36,0.08);
    color: #fde68a;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    transition: 0.2s;
}
.focus-dur-btn:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0a0f1e;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(251,191,36,0.35);
}

/* ========== مهمة مقفولة (لم يحن وقتها) ========== */
.task-item.locked {
    opacity: 0.55;
    cursor: not-allowed;
    background: rgba(251,146,60,0.06) !important;
    border-color: rgba(251,146,60,0.2) !important;
    position: relative;
}
.task-item.locked .task-check {
    background: rgba(251,146,60,0.15);
    color: #fb923c;
    display: flex;
    align-items: center;
    justify-content: center;
    border-color: rgba(251,146,60,0.3) !important;
}
.task-item.locked:hover {
    transform: none !important;
    background: rgba(251,146,60,0.1) !important;
}

@media (max-width: 480px) {
    .minhaj-modal { padding: 1.5rem 1.2rem 1.2rem; }
    .minhaj-modal-title { font-size: 1.2rem; }
    .minhaj-modal-msg { font-size: 0.95rem; }
    .minhaj-modal-icon { width: 64px; height: 64px; font-size: 1.8rem; }
    .focus-duration-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ========== الإدخال المخصّص لمدّة التركيز ========== */
.focus-custom-row {
    margin: 6px 0 16px;
    padding: 14px;
    background: rgba(251,191,36,0.05);
    border: 1px dashed rgba(251,191,36,0.3);
    border-radius: 16px;
}
.focus-custom-label {
    display: block;
    color: #fde68a;
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: right;
}
.focus-custom-label i { margin-left: 6px; }
.focus-custom-inputs {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.focus-custom-inputs input[type="number"] {
    flex: 1;
    padding: 12px 14px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(251,191,36,0.35);
    border-radius: 12px;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    direction: ltr;
    outline: none;
    transition: 0.2s;
}
.focus-custom-inputs input[type="number"]:focus {
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251,191,36,0.18);
    background: rgba(0,0,0,0.5);
}
.focus-custom-inputs input.input-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.18);
    animation: shake 0.4s;
}
@keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.focus-custom-go {
    padding: 12px 18px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0a0f1e;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.95rem;
    transition: 0.2s;
    white-space: nowrap;
}
.focus-custom-go:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(251,191,36,0.4);
}
.focus-custom-error {
    margin-top: 8px;
    color: #fca5a5;
    font-size: 0.85rem;
    text-align: right;
    min-height: 1.2em;
}

/* ========== مدّة التركيز v1.4.2 ========== */
.preset-durations {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 4px 0 14px;
}
@media (min-width: 480px) {
    .preset-durations { grid-template-columns: repeat(4, 1fr); }
}
.preset-durations .preset-btn {
    padding: 12px 8px;
    background: rgba(99,102,241,0.15);
    border: 1px solid rgba(99,102,241,0.4);
    border-radius: 12px;
    color: #c7d2fe;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.2s;
}
.preset-durations .preset-btn:hover {
    background: rgba(99,102,241,0.35);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(99,102,241,0.3);
}
.custom-duration {
    margin: 6px 0 14px;
    padding: 14px;
    background: rgba(251,191,36,0.06);
    border: 1px dashed rgba(251,191,36,0.35);
    border-radius: 14px;
    text-align: right;
}
.custom-duration-label {
    display: block;
    color: #fde68a;
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 10px;
}
.custom-duration-label i { margin-left: 6px; }
.custom-duration-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.custom-duration-row input[type="number"] {
    flex: 1;
    padding: 12px 14px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(251,191,36,0.4);
    border-radius: 12px;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    direction: ltr;
    outline: none;
    transition: 0.2s;
}
.custom-duration-row input[type="number"]:focus {
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251,191,36,0.18);
    background: rgba(0,0,0,0.55);
}
.custom-start-btn {
    padding: 12px 18px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0a0f1e;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.95rem;
    transition: 0.2s;
    white-space: nowrap;
}
.custom-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(251,191,36,0.4);
}
/* داخل MinhajModal: محاذاة الرسالة لليمين لمحتوى التركيز */
.minhaj-modal-msg .preset-durations,
.minhaj-modal-msg .custom-duration { text-align: right; }
