/* ==========================================================================
   Trompette Webradio - Player styles
   Esthétique : broadcast studio / vinyle moderne, sombre avec accent vif
   ========================================================================== */

.twr-player,
.twr-floating {
    --twr-bg: #0f0f12;
    --twr-bg-soft: #1a1a1f;
    --twr-bg-card: #16161b;
    --twr-text: #f5f3ee;
    --twr-text-dim: #8a8a92;
    --twr-border: rgba(255, 255, 255, 0.08);
    --twr-radius: 14px;

    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", sans-serif;
    color: var(--twr-text);
    box-sizing: border-box;
}

.twr-player *,
.twr-floating * {
    box-sizing: border-box;
}

/* Reset agressif : les thèmes WordPress stylisent souvent les <button>
   avec leur couleur principale (souvent bleue). On neutralise tout. */
.twr-player button,
.twr-floating button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    text-transform: none;
    letter-spacing: normal;
    text-shadow: none;
    box-shadow: none;
    background-image: none;
    text-decoration: none;
    margin: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.twr-player button:hover,
.twr-player button:focus,
.twr-player button:active,
.twr-floating button:hover,
.twr-floating button:focus,
.twr-floating button:active {
    text-decoration: none;
    outline: none;
}

/* --------------------------------------------------------------------------
   Inline player
   -------------------------------------------------------------------------- */

.twr-player {
    background: var(--twr-bg);
    background-image:
        radial-gradient(ellipse at top right, color-mix(in srgb, var(--twr-accent) 18%, transparent), transparent 55%),
        radial-gradient(ellipse at bottom left, rgba(255, 255, 255, 0.04), transparent 60%);
    border-radius: var(--twr-radius);
    padding: 28px;
    position: relative;
    overflow: hidden;
    max-width: 640px;
    margin: 24px auto;
    border: 1px solid var(--twr-border);
    box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.5);
}

/* grille décorative en fond */
.twr-player::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    opacity: 0.6;
}

.twr-player > * {
    position: relative;
    z-index: 1;
}

.twr-hero {
    display: flex;
    gap: 22px;
    align-items: center;
    margin-bottom: 24px;
}

.twr-artwork {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    position: relative;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a2a30, #0a0a0d);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        0 8px 24px -8px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    transition: transform 0.4s ease;
}

.twr-player.is-playing .twr-artwork {
    animation: twr-spin 8s linear infinite;
}

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

.twr-artwork-inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: color-mix(in srgb, var(--twr-accent) 70%, white 30%);
}

.twr-artwork-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.twr-artwork-placeholder {
    width: 100%;
    height: 100%;
}

/* Sillons de vinyle */
.twr-artwork::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background-image: repeating-radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.04) 0,
        rgba(255, 255, 255, 0.04) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
}

.twr-equalizer {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 32px;
    height: 32px;
    background: var(--twr-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.twr-player.is-playing .twr-equalizer {
    opacity: 1;
}

.twr-equalizer span {
    width: 2px;
    height: 8px;
    background: #fff;
    border-radius: 1px;
    animation: twr-eq 0.9s ease-in-out infinite;
}

.twr-equalizer span:nth-child(2) { animation-delay: 0.15s; height: 12px; }
.twr-equalizer span:nth-child(3) { animation-delay: 0.3s; height: 6px; }
.twr-equalizer span:nth-child(4) { animation-delay: 0.45s; height: 10px; }

@keyframes twr-eq {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}

.twr-meta {
    flex: 1;
    min-width: 0;
}

.twr-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--twr-accent);
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
}

.twr-pulse {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    animation: twr-pulse 1.4s ease-in-out infinite;
}

@keyframes twr-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

.twr-station {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--twr-text-dim);
    margin-bottom: 4px;
}

.twr-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.twr-artist {
    font-size: 14px;
    color: var(--twr-text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.twr-listeners {
    margin-top: 8px;
    font-size: 12px;
    color: var(--twr-text-dim);
    font-variant-numeric: tabular-nums;
}

.twr-listeners:empty {
    display: none;
}

/* Controls */

.twr-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--twr-border);
}

.twr-player .twr-play,
.twr-floating .twr-play {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--twr-accent) !important;
    border: none;
    color: #fff !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--twr-accent) 70%, transparent);
}

.twr-player .twr-play:hover,
.twr-floating .twr-play:hover {
    transform: scale(1.05);
    background: var(--twr-accent) !important;
    box-shadow: 0 10px 28px -6px color-mix(in srgb, var(--twr-accent) 80%, transparent);
}

.twr-player .twr-play:active,
.twr-floating .twr-play:active {
    transform: scale(0.96);
    background: var(--twr-accent) !important;
}

.twr-play svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    position: absolute;
}

.twr-icon-pause,
.twr-icon-loading {
    display: none;
}

.twr-play.is-playing .twr-icon-play { display: none; }
.twr-play.is-playing .twr-icon-pause { display: block; }

.twr-play.is-loading .twr-icon-play,
.twr-play.is-loading .twr-icon-pause { display: none; }
.twr-play.is-loading .twr-icon-loading {
    display: block;
    animation: twr-spin 0.8s linear infinite;
}

.twr-volume {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 200px;
}

.twr-player .twr-mute,
.twr-floating .twr-mute {
    background: transparent !important;
    background-image: none !important;
    border: none;
    color: var(--twr-text-dim);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
    border-radius: 0;
    box-shadow: none;
}

.twr-player .twr-mute:hover,
.twr-floating .twr-mute:hover {
    color: var(--twr-text);
    background: transparent !important;
}

.twr-mute svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.twr-volume-slider {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.twr-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--twr-text);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.twr-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--twr-accent);
}

.twr-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--twr-text);
    border: none;
    cursor: pointer;
}

/* Tabs */

.twr-tabs {
    display: flex;
    gap: 4px;
    margin-top: 24px;
    border-bottom: 1px solid var(--twr-border);
    padding-bottom: 0;
}

.twr-player .twr-tab,
.twr-floating .twr-tab {
    background: transparent !important;
    background-image: none !important;
    border: none;
    color: var(--twr-text-dim);
    padding: 10px 14px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
    border-radius: 0;
}

.twr-player .twr-tab:hover,
.twr-floating .twr-tab:hover {
    color: var(--twr-text);
    background: transparent !important;
}

.twr-player .twr-tab.is-active,
.twr-floating .twr-tab.is-active {
    color: var(--twr-text) !important;
    background: transparent !important;
}

.twr-tab.is-active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 14px;
    right: 14px;
    height: 2px;
    background: var(--twr-accent);
}

.twr-panels {
    padding-top: 16px;
}

.twr-panel {
    display: none;
}

.twr-panel.is-active {
    display: block;
}

.twr-panel-empty,
.twr-empty {
    color: var(--twr-text-dim);
    font-size: 13px;
    text-align: center;
    padding: 16px 0;
    font-style: italic;
}

.twr-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 260px;
    overflow-y: auto;
}

.twr-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--twr-border);
    font-size: 13px;
}

.twr-list li:last-child { border-bottom: none; }

.twr-list-art {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: var(--twr-bg-soft);
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.twr-list-info {
    flex: 1;
    min-width: 0;
}

.twr-list-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.twr-list-artist {
    color: var(--twr-text-dim);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.twr-list-time {
    color: var(--twr-text-dim);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.twr-list-now {
    background: color-mix(in srgb, var(--twr-accent) 12%, transparent);
    border-radius: 6px;
    padding: 10px 8px;
}

/* Compact variant */

.twr-player.twr-compact {
    padding: 18px;
    max-width: 360px;
}

.twr-player.twr-compact .twr-artwork {
    width: 64px;
    height: 64px;
}

.twr-player.twr-compact .twr-title { font-size: 16px; }
.twr-player.twr-compact .twr-play { width: 44px; height: 44px; }
.twr-player.twr-compact .twr-play svg { width: 18px; height: 18px; }

/* --------------------------------------------------------------------------
   Floating player
   -------------------------------------------------------------------------- */

.twr-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99998;
}

.twr-floating .twr-floating-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--twr-accent) !important;
    background-image: none !important;
    border: none;
    color: #fff !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
    padding: 0;
}

.twr-floating .twr-floating-toggle:hover {
    transform: scale(1.08);
    background: var(--twr-accent) !important;
}

.twr-floating-toggle svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.twr-floating-body {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 320px;
    background: var(--twr-bg);
    border: 1px solid var(--twr-border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.twr-floating[data-twr-collapsed="false"] .twr-floating-body {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.twr-floating[data-twr-collapsed="false"] .twr-floating-toggle {
    display: none;
}

.twr-floating .twr-floating-close {
    position: absolute;
    top: 6px;
    right: 6px;
    background: transparent !important;
    background-image: none !important;
    border: none;
    color: var(--twr-text-dim);
    font-size: 22px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    box-shadow: none;
}

.twr-floating .twr-floating-close:hover {
    color: var(--twr-text);
    background: rgba(255, 255, 255, 0.06) !important;
}

.twr-floating-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.twr-play-mini {
    width: 44px;
    height: 44px;
}

.twr-play-mini svg {
    width: 18px;
    height: 18px;
}

.twr-floating-meta {
    flex: 1;
    min-width: 0;
}

.twr-floating-station {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--twr-text-dim);
    margin-bottom: 2px;
}

.twr-floating-title {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.twr-floating-artist {
    font-size: 12px;
    color: var(--twr-text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 520px) {
    .twr-player { padding: 20px; }
    .twr-hero { gap: 16px; }
    .twr-artwork { width: 80px; height: 80px; }
    .twr-title { font-size: 18px; }
    .twr-floating-body { width: calc(100vw - 40px); }
}
