/* تحسينات إضافية للتصميم والأنيميشنات */

/* متغيرات CSS للألوان */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --border-color: #e5e7eb;
    --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-large: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* متغيرات الوضع المظلم */
[data-theme="dark"] {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --border-color: #374151;
    --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-large: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* تحسينات عامة */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* خلفية متدرجة للوضع الفاتح */
body:not([data-theme="dark"]) {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* خلفية متدرجة للوضع المظلم */
[data-theme="dark"] body {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
}

/* تحسينات للنصوص العربية */
.arabic-text {
    font-family: 'Amiri', serif;
    font-weight: 400;
    line-height: 1.8;
}

/* تأثيرات الزجاج المحسنة */
.glass-effect {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: var(--shadow-large);
    transition: all 0.3s ease;
}

/* تأثير الزجاج في الوضع المظلم */
[data-theme="dark"] .glass-effect {
    background: rgba(31, 41, 55, 0.4);
    border: 1px solid rgba(75, 85, 99, 0.3);
}

/* تدرجات محسنة */
.gradient-bg {
    background: #111827;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(17, 24, 39, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gradient-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* تحسينات البطاقات */
.card-hover {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* البطاقات في الوضع المظلم */
[data-theme="dark"] .card-hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.card-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.card-hover:hover::before {
    left: 100%;
}

/* أنيميشنات النبض المحسنة */
.pulse-animation {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* أنيميشن الموجات للمشغل */
.wave {
    animation: wave 1.5s ease-in-out infinite;
    transform-origin: center;
}

@keyframes wave {
    0%, 100% {
        transform: scaleY(1);
        opacity: 0.7;
    }
    50% {
        transform: scaleY(1.8);
        opacity: 1;
    }
}

/* تحسينات شريط التقدم */
.progress-bar {
    transition: width 0.3s ease;
    background: linear-gradient(90deg, var(--success-color), var(--primary-color));
    position: relative;
    overflow: hidden;
    /* إصلاح الاتجاه للغة العربية */
    transform-origin: right;
    direction: rtl;
}

/* إصلاح حاوي شريط التقدم للعربية */
#progress-container {
    direction: rtl;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* تحسينات الأزرار */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.btn-primary:active {
    transform: translateY(0);
}

/* تأثيرات التحميل */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* تحسينات الاستجابة */
@media (max-width: 768px) {
    .glass-effect {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .card-hover {
        margin-bottom: 1rem;
    }
    
    .gradient-bg {
        padding: 1rem;
    }
}

/* تأثيرات الظهور */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

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

/* تحسينات التمرير */
html {
    scroll-behavior: smooth;
}

/* تخصيص شريط التمرير */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

/* تأثيرات الهوفر للأيقونات */
.icon-hover {
    transition: all 0.3s ease;
}

.icon-hover:hover {
    transform: scale(1.2) rotate(5deg);
    color: var(--primary-color);
}

/* تحسينات النماذج */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--primary-color) 0%, var(--border-color) 0%);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

/* تأثيرات الإشعارات */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.notification.error {
    background: linear-gradient(135deg, var(--error-color), #dc2626);
}

/* تحسينات الطباعة */
@media print {
    .gradient-bg {
        background: #333 !important;
        color: white !important;
    }
    
    .glass-effect {
        background: white !important;
        border: 1px solid #ccc !important;
    }
}

/* أنماط إضافية للتحسينات */
.text-gradient {
    background: linear-gradient(135deg, #ffffff 0%, #e5e7eb 50%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* أنماط الأذكار */
.dhikr-card {
    transition: all 0.3s ease;
}

.dhikr-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.counter {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.counter:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.category-btn {
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #9ca3af;
    transition: all 0.3s ease;
    cursor: pointer;
}

.category-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border-color: #3b82f6;
}

.category-btn.active {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-color: #3b82f6;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #9ca3af;
    transition: all 0.3s ease;
    cursor: pointer;
}

.filter-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border-color: #3b82f6;
}

.filter-btn.active {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-color: #3b82f6;
}

/* أنماط قصص الأنبياء */
.story-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.favorite-btn {
    transition: all 0.3s ease;
}

.favorite-btn:hover {
    transform: scale(1.1);
}

/* أنماط أوقات الصلاة */
.prayer-card {
    transition: all 0.3s ease;
}

.prayer-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.current-prayer {
    border: 2px solid #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    transform: scale(1.02);
}

/* أنماط الأزرار المحسنة */
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

/* أنماط التنقل */
.nav-link {
    color: #9ca3af;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* تحسينات الاستجابة للصفحات الجديدة */
@media (max-width: 768px) {
    .dhikr-card {
        padding: 1rem;
    }
    
    .story-card {
        padding: 1rem;
    }
    
    .prayer-card {
        padding: 1rem;
    }
    
    .counter {
        width: 35px;
        height: 35px;
        font-size: 0.875rem;
    }
}