/* =============================================================================
   HMNS Media Player — Feuille de style principale  v1.0.0
   ============================================================================= */

.hmns-mp-outer {
	display: flex;
	width: 100%;
}

.hmns-mp-wrapper {
	position: relative;
	flex: 1 1 auto;
	background: #1a1a2e;
	color: #ffffff;
	border-radius: 12px;
	overflow: hidden;
	font-family: inherit;
	-webkit-user-select: none;
	user-select: none;
	box-sizing: border-box;
}

/* Orientations */
.hmns-mp-orientation-horizontal { display: flex; flex-direction: row;    align-items: stretch; }
.hmns-mp-orientation-vertical   { display: flex; flex-direction: column; }

.hmns-mp-has-playlist.hmns-mp-orientation-horizontal { flex-wrap: wrap; }
.hmns-mp-has-playlist.hmns-mp-orientation-horizontal .hmns-mp-playlist { flex: 0 0 100%; }

/* Couverture audio */
.hmns-mp-cover-wrapper { position: relative; flex-shrink: 0; overflow: hidden; }
.hmns-mp-orientation-horizontal .hmns-mp-cover-wrapper { width: 90px; }
.hmns-mp-orientation-vertical   .hmns-mp-cover-wrapper { width: 100%; height: 200px; }

.hmns-mp-cover-img,
.hmns-mp-cover-placeholder { display: block; width: 100%; height: 100%; object-fit: cover; }
.hmns-mp-cover-placeholder { background: rgba(255,255,255,0.08); }
.hmns-mp-cover-img.hidden { display: none; }

/* Vidéo */
.hmns-mp-video-wrapper { position: relative; width: 100%; background: #000; overflow: hidden; }
.hmns-mp-media { display: block; width: 100%; height: auto; }
.hmns-mp-video-overlay { position: absolute; inset: 0; cursor: pointer; z-index: 1; }

.hmns-mp-type-video .hmns-mp-video-wrapper:not([style*="aspect-ratio"]) { aspect-ratio: 16 / 9; }
.hmns-mp-type-video .hmns-mp-video-wrapper:not([style*="aspect-ratio"]) .hmns-mp-media {
	position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
}

/* Zone principale */
.hmns-mp-main { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }

/* Infos piste */
.hmns-mp-track-info { padding: 10px 14px 4px; }
.hmns-mp-title { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Contrôles */
.hmns-mp-controls { padding: 8px 12px 10px; background: rgba(0,0,0,0.25); }

/* Barre de progression */
.hmns-mp-progress-wrapper { position: relative; padding: 7px 0; cursor: pointer; outline: none; }
.hmns-mp-progress-wrapper:focus-visible { outline: 2px solid #3d87e4; outline-offset: 2px; border-radius: 4px; }

.hmns-mp-progress-bar { position: relative; height: 4px; background: rgba(255,255,255,0.2); border-radius: 4px; }

.hmns-mp-buffer-fill,
.hmns-mp-progress-fill { position: absolute; top: 0; left: 0; height: 100%; border-radius: inherit; pointer-events: none; will-change: width; }
.hmns-mp-buffer-fill   { background: rgba(255,255,255,0.35); z-index: 1; }
.hmns-mp-progress-fill { background: #3d87e4; z-index: 2; transition: width 0.1s linear; }

.hmns-mp-progress-handle {
	position: absolute; top: 50%; z-index: 3;
	width: 12px; height: 12px; margin-top: -6px; margin-left: -6px;
	background: #3d87e4; border-radius: 50%; pointer-events: none;
	transform: scale(0); transition: transform 0.15s ease; will-change: left, transform;
}
.hmns-mp-progress-wrapper:hover .hmns-mp-progress-handle,
.hmns-mp-wrapper.is-dragging-progress .hmns-mp-progress-handle { transform: scale(1); }

/* Rangée de boutons */
.hmns-mp-buttons-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; }
.hmns-mp-left-controls,
.hmns-mp-right-controls { display: flex; align-items: center; gap: 4px; }

/* Boutons */
.hmns-mp-btn {
	display: inline-flex; align-items: center; justify-content: center;
	flex-shrink: 0; width: 36px; height: 36px; padding: 0;
	border: none; background: transparent; color: #ffffff;
	cursor: pointer; border-radius: 50%; font-size: 16px; line-height: 1;
	transition: background-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
	-webkit-tap-highlight-color: transparent;
}
.hmns-mp-btn:hover { background: rgba(255,255,255,0.15); }
.hmns-mp-btn:active { transform: scale(0.88); }
.hmns-mp-btn:focus-visible { outline: 2px solid #3d87e4; outline-offset: 2px; }
.hmns-mp-btn svg { width: 1em; height: 1em; fill: currentColor; pointer-events: none; }
.hmns-mp-btn-play { width: 40px; height: 40px; font-size: 18px; }

/* Temps */
.hmns-mp-time { display: flex; align-items: center; gap: 3px; font-size: 12px; color: rgba(255,255,255,0.75); white-space: nowrap; padding: 0 4px; font-variant-numeric: tabular-nums; }
.hmns-mp-time-sep { color: rgba(255,255,255,0.4); }

/* Volume */
.hmns-mp-volume-wrapper { width: 80px; padding: 7px 0; cursor: pointer; outline: none; }
.hmns-mp-volume-wrapper:focus-visible { outline: 2px solid #3d87e4; outline-offset: 2px; border-radius: 4px; }
.hmns-mp-volume-bar { position: relative; height: 4px; background: rgba(255,255,255,0.25); border-radius: 4px; overflow: hidden; }
.hmns-mp-volume-fill { position: absolute; top: 0; left: 0; height: 100%; background: #ffffff; border-radius: inherit; pointer-events: none; transition: width 0.08s ease; }

/* Playlist */
.hmns-mp-playlist { overflow-y: auto; max-height: 240px; border-top: 1px solid rgba(255,255,255,0.1); scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent; }
.hmns-mp-playlist::-webkit-scrollbar { width: 4px; }
.hmns-mp-playlist::-webkit-scrollbar-track { background: transparent; }
.hmns-mp-playlist::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.hmns-mp-playlist-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; outline: none; transition: background-color 0.15s ease; }
.hmns-mp-playlist-item:hover { background: rgba(255,255,255,0.07); }
.hmns-mp-playlist-item.is-active { background: rgba(61,135,228,0.22); }
.hmns-mp-playlist-item:focus-visible { outline: 2px solid #3d87e4; outline-offset: -2px; }

.hmns-mp-playlist-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.hmns-mp-playlist-thumb--empty { background: rgba(255,255,255,0.1); border-radius: 4px; }
.hmns-mp-playlist-title { font-size: 13px; line-height: 1.4; color: #cccccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.hmns-mp-playlist-item.is-active .hmns-mp-playlist-title { color: #ffffff; }

/* États */
.hmns-mp-wrapper.is-loading .hmns-mp-progress-fill {
	background: linear-gradient(90deg, #3d87e4 0%, rgba(61,135,228,0.4) 50%, #3d87e4 100%);
	background-size: 200% 100%;
	animation: hmns-loading 1.4s infinite linear;
}
@keyframes hmns-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Placeholder */
.hmns-mp-placeholder { display: flex; align-items: center; justify-content: center; min-height: 80px; padding: 24px; background: rgba(0,0,0,0.06); border: 2px dashed rgba(0,0,0,0.18); border-radius: 8px; font-size: 13px; color: #666; text-align: center; }

/* Responsive */
@media (max-width: 767px) {
	.hmns-mp-volume-wrapper { display: none; }
	.hmns-mp-orientation-horizontal .hmns-mp-cover-wrapper { width: 64px; }
	.hmns-mp-orientation-vertical   .hmns-mp-cover-wrapper { height: 140px; }
	.hmns-mp-title { font-size: 13px; }
	.hmns-mp-time  { font-size: 11px; }
	.hmns-mp-playlist { max-height: 180px; }
}
@media (max-width: 480px) {
	.hmns-mp-track-info { padding: 8px 10px 2px; }
	.hmns-mp-controls   { padding: 6px 8px 8px; }
	.hmns-mp-btn        { width: 30px; height: 30px; font-size: 13px; }
	.hmns-mp-btn-play   { width: 34px; height: 34px; font-size: 15px; }
}

/* ── État erreur ─────────────────────────────────────────────── */
.hmns-mp-error-msg { padding: 6px 14px 8px; font-size: 12px; color: #ff8a8a; display: none; }
.hmns-mp-wrapper.is-error .hmns-mp-error-msg { display: block; }
.hmns-mp-wrapper.is-error .hmns-mp-progress-fill { background: #e05555 !important; width: 100% !important; opacity: 0.6; }
.hmns-mp-wrapper.is-error .hmns-mp-progress-handle { display: none; }
.hmns-mp-wrapper.is-error .hmns-mp-title { opacity: 0.6; }

/* ── Embed (YouTube, Vimeo) ──────────────────────────────────── */
.hmns-mp-embed { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: none; }
.hmns-mp-wrapper.is-embed .hmns-mp-video-overlay { display: none !important; }
.hmns-mp-wrapper.is-embed .hmns-mp-controls { display: none; }
.hmns-mp-wrapper.is-embed .hmns-mp-track-info { padding: 8px 14px 10px; }
