        /* مدیریت z-index به صورت منطقی */
        :root {
            --z-index-player: 50;
            --z-index-volume-wrapper: 60;
            --z-index-volume-toggle: 61;
            --z-index-volume-popup: 1000;
            --z-index-volume-content: 1001;
            --z-index-volume-overlay: 999;
            --z-index-progress-slider: 70;
        }

        .melody-player-wrapper {
            position: relative;
            overflow: visible !important;
            z-index: var(--z-index-player);
        }

        /* پلیر ساده شده */
        .melody-player {
            position: relative;
            overflow: visible;
            background: #ffffff;
            border-radius: 12px;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
            padding: 1.5rem;
            margin: 1.5rem 0;
            border: 1px solid #e2e8f0;
            z-index: var(--z-index-player);
        }

        .player-controls {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            direction: rtl;
            position: relative;
            overflow: visible;
            z-index: var(--z-index-player);
        }

        /* دکمه پلی در سمت چپ */
        .play-btn {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: linear-gradient(135deg, #00cc88, #0088cc);
            border: none;
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            flex-shrink: 0;
            font-size: 1.4rem;
            position: relative;
            overflow: hidden;
            box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
            order: 3; /* سمت چپ در RTL */
            z-index: calc(var(--z-index-player) + 1);
        }

        .play-btn:hover {
            transform: translateY(-2px) scale(1.05);
            box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
        }

        .play-btn.playing {
            background: linear-gradient(135deg, #0088cc, #00cc88);
        }

        /* اطلاعات پخش در وسط */
        .player-info {
            flex: 1;
            min-width: 0;
            order: 2;
            max-width: 100%;
            z-index: var(--z-index-player);
        }

        .track-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.75rem;
            flex-wrap: wrap;
            gap: 0.5rem;
        }

        .track-name {
            font-weight: 600;
            color: #2d3748;
            font-size: 1rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .track-duration {
            font-size: 0.875rem;
            color: #718096;
            font-variant-numeric: tabular-nums;
            flex-shrink: 0;
        }

        .progress-container {
            position: relative;
            margin-bottom: 0.5rem;
            direction: ltr;
            cursor: pointer;
            z-index: var(--z-index-player);
        }

        .waveform-visualization {
            height: 40px;
            margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
            gap: 2px;
            opacity: 0.7;
            transition: opacity 0.3s ease;
            direction: ltr;
            z-index: var(--z-index-player);
        }

        .wave-bar {
            flex: 1;
            background: linear-gradient(to top, #00cc88, #0088cc);
            border-radius: 2px;
            min-height: 3px;
            transition: all 0.2s ease;
        }

        .progress-bar {
            height: 4px;
            background: rgba(0, 136, 204, 0.2);
            border-radius: 2px;
            position: relative;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #00cc88, #0088cc);
            border-radius: 2px;
            width: 0%;
            transition: width 0.1s ease;
            position: relative;
        }

        .progress-slider {
            position: absolute;
            top: -6px;
            right: 0;
            width: 100%;
            height: 16px;
            opacity: 0;
            cursor: pointer;
            direction: ltr;
            z-index: var(--z-index-progress-slider);
        }

        .time-display {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.875rem;
            color: #718096;
            font-variant-numeric: tabular-nums;
            direction: ltr;
            justify-content: flex-start;
        }

        .time-separator {
            color: #cbd5e0;
        }

        /* کنترل صدا - مدیریت z-index منطقی */
        .volume-control-wrapper {
            position: relative;
            z-index: var(--z-index-volume-wrapper);
            order: 1; /* سمت راست در RTL */
        }

        .volume-toggle-btn {
            width: 50px;
            height: 50px;
            border-radius: 12px;
            background: rgba(0, 136, 204, 0.1);
            border: none;
            color: #0088cc;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 1.2rem;
            position: relative;
            z-index: var(--z-index-volume-toggle);
            flex-shrink: 0;
        }

        .volume-toggle-btn:hover {
            background: rgba(0, 136, 204, 0.2);
            transform: translateY(-2px);
        }

        /* پاپ‌آپ صدا - z-index منطقی */
        .volume-popup {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: none;
            align-items: center;
            justify-content: center;
            z-index: var(--z-index-volume-popup);
            padding: 1rem;
            pointer-events: none;
        }

        .volume-popup.active {
            display: flex;
            pointer-events: all;
        }

        .volume-popup-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: var(--z-index-volume-overlay);
            opacity: 0;
            transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .volume-popup.active .volume-popup-overlay {
            opacity: 1;
        }

        .volume-popup-content {
            background: white;
            border-radius: 16px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
            padding: 1.5rem;
            width: 100%;
            max-width: 320px;
            position: relative;
            transform: translateY(20px) scale(0.95);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            border: 1px solid #e2e8f0;
            z-index: var(--z-index-volume-content);
            opacity: 0;
        }

        .volume-popup.active .volume-popup-content {
            transform: translateY(0) scale(1);
            opacity: 1;
        }

        .volume-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            padding-bottom: 0.75rem;
            border-bottom: 1px solid #e2e8f0;
        }

        .volume-title {
            font-weight: 600;
            color: #2d3748;
            font-size: 1.1rem;
        }

        .volume-close-btn {
            background: #f7fafc;
            border: none;
            color: #718096;
            cursor: pointer;
            padding: 0.5rem;
            border-radius: 8px;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            font-size: 1rem;
        }

        .volume-close-btn:hover {
            background: #edf2f7;
            color: #2d3748;
        }

        .volume-indicator {
            text-align: center;
            margin: 1rem 0;
        }

        .volume-percent {
            font-weight: 700;
            font-size: 1.25rem;
            color: #0088cc;
            background: rgba(0, 136, 204, 0.1);
            padding: 0.6rem 1.25rem;
            border-radius: 25px;
            display: inline-block;
        }

        .volume-controls {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            direction: ltr;
            margin: 1.5rem 0;
        }

        .volume-step-btn {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            background: rgba(0, 136, 204, 0.1);
            border: none;
            color: #0088cc;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
            font-size: 1rem;
            flex-shrink: 0;
        }

        .volume-step-btn:hover {
            background: rgba(0, 136, 204, 0.2);
            transform: scale(1.1);
        }

        .volume-bar-container {
            flex: 1;
            position: relative;
            height: 40px;
            display: flex;
            align-items: center;
            direction: ltr;
        }

        .volume-bar {
            width: 100%;
            height: 8px;
            background: rgba(0, 136, 204, 0.15);
            border-radius: 4px;
            position: relative;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .volume-bar:hover {
            height: 10px;
        }

        .volume-fill {
            height: 100%;
            background: linear-gradient(90deg, #00cc88, #0088cc);
            border-radius: 4px;
            width: 80%;
            position: relative;
            transition: width 0.2s ease;
        }

        .volume-handle {
            width: 20px;
            height: 20px;
            background: #ffffff;
            border-radius: 50%;
            position: absolute;
            top: 50%;
            left: 80%;
            transform: translate(-50%, -50%);
            cursor: grab;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
            border: 2px solid #0088cc;
            transition: all 0.2s ease;
            z-index: 2;
        }

        .volume-handle:hover {
            transform: translate(-50%, -50%) scale(1.2);
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
        }

        .volume-handle:active {
            cursor: grabbing;
            transform: translate(-50%, -50%) scale(1.1);
        }

        .volume-slider-hidden {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0;
            cursor: pointer;
            z-index: 1;
        }

        .volume-presets {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.5rem;
            margin-top: 1rem;
            direction: rtl;
        }

        .volume-preset {
            padding: 0.75rem 0.5rem;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            background: white;
            color: #4a5568;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            font-size: 0.85rem;
        }

        .volume-preset:hover {
            background: #f7fafc;
            border-color: #cbd5e0;
        }

        .volume-preset.active {
            background: rgba(0, 136, 204, 0.1);
            border-color: #0088cc;
            color: #0088cc;
            font-weight: 600;
        }

        /* دسترسی‌پذیری */
        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }

        /* رسپانسیو برای موبایل */
        @media (max-width: 768px) {
            .melody-player {
                padding: 1.25rem;
                margin: 1rem 0;
                border-radius: 12px;
            }

            .player-controls {
                flex-direction: row;
                align-items: center;
                gap: 0.75rem;
                flex-wrap: nowrap;
            }

            .play-btn {
                width: 50px;
                height: 50px;
                font-size: 1.2rem;
                order: 3;
                flex-shrink: 0;
            }

            .player-info {
                order: 2;
                flex: 1;
                min-width: 0;
            }

            .volume-control-wrapper {
                order: 1;
                flex-shrink: 0;
            }

            .volume-toggle-btn {
                width: 45px;
                height: 45px;
                font-size: 1.1rem;
            }

            .volume-popup-content {
                max-width: 280px;
                padding: 1.25rem;
            }

            .volume-controls {
                margin: 1.25rem 0;
            }

            .track-info {
                flex-direction: column;
                align-items: flex-start;
                gap: 0.25rem;
                margin-bottom: 0.5rem;
            }

            .track-name {
                font-size: 0.9rem;
                width: 100%;
            }

            .track-duration {
                font-size: 0.8rem;
                align-self: flex-end;
            }

            .waveform-visualization {
                height: 30px;
                margin-bottom: 0.25rem;
            }

            .time-display {
                font-size: 0.8rem;
            }
        }

        @media (max-width: 480px) {
            .melody-player {
                padding: 1rem;
            }

            .player-controls {
                gap: 0.5rem;
            }

            .play-btn {
                width: 45px;
                height: 45px;
                font-size: 1rem;
            }

            .volume-toggle-btn {
                width: 40px;
                height: 40px;
                font-size: 1rem;
            }

            .volume-popup-content {
                max-width: 260px;
                padding: 1rem;
            }

            .volume-controls {
                margin: 1rem 0;
                gap: 0.6rem;
            }

            .volume-step-btn {
                width: 36px;
                height: 36px;
            }

            .volume-bar-container {
                height: 36px;
            }

            .volume-bar {
                height: 7px;
            }

            .volume-handle {
                width: 18px;
                height: 18px;
            }

            .volume-presets {
                gap: 0.4rem;
            }

            .volume-preset {
                padding: 0.6rem 0.4rem;
                font-size: 0.8rem;
            }

            .track-name {
                font-size: 0.85rem;
            }

            .waveform-visualization {
                height: 25px;
            }
        }

        /* برای صفحات بسیار کوچک */
        @media (max-width: 360px) {
            .player-controls {
                flex-wrap: wrap;
            }

            .player-info {
                order: 2;
                flex: 1 0 100%;
                margin-top: 0.75rem;
            }

            .play-btn {
                order: 3;
            }

            .volume-control-wrapper {
                order: 1;
            }

            .volume-popup-content {
                max-width: 240px;
                padding: 0.875rem;
            }

            .volume-header {
                margin-bottom: 0.75rem;
                padding-bottom: 0.5rem;
            }

            .volume-title {
                font-size: 1rem;
            }

            .volume-percent {
                font-size: 1.1rem;
                padding: 0.5rem 1rem;
            }

            .volume-controls {
                margin: 0.75rem 0;
            }
        }

        /* انیمیشن‌های پیشرفته */
        @keyframes wavePulse {
            0%, 100% { transform: scaleY(1); }
            50% { transform: scaleY(1.8); }
        }

        .wave-bar.animated {
            animation: wavePulse 0.6s ease-in-out infinite;
            animation-delay: calc(var(--index) * 0.1s);
        }

        /* بهبود عملکرد لمسی در موبایل */
        @media (hover: none) {
            .play-btn:hover,
            .volume-toggle-btn:hover,
            .volume-step-btn:hover {
                transform: none;
            }

            .play-btn:active,
            .volume-toggle-btn:active,
            .volume-step-btn:active {
                transform: scale(0.95);
            }
        }
