/*
============================================
المتغيرات العامة
============================================
*/
:root {
    --primary-color: #7209b7;       /* اللون الأساسي (بنفسجي غامق) */
    --secondary-color: #3a0ca3;     /* اللون الثانوي (أزرق غامق) */
    --accent-color: #f72585;       /* لون التمييز (زهري) */
    --dark-color: #161a1d;          /* لون الخلفية الداكنة */
    --light-color: #f8f9fa;        /* لون النص الفاتح */
    --gray-color: #6c757d;         /* اللون الرمادي */
    --success-color: #4cc9f0;      /* لون النجاح (أزرق فاتح) */
}

/*
============================================
إعادة تعيين وإعدادات عامة
============================================
*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;         /* نموذج الصندوق الحديث */
    font-family: 'Tajawal', sans-serif; /* خط النص الأساسي */
}

/*
============================================
أنماط الجسم الرئيسي
============================================
*/
body {
    background: linear-gradient(135deg, #000000, #3a0ca3, #7209b7);
    color: var(--light-color);
    min-height: 100vh;              /* الحد الأدنى لارتفاع الصفحة */
    display: flex;
    justify-content: center;        /* توسيط أفقي */
    align-items: center;            /* توسيط عمودي */
    transition: background 0.5s ease, color 0.5s ease;
}

body.light-mode {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef, #dee2e6);
    color: #333;
}

/*
============================================
الحاوية الرئيسية
============================================
*/
.container {
    width: 100%;
    max-width: 500px;               /* أقصى عرض للحاوية */
    padding: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);  /* خلفية شبه شفافة */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;            /* زوايا مدورة */
    backdrop-filter: blur(10px);    /* تأثير ضبابي */
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    margin: 20px;
    transition: all 0.5s ease;
}

.light-mode .container {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/*
============================================
رأس الصفحة
============================================
*/
header {
    margin-bottom: 30px;
    position: relative;
}

/* شعار التطبيق */
.logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;             /* شكل دائري */
    object-fit: cover;              /* ضبط حجم الصورة */
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 5px;
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease; /* تأثير حركي سلس */
    margin-bottom: 15px;
}

.light-mode .logo {
    border: 2px solid rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.05);
}

.logo:hover {
    transform: scale(1.05);         /* تكبير بسيط عند التحويم */
}

/*
============================================
زر الإعدادات
============================================
*/
.settings-btn {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
    border: none;
    color: var(--light-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.light-mode .settings-btn {
    color: #333;
}

.settings-btn:hover {
    transform: rotate(30deg);
}

/*
============================================
نافذة الإعدادات
============================================
*/
.settings-modal {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    width: 300px;
    z-index: 1000;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.light-mode .settings-modal {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.light-mode .settings-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.settings-title {
    font-size: 1.3rem;
    font-weight: bold;
}

.close-settings {
    background: none;
    border: none;
    color: var(--light-color);
    font-size: 1.5rem;
    cursor: pointer;
}

.light-mode .close-settings {
    color: #333;
}

.settings-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.settings-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.light-mode .settings-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

.option-label {
    font-size: 1rem;
    transition: all 0.3s ease;
}

/* تحسين زر تبديل الوضع */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 70px;
    height: 34px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, #3a0ca3, #7209b7);
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

.light-mode .slider {
    background: linear-gradient(to right, #f72585, #ff9e7d);
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
}

input:checked + .slider:before {
    transform: translateX(36px);
}

.slider .sun, .slider .moon {
    font-size: 18px;
    transition: opacity 0.3s ease;
}

.slider .sun {
    opacity: 1;
}

.slider .moon {
    opacity: 0.5;
}

input:checked + .slider .sun {
    opacity: 0.5;
}

input:checked + .slider .moon {
    opacity: 1;
}

/* تأثير عند التحويم */
.theme-switch:hover .slider {
    box-shadow: 0 0 10px rgba(247, 37, 133, 0.7);
}

.light-mode .theme-switch:hover .slider {
    box-shadow: 0 0 10px rgba(58, 12, 163, 0.7);
}

/*
============================================
روابط التنقل
============================================
*/
.nav-links {
    margin-top: 15px;
    display: flex;
    justify-content: center;        /* توسيط الروابط */
    gap: 30px;                     /* المسافة بين الروابط */
}

.nav-links a {
    text-decoration: none;
    color: var(--light-color);
    font-weight: bold;
    font-size: 1rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.light-mode .nav-links a {
    color: #333;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: gold;                    /* لون ذهبي عند التحويم */
}

.light-mode .nav-links a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}


/*
============================================
أنماط نافذة الترحيب
============================================
*/
.welcome-modal {
    display: none; /* يتم التحكم به بواسطة JavaScript */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

.modal-content {
    background: linear-gradient(135deg, #8A2BE2, #4B0082);
    color: white;
    width: 90%;
    max-width: 500px;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 25px rgba(0,0,0,0.4);
}

.welcome-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    object-fit: contain;
    animation: pulse 2s infinite; /* استخدام نفس تأثير النبض المعرف لاحقاً */
}

.welcome-title {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: gold;
}

.welcome-text {
    line-height: 1.8;
    margin-bottom: 25px;
}

.start-btn {
    background-color: gold;
    color: #4B0082;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}


/*
============================================
قسم التسجيل
============================================
*/
.recorder-container {
    margin: 30px 0;
    display: flex;
    flex-direction: column;         /* ترتيب العناصر عمودياً */
    align-items: center;            /* توسيط أفقي */
}

/* زر التسجيل */
.record-button {
    background: linear-gradient(135deg, #a259ff, #c77dff);
    color: white;
    border: 3px solid gold;         /* حدود ذهبية */
    width: 120px;
    height: 120px;
    border-radius: 50%;             /* شكل دائري */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow:
        0 0 10px #a259ff,
        0 0 20px #a259ff,
        0 0 30px #c77dff,
        0 0 40px #c77dff,
        0 0 15px gold;
}

.light-mode .record-button {
    box-shadow:
        0 0 10px rgba(162, 89, 255, 0.7),
        0 0 20px rgba(162, 89, 255, 0.5),
        0 0 30px rgba(199, 125, 255, 0.4),
        0 0 40px rgba(199, 125, 255, 0.3),
        0 0 15px rgba(255, 215, 0, 0.5);
}

.record-button:hover {
    transform: translateY(-3px);    /* تأثير رفع عند التحويم */
    box-shadow:
        0 0 15px #a259ff,
        0 0 25px #a259ff,
        0 0 35px #c77dff,
        0 0 50px #c77dff,
        0 0 25px gold;
}

.light-mode .record-button:hover {
    box-shadow:
        0 0 15px rgba(162, 89, 255, 0.8),
        0 0 25px rgba(162, 89, 255, 0.6),
        0 0 35px rgba(199, 125, 255, 0.5),
        0 0 50px rgba(199, 125, 255, 0.4),
        0 0 25px rgba(255, 215, 0, 0.6);
}


/* أيقونة الميكروفون */
.mic-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    color: white;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mic-icon::before {
    content: "";
    position: absolute;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    z-index: -1;
}

/* نص الزر */
.record-text {
    font-size: 1.1rem;
    font-weight: bold;
    margin-top: 5px;
}

/* مؤشر التسجيل */
.recording-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* حلقات النبض */
.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    animation: pulse 2s infinite;    /* تأثير النبض */
    opacity: 0;
}

.pulse-ring.delay {
    animation-delay: 1s;            /* تأخير للحلقة الثانية */
}

/* العداد الزمني */
.timer {
    margin-top: 20px;
    font-size: 1.2rem;
    color: var(--gray-color);
}

/*
============================================
قسم النتائج
============================================
*/
.result-container {
    margin-top: 30px;
    width: 100%;
    animation: fadeIn 0.5s ease;    /* تأثير الظهور */
}

/* بطاقة الأغنية */
.song-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;                      /* المسافة بين العناصر */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.light-mode .song-card {
    background: rgba(0, 0, 0, 0.05);
}

/* غلاف الأغنية */
.song-cover {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* تفاصيل الأغنية */
.song-details {
    text-align: right;              /* محاذاة للنص العربي */
    flex: 1;                       /* توسيع لملء المساحة المتبقية */
}

.song-title {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: white;
}

.light-mode .song-title {
    color: #333;
}

.song-artist {
    font-size: 1rem;
    color: var(--gray-color);
}

/* أزرار النتائج */
.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

/* زر حفظ الأغنية في المكتبة */
.save-to-library {
    background: linear-gradient(135deg, #4cc9f0, #4895ef);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
}

.save-to-library:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.light-mode .save-to-library {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* زر تشغيل الأغنية */
.play-song {
    background: linear-gradient(135deg, #f72585, #ff7096);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* أنماط جديدة لتحسين زر التشغيل */
.play-content, .loading-spinner {
    transition: opacity 0.3s ease;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0; /* مخفي بشكل افتراضي */
}

.loading-spinner.hidden {
    display: none; /* يتم إخفاؤه تمامًا عندما لا يكون قيد الاستخدام */
}

.play-content.hidden {
    opacity: 0; /* يخفي المحتوى عند إظهار spinner */
}

.play-song {
    position: relative;
    overflow: hidden;
}

.play-song .loading-spinner {
    font-size: 1rem;
}

/* تحسين مظهر الأيقونات */
.play-icon, .pause-icon {
    transition: all 0.3s ease;
}

.play-icon {
    display: inline-block; /* يظهر أيقونة التشغيل افتراضياً */
}

.pause-icon {
    display: none; /* يخفي أيقونة الإيقاف مؤقتاً افتراضياً */
}

.play-song.playing .play-icon {
    display: none; /* يخفي أيقونة التشغيل عند التشغيل */
}

.play-song.playing .pause-icon {
    display: inline-block; /* يظهر أيقونة الإيقاف مؤقتاً عند التشغيل */
}


.play-song:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.light-mode .play-song {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* عنصر الصوت */
#songPreview {
    display: none; /* يتم التحكم به بواسطة JavaScript */
}


/*
============================================
الإشعارات
============================================
*/
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--dark-color);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--accent-color);
    animation: slideIn 0.3s ease;   /* تأثير الانزلاق */
    display: flex;
    align-items: center;
    gap: 10px;
}

.light-mode .notification {
    background: #f8f9fa;
    color: #333;
    border-left: 4px solid #f72585;
}

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

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}


/*
============================================
فئات مساعدة
============================================
*/
.hidden {
    display: none;                  /* لإخفاء العناصر */
}
