* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lateef', serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    direction: rtl;
    position: relative;
    overflow-x: hidden;
    touch-action: pan-y;
    color: #fff;
}

.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.container {
    max-width: 800px;
    margin: 20px auto;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    margin-bottom: 120px; /* فضای بیشتر برای پلیر و کلیدها */
}

.header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 5px; /* فاصله کمتر برای نوار پیشرفت */
    position: relative;
}

.reciter-control {
    position: absolute;
    top: 10px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.reciter-label {
    font-size: 1.1em;
    color: #ffd700;
    margin: 0;
}

.reciter-control select {
    padding: 6px 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
    font-size: 0.9em;
    appearance: none;
    outline: none;
    padding-right: 25px;
    background: rgba(255, 255, 255, 0.1) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="%23ffd700"><path d="M7.41 8.59L12 4l-4.59 4.59zm-2.82 0L0 4l4.59 4.59z"/></svg>') no-repeat right 10px center;
    cursor: pointer;
    width: 200px;
}

.header h1 {
    font-family: 'Amiri', serif;
    font-size: 2.5em;
    margin-bottom: 5px;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 5px rgba(0, 0, 0, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 10px rgba(255, 255, 255, 0.6), 0 0 5px rgba(0, 0, 0, 0.5); }
    to { text-shadow: 0 0 20px rgba(255, 255, 255, 1), 0 0 10px rgba(0, 0, 0, 0.7); }
}

#quran-content {
    text-align: center;
    padding: 20px;
}

.surah-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.ayah-number {
    display: inline-block;
    font-size: 1.3em;
    background: #ffd700;
    color: #1e3c72;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

#surah-name {
    font-size: 1.8em;
    color: #ffd700;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

#ayah-text {
    font-size: 1.6em;
    color: #fff;
    margin-bottom: 15px;
    line-height: 1.5;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

#ayah-translation {
    font-size: 1.2em;
    color: #e0e0e0;
    margin-bottom: 20px;
    line-height: 1.5;
    font-style: italic;
}

#ayah-timer {
    font-size: 1.1em;
    color: #ffd700;
    margin-bottom: 20px;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px; /* فاصله بیشتر از دکمه‌های کنترل */
}

.auto-play-button, .auto-next-button, #next-ayah, .save-progress-button {
    padding: 10px 20px;
    font-size: 1.2em;
    background: #ffd700;
    color: #1e3c72;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.save-progress-button {
    background: #4caf50;
    color: #fff;
}

.auto-play-button:hover, .auto-next-button:hover, #next-ayah:hover {
    background: #ffeb3b;
    transform: translateY(-2px);
}

.save-progress-button:hover {
    background: #45a049;
    transform: translateY(-2px);
}

#next-ayah:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.custom-audio-player {
    margin: 20px 0;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
    border-radius: 15px;
    padding: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.custom-audio-player.bottom {
    position: fixed;
    bottom: 70px; /* فاصله بیشتر از دکمه‌های کنترل */
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 0;
    z-index: 1000;
    box-shadow: 0 -6px 15px rgba(0, 0, 0, 0.3);
}

.audio-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.audio-controls {
    position: fixed;
    bottom: 10px; /* پایین‌ترین نقطه صفحه */
    left: 0;
    right: 0;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 -6px 15px rgba(0, 0, 0, 0.3);
    padding: 10px;
    display: flex;
    justify-content: center;
    gap: 15px; /* فاصله بیشتر بین دکمه‌ها */
    z-index: 1001;
}

.audio-controls.hidden {
    display: none; /* مخفی کردن دکمه‌ها */
}

.control-btn {
    background: #ffd700;
    color: #1e3c72;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.control-btn:hover {
    background: #ffeb3b;
    transform: scale(1.1);
}

#volume-btn {
    margin-left: 10px;
}

#volume {
    width: 100px;
    accent-color: #ffd700;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    padding: 5px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
    min-width: 200px;
}

#current-time, #duration {
    font-size: 0.9em;
    color: #ffd700;
}

.progress-bar {
    flex-grow: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

#progress {
    height: 100%;
    background: #ffd700;
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

#progress::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: #ffd700;
    border-radius: 50%;
    box-shadow: 0 0 5px #ffd700;
}

#progress-section {
    margin-top: 5px;
    position: relative;
    overflow: visible; /* مطمئن شویم که لیبل خارج از محدوده قابل نمایش باشه */
}

.progress-bar-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    overflow: hidden;
    height: 5px; /* هم‌اندازه با progress-bar */
    position: relative;
}

#progress-bar {
    height: 5px; /* باریک‌تر کردن نوار پیشرفت ختم */
    background: #ffd700;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

#progress-label {
    position: absolute;
    top: -30px; /* بالاتر برای جلوگیری از تداخل */
    font-size: 0.8em;
    color: #fff;
    background: rgba(30, 60, 114, 0.9); /* پس‌زمینه تیره‌تر */
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
    transition: all 0.3s ease; /* انیمیشن برای تغییر موقعیت و اندازه */
    transform: translateX(-50%);
    right: 50%; /* شروع از وسط */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); /* سایه برای برجستگی */
    animation: pulse 1.5s infinite; /* انیمیشن پالس */
}

@keyframes pulse {
    0% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
    100% { transform: translateX(-50%) scale(1); }
}

#completion-percentage {
    display: none; /* دیگه نیازی به این نیست */
}

/* دکمه تنظیمات شناور */
.settings-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #ffd700;
    color: #1e3c72;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    font-size: 1.2em;
}

.settings-btn:hover {
    background: #ffeb3b;
    transform: scale(1.1);
}

/* پنل تنظیمات */
.settings-panel {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
    transition: left 0.3s ease;
    z-index: 1001;
    padding: 20px;
    color: #fff;
}

.settings-panel.open {
    left: 0;
}

.settings-content h2 {
    font-family: 'Amiri', serif;
    font-size: 1.8em;
    color: #ffd700;
    margin-bottom: 20px;
    text-align: center;
}

.settings-item {
    margin-bottom: 20px;
}

.settings-item label {
    display: block;
    font-size: 1.1em;
    color: #ffd700;
    margin-bottom: 5px;
}

.settings-item input[type="range"],
.settings-item input[type="color"],
.settings-item select {
    width: 100%;
    padding: 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffd700; /* تغییر رنگ متن برای خوانایی بهتر */
    appearance: none; /* حذف استایل پیش‌فرض مرورگر */
    outline: none; /* حذف حاشیه انتخاب */
}

.settings-item select {
    padding-right: 20px; /* فضای بیشتر برای فلش */
    background: rgba(255, 255, 255, 0.1) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="%23ffd700"><path d="M7.41 8.59L12 4l-4.59 4.59zm-2.82 0L0 4l4.59 4.59z"/></svg>') no-repeat right 10px center; /* فلش سفارشی */
}

.settings-item input[type="range"] {
    accent-color: #ffd700;
}

.settings-item input[type="checkbox"] {
    margin-right: 10px;
}

.settings-item span {
    margin-right: 10px;
    font-size: 0.9em;
    color: #ffd700;
}

.save-settings-btn {
    width: 100%;
    padding: 10px;
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.save-settings-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .reciter-control {
        position: static;
        margin: 10px auto;
        justify-content: center;
    }

    .reciter-control select {
        width: 180px;
        font-size: 0.8em;
    }

    .surah-header {
        flex-direction: column;
        gap: 5px;
    }

    #surah-name {
        font-size: 1.5em;
    }

    #ayah-text {
        font-size: 1.3em;
    }

    #ayah-translation {
        font-size: 1em;
    }

    .auto-play-button, .auto-next-button, #next-ayah, .save-progress-button, .control-btn {
        padding: 8px 15px;
        font-size: 1em;
        width: 35px;
        height: 35px;
    }

    .custom-audio-player {
        padding: 10px;
    }

    .custom-audio-player.bottom {
        padding: 5px;
        bottom: 60px; /* زیر نوار پیشرفت در موبایل */
    }

    .audio-controls {
        bottom: 10px; /* پایین‌ترین نقطه در موبایل */
        padding: 5px;
    }

    #volume {
        width: 80px;
    }

    #progress-bar {
        height: 4px; /* نازک‌تر برای موبایل */
    }

    .progress-bar-container {
        height: 4px; /* هم‌اندازه با progress-bar در موبایل */
    }

    #progress-label {
        font-size: 0.7em; /* کوچیک‌تر در موبایل */
        top: -25px; /* کمی بالاتر */
    }

    .settings-panel {
        width: 250px;
        left: -250px;
    }

    .settings-btn {
        width: 45px;
        height: 45px;
        font-size: 1em;
    }
}

.auto-next-button {
    padding: 10px 20px;
    font-size: 1.2em;
    background: #ccc; /* رنگ خاکستری برای حالت غیرفعال */
    color: #1e3c72;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.auto-next-button.active {
    background: #4caf50; /* رنگ سبز برای حالت فعال */
    color: #fff;
}

.auto-next-button:hover {
    background: #ffeb3b; /* رنگ هاور زرد که قبلاً داشتید */
    transform: translateY(-2px);
}

.auto-next-button.active:hover {
    background: #45a049; /* رنگ هاور تیره‌تر برای حالت سبز */
}