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

/* --- PALETTE ET VARIABLES GLOBALES (Moderne & Sobre) --- */
:root {
    --tph-primary: #3b82f6;        /* Bleu moderne et dynamique */
    --tph-primary-dark: #2563eb;   /* Bleu au survol */
    --tph-accent: #8b5cf6;         /* Violet élégant pour les actions spéciales */
    --tph-bg-body: #f8fafc;        /* Gris très clair pour le fond de page */
    --tph-bg-card: #ffffff;        /* Blanc pur pour les éléments */
    --tph-text-main: #0f172a;      /* Texte sombre presque noir */
    --tph-text-muted: #64748b;     /* Texte secondaire gris ardoise */
    --tph-border: #e2e8f0;         /* Bordures subtiles */
    --tph-success: #10b981;        /* Vert émeraude */
    --tph-danger: #ef4444;         /* Rouge alerte */
    --tph-warning-bg: #fffbeb;     /* Fond jaune pâle pour les conseils */
    --tph-warning-text: #d97706;   /* Texte jaune foncé */
    
    --tph-radius-sm: 8px;
    --tph-radius-md: 12px;
    --tph-radius-lg: 16px;
    
    --tph-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --tph-shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
    --tph-shadow-hover: 0 20px 25px -5px rgba(15, 23, 42, 0.1);
    
    --tph-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   1. BOUTONS GÉNÉRAUX
   -------------------------------------------------------------------------- */
.tph-btn {
    background: var(--tph-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--tph-radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--tph-transition);
    letter-spacing: 0.3px;
}

.tph-btn:hover {
    background: var(--tph-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--tph-shadow-md);
    color: white;
}

.tph-btn:active {
    transform: translateY(0);
}

.tph-btn-success { background: var(--tph-success); }
.tph-btn-success:hover { background: #059669; }

/* ==========================================================================
   BOUTON RÉINITIALISER (Style Secondaire)
   ========================================================================== */
.tph-btn.tph-reset-filters {
    background: transparent;
    color: #64748b; /* Gris ardoise pour le texte */
    border: 1px solid #cbd5e1; /* Bordure fine grise */
    box-shadow: none; /* On enlève l'ombre pour le différencier de l'action principale */
}

/* L'effet au survol de la souris */
.tph-btn.tph-reset-filters:hover {
    background: #f1f5f9; /* Un gris très très clair */
    color: #334155; /* Le texte devient un peu plus foncé */
    border-color: #94a3b8; /* La bordure s'assombrit légèrement */
    transform: translateY(-1px); /* Le petit effet de soulèvement agréable */
}


/* --------------------------------------------------------------------------
   2. CATALOGUE (Filtres, Grille et Cartes)
   -------------------------------------------------------------------------- */
.tph-filters-form {
    background: var(--tph-bg-card);
    padding: 20px;
    border-radius: var(--tph-radius-md);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    border: 1px solid var(--tph-border);
    box-shadow: var(--tph-shadow-sm);
}

.tph-filters-form select, 
.tph-filters-form input[type="text"] {
    padding: 10px 14px;
    border: 1px solid var(--tph-border);
    border-radius: var(--tph-radius-sm);
    flex: 1;
    min-width: 150px;
    font-size: 0.95rem;
    color: var(--tph-text-main);
    background: var(--tph-bg-body);
    transition: var(--tph-transition);
}

.tph-filters-form select:focus, 
.tph-filters-form input[type="text"]:focus {
    outline: none;
    border-color: var(--tph-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

.tph-card {
    background: var(--tph-bg-card);
    border-radius: var(--tph-radius-lg);
    box-shadow: var(--tph-shadow-sm);
    border: 1px solid var(--tph-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: var(--tph-transition);
}

.tph-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--tph-shadow-hover);
    border-color: #cbd5e1;
}

.tph-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--tph-text-main);
    line-height: 1.3;
}

.tph-card-tags {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--tph-text-muted);
    margin-bottom: 15px;
}

.tph-card-tags span {
    background: var(--tph-bg-body);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--tph-border);
    margin-right: 6px;
    margin-bottom: 6px;
    display: inline-block;
}

.tph-card-meta {
    font-size: 0.9rem;
    margin-bottom: 20px;
    flex-grow: 1;
    color: var(--tph-text-muted);
}

.tph-card-meta strong {
    color: var(--tph-text-main);
}

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

.tph-pagination a, 
.tph-pagination span {
    padding: 8px 16px;
    margin: 0 4px;
    border: 1px solid var(--tph-border);
    border-radius: var(--tph-radius-sm);
    text-decoration: none;
    color: var(--tph-text-muted);
    font-weight: 500;
    transition: var(--tph-transition);
}

.tph-pagination a:hover {
    background: var(--tph-bg-body);
    color: var(--tph-text-main);
}

.tph-pagination .current {
    background: var(--tph-primary);
    color: white;
    border-color: var(--tph-primary);
}


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

.tph-seance-sidebar {
    background: var(--tph-bg-card);
    padding: 20px;
    border-radius: var(--tph-radius-md);
    border: 1px solid var(--tph-border);
    box-shadow: var(--tph-shadow-sm);
}

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

.tph-playlist-item {
    background: var(--tph-bg-body);
    padding: 12px 15px !important; 
    border: 1px solid transparent;
    margin-bottom: 10px;
    border-radius: var(--tph-radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--tph-transition);
}

.tph-playlist-item.active {
    background: var(--tph-bg-card);
    border-color: var(--tph-primary);
    box-shadow: var(--tph-shadow-sm);
}

.tph-playlist-item.active .tph-play-item {
    color: var(--tph-primary);
    font-weight: 700;
}

.tph-playlist-item:hover:not(.active) {
    background: var(--tph-bg-card);
    border-color: var(--tph-border);
}

.tph-drag-handle {
    cursor: grab;
    color: #94a3b8;
    margin-right: 12px;
    font-size: 1.2rem;
    user-select: none;
    transition: color 0.2s;
}

.tph-drag-handle:active {
    cursor: grabbing !important;
    color: var(--tph-primary) !important;
}

.tph-remove-item {
    color: var(--tph-text-muted);
    cursor: pointer;
    font-size: 1.3rem;
    font-weight: bold;
    transition: color 0.2s;
}

.tph-remove-item:hover { color: var(--tph-danger); }

.ui-sortable-helper {
    box-shadow: var(--tph-shadow-md);
    background: var(--tph-bg-card);
    opacity: 0.95;
    border: 1px solid var(--tph-primary) !important;
    transform: scale(1.02);
}


/* --------------------------------------------------------------------------
   4. LE LECTEUR (Studio)
   -------------------------------------------------------------------------- */
.tph-seance-stage {
    background: var(--tph-bg-card);
    padding: 25px; 
    border-radius: var(--tph-radius-lg);
    box-shadow: var(--tph-shadow-md);
    border: 1px solid var(--tph-border);
    
    display: flex;
    flex-direction: column;
    height: 80vh; 
}

#tph-stage-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
    min-height: 0; 
}

.tph-stage-empty {
    text-align: center;
    color: var(--tph-text-muted);
    padding-top: 10vh;
}

.tph-sticky-header {
    background: var(--tph-bg-card); 
    z-index: 10; 
    padding-top: 5px;
    border-bottom: 1px solid var(--tph-border);
    margin-bottom: 20px;
    flex-shrink: 0; 
}

#tph-active-title {
    color: var(--tph-text-main);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.tph-active-meta {
    display: flex;
    gap: 15px;
    color: var(--tph-text-muted);
    margin-bottom: 15px;
    font-weight: 500;
}

.tph-conseil-box {
    background: var(--tph-warning-bg);
    border-left: 4px solid var(--tph-warning-text);
    color: #92400e;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 0 var(--tph-radius-sm) var(--tph-radius-sm) 0;
}

.tph-scrollable-content {
    flex-grow: 1; 
    overflow-y: auto; 
    padding-right: 15px; 
}

.tph-scrollable-content::-webkit-scrollbar { width: 6px; }
.tph-scrollable-content::-webkit-scrollbar-track { background: transparent; }
.tph-scrollable-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.tph-scrollable-content::-webkit-scrollbar-thumb:hover { background: #94a3b8; }


/* ==========================================================================
   5. CENTRAGE ET TAILLE DU CONTENU (Partitions)
   ========================================================================== */
.tph-exercice-body {
    text-align: center;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--tph-text-main);
}

/* On nettoie les boîtes invisibles générées par l'éditeur WordPress */
.tph-exercice-body figure,
.tph-exercice-body .wp-block-image {
    margin: 0 0 25px 0 !important; 
    width: 100%;
    display: block;
}

/* On force toutes les images à s'étirer à 100% de la zone de lecture */
.tph-exercice-body img {
    display: block;
    margin: 0 auto !important;
    width: 100% !important; /* <-- La magie opère ici */
    height: auto !important; /* Garde les proportions intactes sans déformer la partition */
    border-radius: var(--tph-radius-sm);
    box-shadow: var(--tph-shadow-sm);
    
    /* NOUVEAU : Blocage des comportements tactiles natifs (Anti-zoom, Anti-menu) */
    -webkit-touch-callout: none; /* Bloque le menu "Enregistrer l'image" sur iOS */
    -webkit-user-select: none;   /* Empêche la sélection au toucher */
    user-select: none;
    -webkit-user-drag: none;     /* Empêche de faire "glisser" l'image */
    pointer-events: none;        /* Rend l'image "transparente" aux clics : le doigt glisse directement sur le lecteur ! */
}

    /* Désactive les liens (<a>) générés par WordPress autour des images */
.tph-exercice-body .wp-block-image a,
.tph-exercice-body figure a,
.tph-exercice-body a:has(img) {
    pointer-events: none !important;
    cursor: default !important;
    display: block;
}


/* ==========================================================================
   6. MODE PLEIN ÉCRAN OPTIMISÉ
   ========================================================================== */
:fullscreen .tph-seance-stage { height: 100dvh; padding: 25px 40px; border-radius: 0; border: none; }
:-webkit-full-screen .tph-seance-stage { height: 100dvh; padding: 25px 40px; border-radius: 0; border: none; }

:fullscreen .tph-sticky-header { padding-top: 10px; margin-bottom: 15px; }
:fullscreen #tph-active-title { font-size: 1.5rem; margin-bottom: 5px; }
:fullscreen .tph-active-meta { font-size: 0.9rem; margin-bottom: 10px; }
:fullscreen .tph-stage-controls { padding-bottom: 10px; }

:-webkit-full-screen .tph-sticky-header { padding-top: 10px; margin-bottom: 15px; }
:-webkit-full-screen #tph-active-title { font-size: 1.5rem; margin-bottom: 5px; }
:-webkit-full-screen .tph-active-meta { font-size: 0.9rem; margin-bottom: 10px; }


/* ==========================================================================
   7. LE HUB CENTRAL (Onglets)
   ========================================================================== */
.tph-hub-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tph-hub-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--tph-border);
    padding-bottom: 15px;
}

.tph-tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--tph-text-muted);
    cursor: pointer;
    border-radius: 30px; /* Style "Pillule" très moderne */
    transition: var(--tph-transition);
}

.tph-tab-btn:hover {
    background: var(--tph-bg-body);
    color: var(--tph-text-main);
}

/* --- COULEURS SPÉCIFIQUES POUR CHAQUE ONGLET ACTIF --- */

/* 1. Ma Séance : Vert Émeraude (Action / Pratique) */
.tph-tab-btn[data-target="tph-tab-seance"].active {
    background: #10b981;
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

/* 2. Catalogue d'Exercices : Bleu Principal (Standard) */
.tph-tab-btn[data-target="tph-tab-exercices"].active {
    background: var(--tph-primary);
    color: white;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

/* Nouvel onglet Études & Pièces (à ajouter si ce n'est pas déjà fait !) */
.tph-tab-btn[data-target="tph-tab-etudes"].active {
    background: #4f46e5; /* Indigo profond */
    color: white;
    box-shadow: 0 4px 10px rgba(219, 39, 119, 0.3);
}

/* 3. Programmes : Violet */
.tph-tab-btn[data-target="tph-tab-programmes"].active {
    background: #8b5cf6;
    color: white;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

/* 4. Générateur Aléatoire : Orange */
.tph-tab-btn[data-target="tph-tab-generateur"].active {
    background: #f59e0b;
    color: white;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

/* 5. Favoris : Rose (Cœur) */
.tph-tab-btn[data-target="tph-tab-favoris"].active {
    background: #ec4899;
    color: white;
    box-shadow: 0 4px 10px rgba(236, 72, 153, 0.3);
}

/* 6. Mon Suivi : Cyan (Statistiques) */
.tph-tab-btn[data-target="tph-tab-suivi"].active {
    background: #06b6d4;
    color: white;
    box-shadow: 0 4px 10px rgba(6, 182, 212, 0.3);
}

/* --------------------------------------------------------------------------
   8. OPTIMISATION MOBILE (CHANGEMENTS DEMANDÉS)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    /* Masquage titre/meta pour navigation */
    #tph-active-title, 
    .tph-active-meta,
    .tph-stage-header span#tph-progress {
        display: none !important;
    }

    .tph-seance-app { grid-template-columns: 1fr; gap: 20px; }

    .tph-sticky-header {
        margin-bottom: 10px !important;
        padding-bottom: 5px !important;
        border-bottom: none !important;
    }

    .tph-hub-tabs { 
        flex-wrap: nowrap; 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        margin-bottom: 15px;
        border-bottom: none;
        scrollbar-width: none; 
    }
    .tph-hub-tabs::-webkit-scrollbar { display: none; }
    
    .tph-tab-btn {
        flex: 0 0 auto; 
        white-space: nowrap; 
        font-size: 0.95rem;
        padding: 8px 16px;
    }

    .tph-seance-stage { height: auto; min-height: 80vh; padding: 10px !important; }
    .tph-exercice-body img { width: 100% !important; }

    /* Outils flottants */
    #tph-metronome-panel, #tph-drone-panel, #tph-tuner-panel {
        position: absolute;
        left: 10px;
        right: 10px;
        z-index: 100;
        background: white;
        border: 1px solid var(--tph-primary);
        box-shadow: var(--tph-shadow-md);
        padding: 15px !important;
    }

    .tph-stage-controls {
        display: none; 
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 8px !important;
        padding: 10px;
        background: #f1f5f9;
        border-radius: var(--tph-radius-sm);
    }

    .tph-mobile-tools-toggle {
        display: block !important;
        width: 100%;
        background: var(--tph-bg-body);
        border: 1px solid var(--tph-border);
        color: var(--tph-primary);
        padding: 6px !important;
        font-size: 0.75rem !important;
        font-weight: bold;
        margin-bottom: 8px;
        cursor: pointer;
    }
}

.tph-mobile-tools-toggle { display: none; }

/* ==========================================================================
   PLEIN ÉCRAN FORCÉ (Contournement Apple / iPad / iOS)
   ========================================================================== */
.tph-ios-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    z-index: 999999 !important; /* Pour passer au-dessus des menus de ton thème WordPress */
    background: var(--tph-bg-body, #ffffff) !important;
    overflow-y: auto !important;
    margin: 0 !important;
    border-radius: 0 !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}