/* Widget Container Styling */
selector .elementor-widget-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Left Alignment (Default) */
.audio-players-container {
    display: flex;
    justify-content: start;
}

/* Right Alignment when 'green' class is added */
.green {
    display: flex;
    justify-content: end;
}

/* General Audio Player Styles */
.audio-player {
    --highlight-color: #00e5c0;
    --background-color: #1E272D;
    --text-color: #c5c6c8;
    --played-percentage: 0;
    position: relative;
    background: var(--background-color);
    display: inline-flex;
    min-width: clamp(230px, 100%, 340px) !important; /* Adjust player width here */
    max-width: 100%;
    border-radius: 0 0.4rem 0.4rem 0.4rem;
    padding: 0.4rem 0.6rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    user-select: none;
}

.audio-player:before {
    position: absolute;
    content: "";
    top: 0px;
    left: -10px;
    width: 20px;
    height: 20px;
    background: var(--background-color);
    aspect-ratio: 1;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.audio-player + .audio-player {
    margin-top: 1rem;
}

.audio-player .player {
    flex: 1;
    display: flex;
}

.audio-player .player .btn-play {
    outline: none;
    appearance: none;
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0 1rem 0 0.4rem;
    position: relative;
    top: 2px;
}

.audio-player .player .btn-play:disabled {
    cursor: default;
}

.audio-player .player .btn-play .icon {
    display: none;
}

.audio-player .player .btn-play .icon-play {
    display: inline-block;
}

.audio-player.playing .player .btn-play .icon-play {
    display: none;
}

.audio-player.playing .player .btn-play .icon-pause {
    display: inline-block;
}

.audio-player.loading .player .btn-play .icon-loop {
    display: inline-block;
}

.audio-player.error .player .btn-play .icon-error {
    display: inline-block;
}

@keyframes load {
    to {
        transform: rotate(360deg);
    }
}

.audio-player.loading .player .btn-play,
.audio-player.error .player .btn-play {
    pointer-events: none;
}

.audio-player.loading .player .btn-play .icon-loop {
    display: inline-block;
    animation: load 1s linear infinite;
}

.audio-player .player .timeline {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 0.2rem;
}

.audio-player .player .timeline .line {
    --line-height: 0.24rem;
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
}

.audio-player .player .timeline .line:before {
    content: "";
    width: calc(var(--played-percentage) * 0.92);
    position: absolute;
    background: var(--highlight-color);
    height: var(--line-height);
    border-radius: calc(var(--line-height) / 2);
}

.audio-player .player .timeline .line input[type="range"] {
    flex: 1;
    all: unset;
    appearance: none;
    background-color: initial !important;
    border: none;
    outline: none;
    width: 92%;
    position: relative;
}

.audio-player .player .timeline .line input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    background: var(--highlight-color);
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    margin-top: calc(var(--line-height) * -1.4);
}

.audio-player .player .timeline .line input[type="range"]::-moz-range-thumb {
    appearance: none;
    background: var(--highlight-color);
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    margin-top: calc(var(--line-height) * -1.4);
}

.audio-player .player .timeline .line input[type="range"]::-ms-thumb {
    appearance: none;
    background: var(--highlight-color);
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    margin-top: calc(var(--line-height) * -1.4);
}

.audio-player .player .timeline .line input[type="range"]::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.2);
    height: var(--line-height);
    border-radius: calc(var(--line-height) / 2);
}

.audio-player .player .timeline .line input[type="range"]::-moz-range-track {
    background: rgba(255, 255, 255, 0.2);
    height: var(--line-height);
    border-radius: calc(var(--line-height) / 2);
}

.audio-player .player .timeline .line input[type="range"]::-ms-track {
    background: rgba(255, 255, 255, 0.2);
    height: var(--line-height);
    border-radius: calc(var(--line-height) / 2);
}

/* Data Container */
.audio-player .player .timeline .data {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--text-color);
    position: absolute;
    width: 100%;
    bottom: -1px;
}

/* Total Duration (Left Side) */
.audio-player .player .timeline .data .time {
    text-align: left;
}

/* Message Time (Right Side) */
.audio-player .player .timeline .data .message-time {
    text-align: right;
    margin-right: 15px;
}

/* Remove the ::after pseudo-element for message time */
.audio-player .line::after {
    content: "";
    /* Or remove this rule entirely */
}

.audio-player .user {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.audio-player .user img {
    border-radius: 50%;
    object-fit: cover;
    background: transparent !important;
}

.audio-player .user span {
    position: absolute;
    left: 0;
    bottom: 0;
    color: var(--highlight-color);
    transform: translateX(-50%);
    font-size: 1.6rem;
    text-shadow: -1px -1px 0 var(--background-color),
    1px -1px 0 var(--background-color),
    -1px 1px 0 var(--background-color),
    1px 1px 0 var(--background-color);
}

.mic-icon {
    position: absolute;
    overflow: visible;
    padding: 10px 0;
    left: -5px;
    bottom: -5px;
    width: 15px;
}

.green .audio-player {
    --highlight-color: #4FB2E5;
    --background-color: #035142;
    border-radius: 0.4rem 0 0.4rem 0.4rem;
    position: relative;
    flex-direction: row-reverse;
    gap: 1rem;
}

.green .audio-player:before {
    left: inherit;
    right: -10px;
    clip-path: polygon(0 0, 100% 0, 0% 100%);
}

.green .audio-player .user {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.green .mic-icon {
    left: inherit;
    right: -5px;
}

.green .speed-control {
    background: #093730 !important;
}

.green .audio-player .player .timeline .line input[type="range"] {
    width: 97% !important;
}

.green .audio-player .player .timeline .line:before {
    width: calc(var(--played-percentage) * 0.97);
}

.audio-player .speed-control {
    display: none;
    cursor: pointer;
    background: #171F24;
    padding: 4px 0;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
    width: 50px;
    position: relative;
    top: -1px;
}

.audio-player.playing .user img {
    display: none;
}

.audio-player.playing .speed-control {
    display: block;
}

/* Remove margin-bottom from the last audio player container */
selector .audio-players-container:last-child {
    margin-bottom: 0;
}