/* ==========================================================================
   Platine 45 Radio : affichage « appli » sur téléphone
   --------------------------------------------------------------------------
   Chargée après styles.css :
   - sur le site, seulement sur petit écran (media="(max-width: 768px)"
     dans index.html) : l'ordinateur garde son affichage ;
   - dans l'application mobile, toujours (scripts/sync-web.mjs retire la
     condition de taille).
   Même thème (couleurs et polices du site), barre d'onglets en bas, lecteur
   plein écran, zones tactiles d'au moins 44 px et textes lisibles.
   ========================================================================== */

:root {
    --app-tabbar-h: 64px;
    --app-safe-bottom: env(safe-area-inset-bottom, 0px);
    --app-header-h: 68px;
}

/* Sur écran tactile, les effets de survol restent « collés » après un appui */
@media (hover: none) {
    .nav-link:hover,
    .social-link:hover,
    .history-item:hover,
    .mini-play-btn:hover,
    .play-btn:hover {
        transform: none;
    }
}

/* -------------------------------------------------- En-tête compact */
.header {
    /* backdrop-filter piégerait la barre d'onglets (position: fixed) dans l'en-tête */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.99) 0%, rgba(15, 15, 35, 1) 100%);
}

.header .container {
    flex-wrap: nowrap;
    padding: 10px 12px;
    gap: 8px;
}

.logo-circle {
    width: 46px;
    height: 46px;
}

.tagline {
    font-size: 12px;
    max-width: 150px;
    line-height: 1.25;
}

.social-links {
    gap: 2px;
}

/* Icône de 24 px dans une zone tactile de 44 px */
.social-link {
    width: 44px;
    height: 44px;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.social-link:active {
    background: rgba(99, 102, 241, 0.25);
}

#player, #replay, #history, #schedule, #about {
    scroll-margin-top: calc(var(--app-header-h) + var(--safe-area-top) + 10px);
}

/* -------------------------------------------------- Onglets : une section à la fois (app.js) */
.main-content > section[hidden] {
    display: none !important;
}

.main-content {
    padding-top: 20px;
}

/* Le contenu occupe toute la hauteur de l'écran, même sur un onglet court */
body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.main-content {
    flex: 1 0 auto;
}

/* Onglet Écouter : le bandeau du bas (mini-lecteur) reste affiché, comme ailleurs */
html[data-app-tab="player"] body {
    padding-bottom: calc(var(--app-tabbar-h) + var(--app-safe-bottom) + 84px);
}

.player-section,
.replay-section,
.history-section,
.schedule-section,
.about-section {
    margin-top: 0;
    margin-bottom: 0;
}

/* L'historique a son propre onglet : pas de seconde barre de défilement */
.history-list {
    max-height: none;
    overflow-y: visible;
}

/* -------------------------------------------------- Barre d'onglets en bas */
.nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    order: initial;
    width: auto;
    margin: 0;
    gap: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    min-height: var(--app-tabbar-h);
    padding: 0 max(4px, var(--safe-area-left)) var(--app-safe-bottom) max(4px, var(--safe-area-right));
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.99) 0%, rgba(15, 15, 35, 1) 100%);
    border-top: 2px solid;
    border-image: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent)) 1;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: var(--app-tabbar-h);
    padding: 6px 2px;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.75);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.05;
    text-align: center;
    white-space: normal;
    -webkit-tap-highlight-color: transparent;
}

.nav-link::before {
    content: "";
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    background: currentColor;
    -webkit-mask: var(--app-icon) center / contain no-repeat;
    mask: var(--app-icon) center / contain no-repeat;
}

.nav-link[href="#player"] {
    --app-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3a9 9 0 0 0-9 9v7a2 2 0 0 0 2 2h3v-8H5v-1a7 7 0 0 1 14 0v1h-3v8h3a2 2 0 0 0 2-2v-7a9 9 0 0 0-9-9z'/%3E%3C/svg%3E");
}
.nav-link[href="#replay"] {
    --app-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 6H2v14a2 2 0 0 0 2 2h14v-2H4V6zm16-4H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2zm-8 12.5v-9l6 4.5-6 4.5z'/%3E%3C/svg%3E");
}
.nav-link[href="#history"] {
    --app-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 3a9 9 0 0 0-9 9H1l3.9 3.9L9 12H6a7 7 0 1 1 2.05 4.95l-1.42 1.42A9 9 0 1 0 13 3zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z'/%3E%3C/svg%3E");
}
.nav-link[href="#schedule"] {
    --app-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 4h-1V2h-2v2H8V2H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V10h14v10zM7 12h5v5H7z'/%3E%3C/svg%3E");
}
.nav-link[href="#about"] {
    --app-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-8 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5C15 14.17 10.33 13 8 13zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z'/%3E%3C/svg%3E");
}

/* Pas d'effet de survol du site sur les onglets (il resterait collé après un appui) */
.nav-link:hover {
    background: none;
    box-shadow: none;
    transform: none;
    color: rgba(255, 255, 255, 0.75);
}

/* Onglet de la section à l'écran (mis à jour par app.js) */
.nav-link.is-current,
.nav-link.is-current:hover {
    color: var(--gold);
}

.nav-link:active {
    background: rgba(99, 102, 241, 0.2);
}

.nav-link:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -4px;
}

/* -------------------------------------------------- Mini-lecteur au-dessus des onglets */
.mini-player {
    bottom: calc(var(--app-tabbar-h) + var(--app-safe-bottom));
    padding: 8px 12px;
}

.mini-title {
    font-size: 15px;
}

.mini-artist {
    font-size: 14px;
}

.mini-player-controls {
    padding: 0 0 0 8px;
}

.mini-play-btn {
    width: 52px;
    height: 52px;
}

.mini-play-btn svg {
    width: 24px;
    height: 24px;
}

/* Dans l'appli, le volume se règle avec les boutons du téléphone */
.mini-volume-slider {
    display: none;
}

body {
    padding-bottom: calc(var(--app-tabbar-h) + var(--app-safe-bottom) + 84px);
}

/* -------------------------------------------------- Grand lecteur (taille : voir la fin du fichier) */
/* Curseur de volume : piste visible de 8 px, zone tactile de 44 px */
.volume-slider {
    height: 44px;
    background: transparent;
    cursor: pointer;
}

.volume-slider::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.45), rgba(236, 72, 153, 0.45));
}

.volume-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    margin-top: -10px;
}

/* -------------------------------------------------- Textes trop petits */
.member-bio {
    font-size: 15px;
    line-height: 1.45;
}

.day-name {
    font-size: 16px;
}

.slot-time {
    font-size: 14px;
}

.slot-content {
    font-size: 15px;
    line-height: 1.3;
}

/* Lien de contact : zone tactile de 44 px */
.contact-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

/* -------------------------------------------------- Onglet Écouter : lecteur plein écran
   Grande pochette, titre et artiste, puis les commandes, comme un lecteur
   de musique. */
html[data-app-tab="player"] .main-content {
    padding: 12px 0 0;
    display: flex;
    flex-direction: column;
}

.player-section {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.player-section > .container {
    flex: 1 0 auto;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding-left: 12px;
    padding-right: 12px;
}

.player-card {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    padding: 16px 20px 24px;
    margin-bottom: 12px;
}

.player-header {
    margin-bottom: 12px;
}

.player-header h2 {
    font-size: 22px;
}

.now-playing {
    flex: 1;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    gap: 18px;
    text-align: center;
}

/* Pochette aussi grande que l'écran le permet */
.album-art {
    width: max(150px, min(calc(100vw - 72px), calc(100dvh - 516px - var(--safe-area-top) - var(--app-safe-bottom)), 420px));
    height: auto;
    aspect-ratio: 1;
    border-radius: 18px;
}

.album-art img {
    border-radius: 15px;
}

.track-info {
    width: 100%;
    flex: 0 0 auto;
}

.on-air {
    font-size: 13px;
    margin-bottom: 8px;
    padding: 3px 10px;
    justify-content: center;
}

.track-title {
    font-size: 22px;
    line-height: 1.25;
    margin-bottom: 6px;
}

.track-artist {
    font-size: 18px;
    margin-bottom: 22px;
}

.player-controls {
    flex-direction: column;
    gap: 14px;
}

.play-btn {
    width: 84px;
    height: 84px;
}

.play-btn svg {
    width: 38px;
    height: 38px;
}

.volume-control {
    width: 100%;
    justify-content: center;
}

.volume-slider {
    width: min(100%, 320px);
}

/* Titre de section qui reçoit le focus au changement d'onglet (lecteurs d'écran) :
   pas de cadre visible, Safari en dessine un sinon */
.main-content h2[tabindex="-1"]:focus {
    outline: none;
}

/* -------------------------------------------------- Onglet Écouter : seulement le lecteur (v1.4.10)
   Tout tient sur un écran, sans défilement ni curseur de volume
   (le volume se règle avec les boutons du téléphone). La pochette
   prend la place qui reste au-dessus du titre et du bouton lecture. */
html[data-app-tab="player"] .volume-control {
    display: none;
}

html[data-app-tab="player"] body {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}

html[data-app-tab="player"] .main-content,
html[data-app-tab="player"] .player-section,
html[data-app-tab="player"] .player-section > .container,
html[data-app-tab="player"] .player-card {
    flex: 1 1 0;
    min-height: 0;
}

html[data-app-tab="player"] .player-card {
    margin-bottom: 16px;
    padding-bottom: 16px;
}

html[data-app-tab="player"] .now-playing {
    flex: 1 1 0;
    min-height: 0;
    container-type: size;
    gap: 14px;
    justify-content: center;
}

/* Pochette carrée, même quand l'image fournie ne l'est pas */
html[data-app-tab="player"] .album-art {
    flex: 0 0 auto;
    width: max(120px, min(100cqw, calc(100cqh - 250px), 420px));
    height: auto;
}

html[data-app-tab="player"] .album-art img {
    height: auto;
    aspect-ratio: 1;
}

html[data-app-tab="player"] .track-artist {
    margin-bottom: 14px;
}

html[data-app-tab="player"] .track-artist:empty {
    display: none;
}

/* -------------------------------------------------- Onglet Écouter : habillage (v1.4.11)
   Lecteur sans cadre, sur un fond flouté tiré de la pochette en cours
   (--app-cover, mis à jour par app.js), égaliseur animé et halo autour
   du bouton pendant la lecture. Couleurs et polices du site. */
html[data-app-tab="player"] .player-section {
    position: relative;
    isolation: isolate;
}

html[data-app-tab="player"] .player-section::before,
html[data-app-tab="player"] .player-section::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

/* Fond : pochette très floutée, assombrie vers le bas */
html[data-app-tab="player"] .player-section::before {
    background: var(--app-cover, none) center / cover no-repeat;
    filter: blur(42px) saturate(1.4);
    transform: scale(1.3);
    opacity: 0.45;
    transition: opacity 0.6s;
}

html[data-app-tab="player"] .player-section::after {
    background:
        radial-gradient(120% 70% at 50% 30%, rgba(99, 102, 241, 0.18), transparent 70%),
        linear-gradient(180deg, rgba(15, 15, 35, 0.35) 0%, rgba(15, 15, 35, 0.75) 60%, rgba(15, 15, 35, 0.95) 100%);
}

/* Plus de carte : le lecteur occupe l'écran */
html[data-app-tab="player"] .player-card {
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 8px 12px 12px;
}

/* « En direct » + pastille LIVE, centrés au-dessus de la pochette */
html[data-app-tab="player"] .player-header {
    justify-content: center;
    gap: 12px;
    margin-bottom: 4px;
}

html[data-app-tab="player"] .player-header h2 {
    font-size: 15px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
}

html[data-app-tab="player"] .live-indicator {
    padding: 5px 12px;
    font-size: 13px;
    letter-spacing: 0.08em;
    background: rgba(236, 72, 153, 0.18);
}

/* Égaliseur (ajouté par app.js dans la pastille LIVE) : bouge pendant la lecture */
.app-eq {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}

.app-eq span {
    width: 3px;
    height: 100%;
    border-radius: 2px;
    background: var(--gold);
    transform-origin: bottom;
    transform: scaleY(0.3);
}

html:has(#play-pause-btn.playing) .app-eq {
    display: inline-flex;
}

html:has(#play-pause-btn.playing) .live-dot {
    display: none;
}

html:has(#play-pause-btn.playing) .app-eq span {
    animation: app-eq 0.9s ease-in-out infinite alternate;
}

.app-eq span:nth-child(2) { animation-delay: -0.3s !important; animation-duration: 0.7s !important; }
.app-eq span:nth-child(3) { animation-delay: -0.6s !important; animation-duration: 1.1s !important; }
.app-eq span:nth-child(4) { animation-delay: -0.15s !important; animation-duration: 0.8s !important; }

@keyframes app-eq {
    from { transform: scaleY(0.25); }
    to { transform: scaleY(1); }
}

/* Pochette : coins arrondis, liseré dégradé du site, ombre profonde ;
   légèrement en retrait quand la radio est en pause */
html[data-app-tab="player"] .album-art {
    border-radius: 22px;
    padding: 3px;
    box-shadow:
        0 24px 50px rgba(0, 0, 0, 0.55),
        0 0 60px rgba(236, 72, 153, 0.25),
        0 0 90px rgba(99, 102, 241, 0.2);
    transform: scale(0.94);
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.5s;
}

html[data-app-tab="player"]:has(#play-pause-btn.playing) .album-art {
    transform: scale(1);
}

html[data-app-tab="player"] .album-art img {
    border-radius: 19px;
}

/* Titre et artiste */
html[data-app-tab="player"] .track-title {
    font-size: 21px;
    line-height: 1.25;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

html[data-app-tab="player"] .track-artist {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Bouton lecture : halo qui respire pendant la lecture */
html[data-app-tab="player"] .play-btn {
    position: relative;
    width: 80px;
    height: 80px;
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.15s;
}

html[data-app-tab="player"] .play-btn:active {
    transform: scale(0.94);
}

html[data-app-tab="player"] .play-btn::before {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(236, 72, 153, 0.45);
    opacity: 0;
}

html[data-app-tab="player"] .play-btn.playing::before {
    animation: app-halo 2.2s ease-out infinite;
}

@keyframes app-halo {
    0% { transform: scale(0.95); opacity: 0.9; }
    100% { transform: scale(1.35); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    html[data-app-tab="player"] .play-btn.playing::before,
    html:has(#play-pause-btn.playing) .app-eq span {
        animation: none;
    }
    html[data-app-tab="player"] .album-art {
        transition: none;
    }
}

html[data-app-tab="player"] .now-playing {
    gap: 22px;
}

/* Bouton lecture plus bas (v1.4.12) : le halo (jusqu'à ~25 px autour
   du bouton) ne doit jamais toucher le titre, même sur deux lignes */
html[data-app-tab="player"] .player-controls {
    margin-top: 34px;
}

html[data-app-tab="player"] .track-artist {
    margin-bottom: 0;
}

/* -------------------------------------------------- Replay
   Onglet Replay : la liste occupe l'écran (pas de grande intro) */
.replay-intro {
    margin-top: -10px;
}

/* Onglet Écouter en mode replay : barre de position et retour au direct */
html[data-app-tab="player"] .replay-progress {
    width: 100%;
    max-width: 420px;
    margin: 10px auto 0;
}

/* −15 s / +30 s : ronds, de part et d'autre du bouton lecture */
html[data-app-tab="player"] .player-controls {
    flex-direction: row;
    justify-content: center;
    gap: 28px;
}

html.is-replay[data-app-tab="player"] .player-controls {
    margin-top: 18px;
}

html[data-app-tab="player"] .replay-skip {
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    font-size: 15px;
}

/* En replay, la barre de position prend de la place : pochette un peu plus petite */
html.is-replay[data-app-tab="player"] .album-art {
    width: max(110px, min(100cqw, calc(100cqh - 300px), 420px));
}

/* Le point rouge du bouton « Retour au direct » reste visible pendant la lecture */
html:has(#play-pause-btn) .back-live-btn .live-dot {
    display: inline-block;
}

html[data-app-tab="player"] .back-live-btn {
    min-height: 44px;
    font-size: 17px;
}

.replay-skip,
.mini-live-btn {
    min-height: 44px;
}

/* Le petit message (lien copié) passe au-dessus du mini-lecteur et des onglets */
.toast {
    bottom: calc(var(--app-tabbar-h) + var(--app-safe-bottom) + 90px);
}

/* -------------------------------------------------- Site sur téléphone
   L'onglet Écouter est un lecteur plein écran, comme dans l'appli :
   pas de liste des derniers titres en dessous (onglet Historique). */
.recent-block {
    display: none !important;
}

/* -------------------------------------------------- Site sur téléphone : comme une appli
   (classe has-tabs posée par script.js, jamais dans l'appli elle-même)
   La page ne défile plus : seule la zone de contenu défile. La barre d'adresse
   du navigateur ne se replie donc plus, et la barre d'icônes en bas reste
   immobile. L'onglet Écouter ne défile pas du tout. */
html.has-tabs {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

html.has-tabs body {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
}

html.has-tabs .header {
    position: relative;
    flex: 0 0 auto;
}

html.has-tabs .main-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

html.has-tabs[data-app-tab="player"] .main-content {
    overflow: hidden;
}

html.has-tabs .main-content {
    padding-bottom: 0;
}
