/**
 * helpStyles.css
 * Styles pour les composants d'aide du générateur de code GIFT
 */

/* Bouton d'aide — premier élément de la pile fixe en haut à droite.
   La pile (Aide → Prévisualiser → Signaler un bug) est alignée à droite, à
   largeur FIXE (cf. previewStyles.css / bugReportStyles.css), pour ne plus
   chevaucher ni varier selon le libellé (chantier UI/UX n°10). */
.help-btn {
    position: fixed;
    right: 12px;
    top: 12px;
    width: 150px;
    box-sizing: border-box;
    height: 36px;
    border-radius: 18px;
    background-color: #005EB8;
    color: white;
    border: none;
    font-weight: bold;
    padding: 0 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000; /* S'assurer qu'il est au-dessus des autres éléments */
}

.help-btn:hover {
    background-color: #004C9B;
    transform: scale(1.05);
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
    font-size: 16px;
}

.help-text {
    font-size: 14px;
}

/* Utilisé dans le message de fin du tour */
.help-btn-mini {
    display: inline-flex;
    align-items: center;
    background-color: #005EB8;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin: 0 3px;
}

/* Panneau d'aide latéral */
.help-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    background-color: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1001; /* Au-dessus des boutons fixes */
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.help-panel.hidden {
    transform: translateX(100%);
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #005EB8;
    color: white;
    border-bottom: 1px solid #004C9B;
    position: sticky;
    top: 0;
    z-index: 10;
}

.help-header h2 {
    margin: 0;
    font-size: 1.4em;
    color: white;
}

.help-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
}

.help-close-btn:hover {
    transform: scale(1.2);
}

/* Onglets du panneau d'aide */
.help-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background-color: #f5f5f5;
    position: sticky;
    top: 56px; /* Hauteur du header */
    z-index: 5;
}

.help-tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.help-tab-btn:hover {
    background-color: #EBF5FB;
}

.help-tab-btn.active {
    border-bottom-color: #005EB8;
    background-color: white;
}

/* Conteneur bouton tour guidé */
.start-tour-container {
    background-color: #f0f8ff;
    border: 1px solid #cce5ff;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
}

.start-tour-container p {
    margin-top: 0;
    margin-bottom: 10px;
}

/* Boutons du bloc « Nouveau sur l'outil ? » (tour guidé + guide PDF) :
   espacés et passant à la ligne proprement sur petite largeur. */
.start-tour-container .control-btn {
    margin: 4px;
}

/* Contenu du panneau d'aide */
.help-content {
    padding: 20px;
}

.help-tab-content {
    display: none;
}

.help-tab-content.active {
    display: block;
}

.help-tab-content h3 {
    color: #005EB8;
    margin-top: 0;
    margin-bottom: 15px;
}

.help-tab-content h4 {
    color: #2C3E50;
    margin-top: 20px;
    margin-bottom: 10px;
}

.help-tab-content p {
    margin-bottom: 15px;
    line-height: 1.5;
}

.help-tab-content ul, .help-tab-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.help-tab-content li {
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Tooltips contextuels (sans icônes) avec délai */
[data-tooltip] {
    position: relative;
}

/* Ajout d'une animation de transition pour l'affichage du tooltip */
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Base du tooltip invisible */
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    width: max-content;
    max-width: 200px;
    background-color: #333;
    color: white;
    padding: 8px 10px;
    border-radius: 4px;
    z-index: 1000;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition-property: opacity, visibility;
    transition-duration: 0.15s;
    transition-delay: 0s;
}

[data-tooltip]::before {
    content: "";
    position: absolute;
    border-width: 5px;
    border-style: solid;
    border-color: transparent;
    opacity: 0;
    visibility: hidden;
    transition-property: opacity, visibility;
    transition-duration: 0.15s;
    transition-delay: 0s;
    pointer-events: none;
}

/* Position du tooltip selon l'élément (par défaut en bas) */
[data-tooltip]::after {
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
}

/* Affichage du tooltip avec délai au survol (1 seconde) */
[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transition-delay: 1s; /* Délai d'une seconde avant affichage */
    animation: tooltipFadeIn 0.25s ease-in-out;
}

button[data-tooltip]::after {
    top: auto;
    bottom: 100%;
    transform: translateX(-50%) translateY(-8px);
}

input[data-tooltip]::after,
select[data-tooltip]::after {
    left: 0;
    transform: translateX(0) translateY(8px);
}

/* Flèche du tooltip */
[data-tooltip]::before {
    border-color: transparent transparent #333 transparent;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
}

button[data-tooltip]::before {
    top: auto;
    bottom: 100%;
    border-color: #333 transparent transparent transparent;
}

input[data-tooltip]::before,
select[data-tooltip]::before {
    left: 10px;
    transform: translateX(0);
}

/* Styles pour les éléments d'aide en responsive */
@media (max-width: 768px) {
    .help-panel {
        width: 100%;
    }
    
    .help-btn {
        right: 8px;
        top: 8px;
        width: 130px;
        height: 32px;
        padding: 0 10px;
        font-size: 13px;
    }
    
    [data-tooltip]:hover::after {
        max-width: 160px;
    }

    .help-text {
        font-size: 12px;
    }
}
