/* Best FM Player Styles */

/* Base styles */
.bestfm-player-wrapper {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
    --bestfm-ui-surface: var(--bestfm-player-bg, rgba(255, 255, 255, 0.035));
    --bestfm-ui-border: var(--bestfm-border-color, rgba(255, 255, 255, 0.09));
    --bestfm-ui-text: var(--bestfm-text-color, #ffffff);
    --bestfm-ui-muted: rgba(255, 255, 255, 0.65);
    --bestfm-ui-track: rgba(255, 255, 255, 0.18);
    --bestfm-ui-history-bg: var(--bestfm-history-bg, rgba(255, 255, 255, 0.04));
    --bestfm-ui-history-border: var(--bestfm-history-border, rgba(255, 255, 255, 0.07));
    --bestfm-ui-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
    --bestfm-ui-image-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 60px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.bestfm-player-container {
    width: 100%;
    max-width: 400px;
    min-height: unset;
    height: auto;
    max-height: unset;
    margin: 0 auto;
    padding: 32px 28px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bestfm-ui-surface);
    border: 1px solid var(--bestfm-ui-border);
    border-radius: 30px;
    box-shadow: var(--bestfm-ui-shadow);
    position: relative;
    overflow: hidden;
}

.bestfm-player-container,
.bestfm-player-container * {
    box-sizing: border-box;
}

/* Brand section */
.bestfm-player-brand {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.bestfm-player-brand-name {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--bestfm-ui-text);
    line-height: 1;
    text-shadow: none;
}

.bestfm-player-brand-live {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 30px;
    padding: 5px 13px 5px 10px;
}

.bestfm-player-brand-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--bestfm-live-badge-color, #ef4444);
    flex-shrink: 0;
    animation: bestfm-livepulse 1.6s ease-in-out infinite;
}

@keyframes bestfm-livepulse {
    0%   { opacity: 1; transform: scale(1);   box-shadow: 0 0 0 0   rgba(239, 68, 68, 0.7); }
    50%  { opacity: 0.9; transform: scale(1.25); box-shadow: 0 0 0 5px rgba(239, 68, 68, 0);   }
    100% { opacity: 1; transform: scale(1);   box-shadow: 0 0 0 0   rgba(239, 68, 68, 0.7); }
}

.bestfm-player-brand-live-text {
    font-size: 10px;
    font-weight: 800;
    color: var(--bestfm-live-badge-color, #ef4444);
    letter-spacing: 2px;
    text-transform: uppercase;
    line-height: 1;
}

/* Header/Album Art */
.bestfm-player-header {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.bestfm-player-image-wrapper {
    width: 210px;
    height: 210px;
    min-width: 210px;
    min-height: 210px;
    max-width: 210px;
    max-height: 210px;
    border-radius: 22px;
    overflow: hidden;
    margin: 0;
    box-shadow: var(--bestfm-ui-image-shadow);
    position: relative;
}

.bestfm-player-image-container {
    width: 100%;
    height: 100%;
    border-radius: 22px;
}

.bestfm-player-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #111827;
    border-radius: 22px;
    transition: background-image 0.7s ease;
}

/* Controls */
.bestfm-player-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bestfm-player-info {
    text-align: center;
    width: 100%;
    margin-bottom: 24px;
    padding: 0 8px;
}

.bestfm-player-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--bestfm-ui-text);
    letter-spacing: -0.3px;
    line-height: 1.3;
    margin-bottom: 6px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    display: block;
}

.bestfm-player-artist {
    font-size: 14px;
    font-weight: 400;
    color: var(--bestfm-ui-muted);
    line-height: 1.4;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    display: block;
}

.bestfm-player-actions {
    display: flex;
    align-items: stretch;
    width: 100%;
    margin-bottom: 28px;
}

.bestfm-player-actions-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 12px;
    border-radius: 22px;
    background: color-mix(in srgb, var(--bestfm-ui-surface) 86%, transparent);
    border: 1px solid color-mix(in srgb, var(--bestfm-ui-border) 80%, transparent);
}

.bestfm-player-container {
    padding-bottom: calc(36px + var(--bestfm-history-slot, 320px));
}

/* Player Control */
.bestfm-player-control {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bestfm-play-btn,
.bestfm-stop-btn,
.bestfm-loading-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    cursor: pointer;
}

.bestfm-play-btn {
    background: var(--bestfm-accent-color, #e53e3e);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.bestfm-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

.bestfm-stop-btn {
    background: var(--bestfm-secondary-color, #2b44b0);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
    display: none;
}

.bestfm-stop-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 14px 38px rgba(27, 46, 131, 0.75);
}

.bestfm-loading-btn {
    background: rgba(255, 255, 255, 0.07);
    box-shadow: none;
    display: none;
}

.bestfm-play-btn svg,
.bestfm-stop-btn svg,
.bestfm-loading-btn svg {
    width: 28px !important;
    height: 28px !important;
    color: #ffffff;
    fill: #ffffff;
}

.bestfm-play-btn svg {
    margin-left: 3px;
}

/* Volume Control */
.bestfm-volume-box {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    width: auto;
    max-width: none;
    min-width: 0;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
    padding: 14px 18px;
    margin: 0;
    min-height: 64px;
    box-shadow: none !important;
    filter: none !important;
}

.bestfm-volume-icon svg {
    color: #64748b;
    fill: #64748b;
}

.bestfm-volume-range {
    flex: 1;
    width: auto;
    display: flex;
    align-items: center;
}

.bestfm-player-wrapper .bestfm-volume-controller {
    width: 100%;
    height: 4px;
    -webkit-appearance: none !important;
    appearance: none !important;
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
    cursor: pointer;
    border: none !important;
    padding: 0;
    margin: 0;
    box-shadow: none !important;
    display: block;
    filter: none !important;
}

.bestfm-player-wrapper .bestfm-volume-controller:focus {
    outline: none;
}

.bestfm-player-wrapper .bestfm-volume-controller::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: transparent !important;
    overflow: visible;
    border: none;
    box-shadow: none;
}

.bestfm-player-wrapper .bestfm-volume-controller::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bestfm-volume-color, #e53e3e) !important;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.18), 0 0 12px rgba(239, 68, 68, 0.75);
    border: none !important;
}

.bestfm-player-wrapper .bestfm-volume-controller::-moz-range-track {
    height: 4px;
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
    border: none;
    box-shadow: none;
}

.bestfm-player-wrapper .bestfm-volume-controller::-moz-range-progress {
    height: 4px;
    background: rgba(15, 23, 42, 0.78);
    border-radius: 999px;
    border: none;
}

.bestfm-player-wrapper .bestfm-volume-controller::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none !important;
    border-radius: 50%;
    background: var(--bestfm-volume-color, #e53e3e) !important;
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.18), 0 0 12px rgba(239, 68, 68, 0.75);
    cursor: pointer;
}

.bestfm-player-wrapper .bestfm-volume-controller::-moz-focus-outer {
    border: 0;
}

/* History */
.bestfm-player-history {
    width: auto;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 22px;
    padding: 12px 14px 14px;
    text-align: left;
    max-height: var(--bestfm-history-height-collapsed, 320px);
    transition: max-height 260ms ease, box-shadow 260ms ease;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: 22px;
    overflow: hidden;
    z-index: 3;
    --bestfm-history-text: #0f172a;
    --bestfm-history-muted: rgba(15, 23, 42, 0.66);
    --bestfm-history-item-bg: #f8fafc;
    --bestfm-history-item-border: rgba(15, 23, 42, 0.10);
    --bestfm-history-item-hover: #eef2ff;
}

.bestfm-player-history.is-expanded {
    max-height: var(--bestfm-history-height-expanded, 520px);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}

.bestfm-player-history-toggle-row {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: -4px;
    margin-bottom: 10px;
}

.bestfm-history-toggle {
    width: 72px;
    height: 30px;
    border-radius: 999px;
    border: none;
    background: var(--bestfm-secondary-color, #2b44b0);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.14);
}

.bestfm-history-toggle:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.18);
}

.bestfm-history-toggle .bestfm-icon-up,
.bestfm-history-toggle .bestfm-icon-down {
    display: block;
}

.bestfm-history-toggle .bestfm-icon-down {
    display: none;
}

.bestfm-history-toggle[aria-expanded="true"] .bestfm-icon-up {
    display: none;
}

.bestfm-history-toggle[aria-expanded="true"] .bestfm-icon-down {
    display: block;
}

.bestfm-player-history-caption-container {
    margin-bottom: 16px;
    text-align: center;
}

.bestfm-player-history-caption {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(15, 23, 42, 0.55);
    background-color: transparent;
    padding: 0;
    height: auto;
    line-height: 1;
}

.bestfm-player-history-list-wrapper,
.bestfm-player-history-list-container,
.bestfm-player-history-list {
    height: auto;
    overflow: hidden;
}

.bestfm-player-history-list {
    overflow: hidden;
    padding-right: 0;
}

.bestfm-player-history.is-expanded .bestfm-player-history-list {
    overflow: auto;
    padding-right: 2px;
}

.bestfm-player-history-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: block;
    height: auto;
    overflow: visible;
}

.bestfm-player-history-list ul > :not(li) {
    display: none;
    height: 0;
    width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    visibility: hidden;
}

.bestfm-player-history-list li {
    height: auto;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--bestfm-history-item-bg);
    border: 1px solid var(--bestfm-history-item-border);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    margin-bottom: 8px;
}

.bestfm-player-history-list li:last-child {
    margin-bottom: 0;
}

.bestfm-player-history-list li:hover {
    background: var(--bestfm-history-item-hover);
    border-color: rgba(15, 23, 42, 0.16);
    transform: translateY(-1px);
}

.bestfm-player-history-album {
    display: block;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    background-color: #111827;
    border: 1px solid color-mix(in srgb, var(--bestfm-ui-border) 90%, transparent);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}

.bestfm-player-history-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    min-width: 0;
}

.bestfm-player-history-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--bestfm-history-text);
    line-height: 1.35;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.bestfm-player-history-artist {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--bestfm-history-muted);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.bestfm-player-history-list-loading {
    display: none !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: color-mix(in srgb, var(--bestfm-ui-muted) 65%, transparent);
    font-size: 22px;
    padding: 24px 0;
    line-height: 1;
    height: auto;
}

.bestfm-player-history-list ul:empty + .bestfm-player-history-list-loading {
    display: none !important;
}

/* Spinner */
.bestfm-spinner {
    display: inline-block;
    width: 26px;
    height: 26px;
    border: 3px solid color-mix(in srgb, var(--bestfm-ui-muted) 40%, transparent);
    border-top-color: color-mix(in srgb, var(--bestfm-ui-text) 85%, transparent);
    border-radius: 50%;
    animation: bestfm-spin 0.75s linear infinite;
    flex-shrink: 0;
}

.bestfm-spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
    border-top-color: color-mix(in srgb, var(--bestfm-ui-text) 55%, transparent);
}

@keyframes bestfm-spin {
    to { transform: rotate(360deg); }
}

/* Player states */
.bestfm-player-control.playing .bestfm-play-btn {
    display: none;
}

.bestfm-player-control.playing .bestfm-stop-btn {
    display: flex;
}

.bestfm-player-control.loading .bestfm-play-btn,
.bestfm-player-control.loading .bestfm-stop-btn {
    display: none;
}

.bestfm-player-control.loading .bestfm-loading-btn {
    display: flex;
}

/* Responsive */
@media (max-width: 480px) {
    .bestfm-player-container {
        padding: 24px 20px calc(30px + var(--bestfm-history-slot, 320px));
        border-radius: 24px;
    }

    .bestfm-player-history {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
    
    .bestfm-player-image-wrapper {
        width: 175px;
        height: 175px;
        min-width: 175px;
        min-height: 175px;
        max-width: 175px;
        max-height: 175px;
    }
    
    .bestfm-player-title {
        font-size: 19px;
    }
    
    .bestfm-player-brand-name {
        font-size: 17px;
        letter-spacing: 3px;
    }
}

.bestfm-elementor-launcher {
    width: 100%;
    max-width: 520px;
    min-height: 74px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--bestfm-launcher-bg, rgba(8, 12, 24, 0.92));
    border: 1px solid var(--bestfm-launcher-border, rgba(255, 255, 255, 0.12));
    color: var(--bestfm-launcher-text, #ffffff);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.bestfm-elementor-launcher-livebar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    line-height: 1;
    opacity: 0.92;
}

.bestfm-elementor-launcher-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--bestfm-live-badge-color, #ef4444);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65);
    animation: bestfm-launcher-livepulse 1.6s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes bestfm-launcher-livepulse {
    0%   { opacity: 1; transform: scale(1);   box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65); }
    50%  { opacity: 0.92; transform: scale(1.25); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { opacity: 1; transform: scale(1);   box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65); }
}

.bestfm-elementor-launcher-live-text {
    color: var(--bestfm-live-badge-color, #ef4444);
}

.bestfm-elementor-launcher-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.bestfm-elementor-launcher:focus {
    outline: none;
}

.bestfm-elementor-launcher:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--bestfm-secondary-color, #2b44b0) 60%, transparent);
    outline-offset: 2px;
}

.bestfm-elementor-launcher-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.bestfm-elementor-launcher-play {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #ef4444;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.bestfm-elementor-launcher-play svg {
    margin-left: 2px;
}

.bestfm-elementor-launcher-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bestfm-elementor-launcher-artist {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bestfm-elementor-launcher-track {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    opacity: 0.82;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bestfm-elementor-launcher-right {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.bestfm-elementor-launcher-art {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #111827;
}
