/* استایل‌های اصلی پلیر */
.emp-player-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    margin: 0 auto;
    text-align: center;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.emp-player-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

/* استایل دیسک و اکولایزر - بازنویسی کامل */
.emp-disc-container {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    position: relative;
    padding: 40px;
    box-sizing: border-box;
}

.emp-disc {
    width: 100%;
    max-width: 250px;
    aspect-ratio: 1;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    background: #333;
    z-index: 3;
    margin: 0 auto;
}

.emp-disc-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Canvas اکولایزر - موقعیت دقیق */
.emp-equalizer-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    display: none;
    border-radius: 50%;
}

.emp-equalizer-canvas.active {
    opacity: 1;
    display: block;
}

/* مخفی کردن اکولایزر هنگام loading */
.emp-player-container.loading .emp-equalizer-canvas {
    opacity: 0 !important;
    display: none !important;
}

/* انیمیشن چرخش دیسک - بدون تداخل با اکولایزر */
@keyframes rotate-disc {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.emp-disc.playing {
    animation: rotate-disc 5s linear infinite;
}

/* اطلاعات پلیر */
.emp-player-info {
    width: 100%;
    color: #fff;
    text-align: center;
    padding: 0 10px;
    position: relative;
    z-index: 4;
}

.emp-track-title {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: bold;
    margin: 0 0 5px 0;
    word-wrap: break-word;
    line-height: 1.3;
}

.emp-track-artist {
    font-size: clamp(14px, 3vw, 16px);
    opacity: 0.8;
    margin: 0 0 20px 0;
    line-height: 1.2;
}

/* نوار پیشرفت */
.emp-progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 20px;
    padding: 0 10px;
    box-sizing: border-box;
    direction: ltr;
    z-index: 4;
    position: relative;
}

.emp-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    direction: ltr;
    touch-action: pan-x;
    -webkit-tap-highlight-color: transparent;
}

.emp-progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 3px;
    width: 0;
    transition: width 0.1s ease;
    transform-origin: left center;
    direction: ltr;
}

.emp-current-time,
.emp-duration {
    font-size: clamp(11px, 2vw, 12px);
    min-width: 40px;
    color: #fff;
    font-family: 'Courier New', monospace;
}

/* کنترل‌ها */
.emp-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(10px, 3vw, 20px);
    width: 100%;
    flex-wrap: wrap;
    z-index: 4;
    position: relative;
}

.emp-controls button {
    background: none;
    border: none;
    color: #fff;
    font-size: clamp(24px, 5vw, 30px);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.emp-controls button:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
}

.emp-controls button:active {
    transform: scale(0.95);
}

.emp-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* نمایش آیکون‌های Play/Pause */
.emp-play-pause svg {
    width: 60px !important;
    height: 60px !important;
}

.emp-play-pause .emp-pause-icon {
    display: none;
}

.emp-play-pause.playing .emp-play-icon {
    display: none;
}

.emp-play-pause.playing .emp-pause-icon {
    display: block;
}

/* کنترل صدا */
.emp-volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    width: 100%;
    margin-top: 15px;
    padding: 0 10px;
    z-index: 4;
    position: relative;
}

.emp-volume {
    width: clamp(80px, 20vw, 100px);
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    touch-action: pan-x;
}

.emp-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.emp-volume::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* دکمه‌های active */
.emp-shuffle.active,
.emp-repeat.active {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.2);
}

/* لیست پخش */
.emp-playlist {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: clamp(15px, 3vw, 20px);
    margin-top: 20px;
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
    z-index: 4;
    position: relative;
}

.emp-playlist h4 {
    color: #fff;
    margin: 0 0 15px 0;
    font-size: clamp(16px, 3vw, 18px);
    text-align: center;
}

.emp-playlist-items {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.emp-playlist-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.emp-playlist-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.emp-playlist-item.active {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.emp-playlist-thumb {
    width: clamp(40px, 10vw, 50px);
    height: clamp(40px, 10vw, 50px);
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
}

.emp-playlist-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.emp-playlist-title {
    color: #fff;
    font-weight: 500;
    font-size: clamp(13px, 2.5vw, 16px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emp-playlist-artist {
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(12px, 2vw, 14px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emp-playlist-duration {
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(12px, 2vw, 14px);
    flex-shrink: 0;
    font-family: 'Courier New', monospace;
}

/* اسکرول بار سفارشی */
.emp-playlist-items::-webkit-scrollbar {
    width: 6px;
}

.emp-playlist-items::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.emp-playlist-items::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.emp-playlist-items::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* SVG Icons styling */
.emp-controls button svg {
    width: clamp(20px, 4vw, 24px);
    height: clamp(20px, 4vw, 24px);
    fill: currentColor;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.emp-volume-container svg {
    width: clamp(18px, 3vw, 20px);
    height: clamp(18px, 3vw, 20px);
    fill: currentColor;
    vertical-align: middle;
}

/* استایل‌های ویجت گروه‌های موسیقی */
.emp-groups-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    z-index: 4;
    position: relative;
}

.emp-groups-container.emp-layout-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
}

.emp-groups-container.emp-layout-vertical {
    flex-direction: column;
}

.emp-group-button {
    padding: 12px 24px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    outline: none;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.emp-group-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.emp-group-button.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* وضعیت بارگذاری - بهبود یافته */
.emp-loading-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 120px;
    text-align: center;
}

.emp-loading-status.active {
    display: flex !important;
    opacity: 1;
}

.emp-loading-text {
    color: #fff;
    font-size: 14px;
    margin-bottom: 0;
    margin-left: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: nowrap;
}

/* انیمیشن اسپینر - بهبود یافته */
.emp-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: emp-spin 1s linear infinite;
    flex-shrink: 0;
}

@keyframes emp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* حالت loading کانتینر */
.emp-player-container.loading .emp-controls,
.emp-player-container.loading .emp-progress-container {
    opacity: 0.5;
    pointer-events: none;
}

.emp-player-container.loading .emp-disc {
    opacity: 0.7;
}

/* ریسپانسیو موبایل - 480px به پایین */
@media (max-width: 480px) {
    .emp-player-container {
        padding: 20px 15px;
        border-radius: 15px;
        margin: 10px 0;
    }

    .emp-player-main {
        gap: 15px;
    }

    /* دیسک و اکولایزر در موبایل */
    .emp-disc-container {
        max-width: 260px;
        padding: 30px;
    }

    .emp-disc {
        max-width: 200px;
    }

    /* اطلاعات آهنگ */
    .emp-player-info {
        padding: 0 5px;
    }

    .emp-track-title {
        font-size: 18px;
        line-height: 1.3;
        margin-bottom: 8px;
    }

    .emp-track-artist {
        font-size: 14px;
        margin-bottom: 18px;
    }

    /* نوار پیشرفت - بهبود touch */
    .emp-progress-container {
        padding: 0 5px;
        gap: 8px;
        margin-bottom: 18px;
    }

    .emp-progress-bar {
        height: 8px;
        border-radius: 4px;
        padding: 4px 0;
        margin: -4px 0;
    }

    .emp-progress-fill {
        border-radius: 4px;
    }

    .emp-current-time,
    .emp-duration {
        font-size: 12px;
        min-width: 38px;
    }

    /* کنترل‌ها - بهبود touch */
    .emp-controls {
        gap: 12px;
        margin-bottom: 15px;
        padding: 5px 0;
    }

    .emp-controls button {
        padding: 12px;
        min-width: 44px;
        min-height: 44px;
    }

    /* آیکون پلی/پاز در موبایل */
    .emp-play-pause svg {
        width: 45px !important;
        height: 45px !important;
    }

    /* سایر آیکون‌ها */
    .emp-controls button svg {
        width: 22px;
        height: 22px;
    }

    /* کنترل صدا */
    .emp-volume-container {
        margin-top: 12px;
        gap: 10px;
        padding: 0 5px;
    }

    .emp-volume {
        width: 100px;
        height: 6px;
        padding: 4px 0;
        margin: -4px 0;
    }

    .emp-volume::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
    }

    .emp-volume-container svg {
        width: 20px;
        height: 20px;
    }

    /* لیست پخش */
    .emp-playlist {
        padding: 15px;
        margin-top: 18px;
        border-radius: 12px;
    }

    .emp-playlist h4 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .emp-playlist-items {
        max-height: 250px;
    }

    .emp-playlist-item {
        padding: 12px 8px;
        gap: 12px;
        min-height: 60px;
    }

    .emp-playlist-thumb {
        width: 45px;
        height: 45px;
    }

    .emp-playlist-title {
        font-size: 14px;
        line-height: 1.3;
    }

    .emp-playlist-artist,
    .emp-playlist-duration {
        font-size: 12px;
    }

    /* اسکرول بار نازک‌تر */
    .emp-playlist-items::-webkit-scrollbar {
        width: 4px;
    }

    /* گروه‌های موسیقی در موبایل */
    .emp-groups-container.emp-layout-horizontal {
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        gap: 8px;
    }

    .emp-group-button {
        flex-shrink: 0;
        padding: 10px 16px;
        font-size: 13px;
        min-height: 44px;
    }

    /* Loading در موبایل - بهبود یافته */
    .emp-loading-status {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        z-index: 9999 !important;
        background: rgba(0, 0, 0, 0.9);
        padding: 20px 25px;
        border-radius: 15px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
        min-width: 140px;
        backdrop-filter: blur(20px);
    }

    .emp-loading-text {
        font-size: 15px;
        margin-left: 12px;
    }

    .emp-loading-spinner {
        width: 22px;
        height: 22px;
    }

    .emp-player-container.loading {
        pointer-events: none;
    }
}

/* موبایل‌های خیلی کوچک - کمتر از 360px */
@media (max-width: 360px) {
    .emp-player-container {
        padding: 15px 12px;
    }

    .emp-disc-container {
        max-width: 220px;
        padding: 25px;
    }

    .emp-disc {
        max-width: 170px;
    }

    .emp-track-title {
        font-size: 16px;
    }

    .emp-track-artist {
        font-size: 13px;
    }

    .emp-play-pause svg {
        width: 40px !important;
        height: 40px !important;
    }

    .emp-controls {
        gap: 8px;
    }

    .emp-controls button {
        padding: 10px;
        min-width: 40px;
        min-height: 40px;
    }

    .emp-controls button svg {
        width: 20px;
        height: 20px;
    }

    .emp-volume {
        width: 80px;
    }

    .emp-playlist {
        padding: 12px;
    }

    .emp-playlist-thumb {
        width: 40px;
        height: 40px;
    }

    .emp-playlist-item {
        min-height: 56px;
        padding: 10px 6px;
    }
}

/* موبایل افقی (Landscape) - بهبود یافته */
@media (max-width: 768px) and (orientation: landscape) {
    .emp-player-container {
        padding: 15px 20px;
    }

    .emp-player-main {
        flex-direction: row;
        gap: 25px;
        align-items: flex-start;
    }

    .emp-disc-container {
        max-width: 200px;
        flex-shrink: 0;
        padding: 20px;
    }

    .emp-disc {
        max-width: 160px;
    }

    .emp-player-info {
        text-align: left;
        flex: 1;
        padding: 0;
    }

    .emp-controls {
        justify-content: flex-start;
        gap: 15px;
    }

    .emp-playlist-items {
        max-height: 120px;
    }

    /* Loading در landscape */
    .emp-loading-status {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        z-index: 9999 !important;
    }
}

/* رفع مشکل overflow در موبایل */
@media (max-width: 480px) {
    .elementor-widget-container {
        overflow: visible;
    }

    .emp-player-container {
        max-width: 100%;
        margin: 0;
        overflow: visible;
    }
}

/* بهبود برای دستگاه‌های با DPI بالا */
@media (max-width: 480px) and (-webkit-min-device-pixel-ratio: 2) {
    .emp-controls button {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    }

    .emp-playlist-item {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    }
}

/* تم تاریک اضافی */
.emp-player-container.emp-dark-mode .emp-loading-status {
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.emp-player-container.emp-dark-mode .emp-loading-text {
    color: #fff;
}

.emp-player-container.emp-dark-mode .emp-loading-spinner {
    border-color: transparent;
    border-top-color: #fff;
}

/* بهبود accessibility */
@media (prefers-reduced-motion: reduce) {
    .emp-disc.playing {
        animation: none;
    }

    .emp-loading-spinner {
        animation: none;
    }

    .emp-controls button {
        transition: none;
    }

    .emp-equalizer-canvas {
        display: none !important;
    }
}

/* حالت مخفی شدن کنترل‌ها هنگام loading */
.emp-player-container.loading .emp-controls button:not(.emp-play-pause) {
    opacity: 0.3;
}

.emp-player-container.loading .emp-progress-bar {
    pointer-events: none;
}

.emp-player-container.loading .emp-volume {
    pointer-events: none;
}
