/* ============================================================
   OA Audio Player Widget
   ============================================================ */

.oa-audio-player {
	display:       flex;
	flex-direction: column;
	gap:           10px;
	padding:       16px 20px;
	background:    #1a1a2e;
	border-radius: 12px;
	font-family:   -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
	               'Helvetica Neue', Arial, sans-serif;
	user-select:   none;
}

/* ── Title ──────────────────────────────────────────────────── */

.oa-audio-title {
	font-size:   14px;
	font-weight: 600;
	color:       #fff;
	line-height: 1.3;
	white-space: nowrap;
	overflow:    hidden;
	text-overflow: ellipsis;
}

/* ── Controls row ───────────────────────────────────────────── */

.oa-audio-controls {
	display:     flex;
	align-items: center;
	gap:         12px;
}

/* ── Play / Pause button ────────────────────────────────────── */

.oa-audio-play-btn {
	flex-shrink: 0;
	width:       40px;
	height:      40px;
	border-radius: 50%;
	border:      none;
	background:  #fff;
	color:       #1a1a2e;
	cursor:      pointer;
	display:     flex;
	align-items: center;
	justify-content: center;
	padding:     0;
	transition:  background 0.15s, transform 0.1s, box-shadow 0.15s;
	box-shadow:  0 2px 8px rgba(0,0,0,0.25);
}

.oa-audio-play-btn:hover {
	background:  #f0f0f0;
	transform:   scale(1.07);
	box-shadow:  0 4px 14px rgba(0,0,0,0.3);
}

.oa-audio-play-btn:active {
	transform: scale(0.97);
}

.oa-audio-play-btn svg {
	width:  18px;
	height: 18px;
	display: block;
	flex-shrink: 0;
}

/* Pause icon hidden by default; shown when playing */
.oa-audio-play-btn .oa-icon-pause { display: none; }
.oa-audio-player.is-playing .oa-audio-play-btn .oa-icon-play  { display: none; }
.oa-audio-player.is-playing .oa-audio-play-btn .oa-icon-pause { display: block; }

/* ── Time display ───────────────────────────────────────────── */

.oa-audio-time {
	flex-shrink:  0;
	font-size:    12px;
	font-variant-numeric: tabular-nums;
	color:        rgba(255,255,255,0.75);
	white-space:  nowrap;
	min-width:    82px;
	text-align:   center;
	letter-spacing: 0.02em;
}

/* ── Progress bar ───────────────────────────────────────────── */

.oa-audio-progress {
	flex:         1;
	position:     relative;
	height:       4px;
	background:   rgba(255,255,255,0.2);
	border-radius: 999px;
	cursor:       pointer;
	/* Expand the click target without changing the visual */
	padding:      10px 0;
	margin:       -10px 0;
	box-sizing:   content-box;
}

.oa-audio-progress-track {
	position:     absolute;
	inset:        10px 0;
	background:   rgba(255,255,255,0.2);
	border-radius: 999px;
	overflow:     hidden;
}

.oa-audio-progress-fill {
	height:       100%;
	width:        0%;
	background:   #fff;
	border-radius: 999px;
	transition:   width 0.1s linear;
	pointer-events: none;
}

.oa-audio-progress-handle {
	position:     absolute;
	top:          50%;
	left:         0%;
	width:        12px;
	height:       12px;
	border-radius: 50%;
	background:   #fff;
	transform:    translate(-50%, -50%);
	box-shadow:   0 1px 4px rgba(0,0,0,0.4);
	pointer-events: none;
	opacity:      0;
	transition:   opacity 0.15s;
}

.oa-audio-progress:hover .oa-audio-progress-handle,
.oa-audio-progress.is-dragging .oa-audio-progress-handle {
	opacity: 1;
}

/* ── Volume section ─────────────────────────────────────────── */

/* ── Volume ─────────────────────────────────────────────────── */

.oa-audio-volume-wrap {
	flex-shrink: 0;
	display:     flex;
	align-items: center;
	gap:         8px;
}

.oa-audio-volume-btn {
	width:         32px;
	height:        32px;
	border:        none;
	background:    transparent;
	color:         rgba(255,255,255,0.75);
	cursor:        pointer;
	padding:       0;
	display:       flex;
	align-items:   center;
	justify-content: center;
	border-radius: 50%;
	transition:    color 0.15s, background 0.15s;
	flex-shrink:   0;
}

.oa-audio-volume-btn:hover {
	color:      #fff;
	background: rgba(255,255,255,0.1);
}

.oa-audio-volume-btn svg {
	width:   18px;
	height:  18px;
	display: block;
}

.oa-audio-volume-btn .oa-icon-muted { display: none; }
.oa-audio-player.is-muted .oa-audio-volume-btn .oa-icon-volume { display: none; }
.oa-audio-player.is-muted .oa-audio-volume-btn .oa-icon-muted  { display: block; }

/* ── Segmented bars ──────────────────────────────────────────── */

.oa-audio-vol-bars {
	display:     flex;
	align-items: flex-end;   /* bars grow upward from a shared baseline */
	gap:         3px;
	cursor:      pointer;
	padding:     6px 2px;    /* extra hit area top & bottom */
	margin:      -6px -2px;
	box-sizing:  content-box;
	flex-shrink: 0;
}

.oa-audio-vol-bar {
	display:       block;
	width:         4px;
	border-radius: 2px 2px 1px 1px;
	background:    rgba(255,255,255,0.2);
	transition:    background 0.1s, transform 0.1s;
	flex-shrink:   0;
}

/* Graduated heights — short on the left, tall on the right */
.oa-audio-vol-bar:nth-child(1)  { height: 4px;  }
.oa-audio-vol-bar:nth-child(2)  { height: 6px;  }
.oa-audio-vol-bar:nth-child(3)  { height: 8px;  }
.oa-audio-vol-bar:nth-child(4)  { height: 10px; }
.oa-audio-vol-bar:nth-child(5)  { height: 12px; }
.oa-audio-vol-bar:nth-child(6)  { height: 14px; }
.oa-audio-vol-bar:nth-child(7)  { height: 16px; }
.oa-audio-vol-bar:nth-child(8)  { height: 18px; }

/* Active (filled) bars */
.oa-audio-vol-bar.is-active {
	background: #fff;
}

/* Hover preview — light up bars up to the hovered one */
.oa-audio-vol-bars:hover .oa-audio-vol-bar {
	background: rgba(255,255,255,0.4);
}
.oa-audio-vol-bars:hover .oa-audio-vol-bar.is-active,
.oa-audio-vol-bars:hover .oa-audio-vol-bar.is-preview {
	background: #fff;
}

/* Tiny lift on hover for a tactile feel */
.oa-audio-vol-bars:hover .oa-audio-vol-bar:hover,
.oa-audio-vol-bars:hover .oa-audio-vol-bar.is-preview {
	transform: scaleY(1.15);
	transform-origin: bottom;
}

/* ── Loading / error states ─────────────────────────────────── */

.oa-audio-player.is-loading .oa-audio-play-btn {
	opacity: 0.5;
	pointer-events: none;
}

.oa-audio-error {
	font-size:   12px;
	color:       #f87171;
	margin-top:  4px;
	display:     none;
}
.oa-audio-player.has-error .oa-audio-error { display: block; }

/* ── No-title variant ───────────────────────────────────────── */

.oa-audio-player.no-title .oa-audio-title { display: none; }

/* ── Responsive: hide volume slider on narrow players ───────── */

@media (max-width: 360px) {
	.oa-audio-volume-slider { display: none; }
	.oa-audio-time { min-width: 70px; }
}
