/* ==========================================================================
   TUBA PRACTICE HUB - STYLES PUBLICS (FRONT-END)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BOUTONS GÉNÉRAUX
   -------------------------------------------------------------------------- */
.tph-btn {
    background: #2271b1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s ease;
}

.tph-btn:hover {
    background: #135e96;
    color: white;
}

.tph-btn-success { background: #10b981; }
.tph-btn-success:hover { background: #059669; }


/* --------------------------------------------------------------------------
   2. CATALOGUE (Filtres, Grille et Cartes)
   -------------------------------------------------------------------------- */
.tph-filters-form {
    background: #f7f9fc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    border: 1px solid #e2e8f0;
}

.tph-filters-form select, 
.tph-filters-form input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    flex: 1;
    min-width: 150px;
}

.tph-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.tph-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.tph-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
}

.tph-card-title {
    font-size: 1.25rem;
    margin: 0 0 10px 0;
    color: #1e293b;
}

.tph-card-tags {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 15px;
}

.tph-card-tags span {
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 12px;
    margin-right: 5px;
    display: inline-block;
    margin-bottom: 5px;
}

.tph-card-meta {
    font-size: 0.9rem;
    margin-bottom: 20px;
    flex-grow: 1;
}

.tph-card-meta strong {
    color: #334155;
}

.tph-pagination {
    margin-top: 40px;
    text-align: center;
}

.tph-pagination a, 
.tph-pagination span {
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    text-decoration: none;
    color: #1e293b;
}

.tph-pagination .current {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}


/* --------------------------------------------------------------------------
   3. MA SÉANCE (Mise en page globale et Playlist)
   -------------------------------------------------------------------------- */
.tph-seance-app {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 768px) {
    .tph-seance-app {
        grid-template-columns: 1fr;
    }
}

.tph-seance-sidebar {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.tph-playlist-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tph-playlist-item {
    background: white;
    padding: 12px;
    border: 1px solid #cbd5e1;
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    transition: all 0.2s;
}

.tph-playlist-item.active {
    border-left: 4px solid #2271b1;
    font-weight: bold;
}

.tph-playlist-item:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tph-remove-item {
    color: #ef4444;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
}


/* --------------------------------------------------------------------------
   4. LE LECTEUR (Plein écran, Ascenseur et Boutons fixes via Flexbox)
   -------------------------------------------------------------------------- */
.tph-seance-stage {
    background: white;
    padding: 20px; 
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    
    /* Système élastique Flexbox */
    display: flex;
    flex-direction: column;
    height: 80vh; 
}

#tph-stage-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
    min-height: 0; /* Obligatoire pour que l'ascenseur interne fonctionne */
}

.tph-stage-empty {
    text-align: center;
    color: #64748b;
    padding-top: 50px;
}

/* Zone collante en haut du lecteur */
.tph-sticky-header {
    background: white; 
    z-index: 10; 
    padding-top: 10px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
    flex-shrink: 0; /* L'en-tête refuse d'être écrasé, il garde sa taille exacte */
}

.tph-active-meta {
    display: flex;
    gap: 15px;
    color: #475569;
    margin-bottom: 15px;
}

.tph-conseil-box {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 0 4px 4px 0;
}

/* Zone de la partition avec ascenseur (Scrollable) */
.tph-scrollable-content {
    flex-grow: 1; /* La partition prend TOUT l'espace restant */
    overflow-y: auto; 
    padding-right: 15px; 
}

.tph-scrollable-content::-webkit-scrollbar { width: 8px; }
.tph-scrollable-content::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
.tph-scrollable-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.tph-scrollable-content::-webkit-scrollbar-thumb:hover { background: #94a3b8; }


/* ==========================================================================
   5. CENTRAGE DU CONTENU (Partitions)
   ========================================================================== */
.tph-exercice-body {
    text-align: center;
}

.tph-exercice-body img,
.tph-exercice-body figure,
.tph-exercice-body .wp-block-image {
    display: block;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100%;
    height: auto;
}


/* ==========================================================================
   6. MODE PLEIN ÉCRAN OPTIMISÉ (Flexbox & Réduction de l'en-tête)
   ========================================================================== */

/* En mode plein écran, la boîte principale passe à 100% de l'écran */
:fullscreen .tph-seance-stage { height: 100vh; padding: 20px; }
:-webkit-full-screen .tph-seance-stage { height: 100vh; padding: 20px; }

:fullscreen .tph-sticky-header {
    padding-top: 5px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

:fullscreen #tph-active-title {
    font-size: 1.3rem; 
    margin-bottom: 2px;
}

:fullscreen .tph-active-meta {
    font-size: 0.8rem; 
    margin-bottom: 5px;
}

:fullscreen .tph-stage-controls {
    padding-bottom: 5px;
}

:fullscreen .tph-btn {
    padding: 6px 12px; 
    font-size: 0.9rem;
}

/* Fallback de sécurité Safari/iPhone */
:-webkit-full-screen .tph-sticky-header { padding-top: 5px; margin-bottom: 10px; }
:-webkit-full-screen #tph-active-title { font-size: 1.3rem; margin-bottom: 2px; }
:-webkit-full-screen .tph-active-meta { font-size: 0.8rem; margin-bottom: 5px; }

/* ==========================================================================
   7. LE HUB CENTRAL (Onglets)
   ========================================================================== */
.tph-hub-wrapper {
    max-width: 1400px;
    margin: 0 auto;
}

.tph-hub-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.tph-tab-btn {
    background: transparent;
    border: none;
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
}

.tph-tab-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.tph-tab-btn.active {
    background: #2271b1;
    color: white;
}

/* --- OPTIMISATION MOBILE --- */
@media (max-width: 768px) {
    .tph-seance-app {
        grid-template-columns: 1fr; /* La playlist passe au-dessus du lecteur */
        gap: 15px;
    }
    
    /* Le menu des onglets devient un carrousel horizontal tactile */
    .tph-hub-tabs { 
        flex-wrap: nowrap; 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; /* Pour un glissement fluide sur iPhone */
        padding-bottom: 5px;
        margin-bottom: 15px;
        border-bottom: none;
        scrollbar-width: none; /* Cache l'ascenseur sur Firefox */
    }
    .tph-hub-tabs::-webkit-scrollbar {
        display: none; /* Cache l'ascenseur sur Chrome/Safari */
    }
    
    .tph-tab-btn {
        flex: 0 0 auto; /* Empêche les boutons de s'écraser */
        white-space: nowrap; /* Empêche le texte de passer à la ligne */
        font-size: 0.95rem;
        padding: 10px 15px;
        border-radius: 8px; /* Plus joli sur mobile */
        border: 1px solid #e2e8f0;
    }

    /* Le lecteur prend 100% de la hauteur dispo sur mobile */
    .tph-seance-stage {
        height: 85vh; 
        padding: 15px;
    }

    /* Le métronome s'adapte aux petits écrans */
    #tph-metro-bpm-input { width: 50px !important; }
	
	/* --- NOUVEAU : Plein écran forcé pour iPhone/iOS --- */
.tph-ios-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background: #ffffff !important;
    margin: 0 !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
}
}