/* Thème personnalisé pour Shepherd.js */
.custom-shepherd-theme {
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-width: 400px;
}

.shepherd-element {
    z-index: 9999;
}

.shepherd-modal-overlay-container {
    z-index: 9998;
}

/* Style spécial pour les étapes dans les modals */
.modal-step-tour.shepherd-element {
    z-index: 99999 !important; /* Très au-dessus de tout */
    position: fixed !important;
}

/* IMPORTANT : Forcer Popper.js à recalculer la position */
.modal-step-tour.shepherd-element[data-popper-placement] {
    transform: none !important; /* Éviter les transformations qui déplacent hors écran */
}

/* Forcer le z-index de tous les éléments Shepherd dans les modals */
.shepherd-element.modal-step-tour,
.shepherd-element.modal-step-tour .shepherd-content,
.shepherd-element.modal-step-tour .shepherd-arrow {
    z-index: 99999 !important;
}

/* S'assurer que le modal ne cache pas la bulle */
.modal.show {
    z-index: 1050 !important;
}

.modal-backdrop.show {
    z-index: 1040 !important;
}

/* Empêcher le scroll du body quand une bulle de modal est active */
body.shepherd-active .modal.show {
    overflow-y: auto !important;
}

/* Assurer que le modal body peut défiler */
.modal.show .modal-body {
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

/* Assurer que la bulle reste au-dessus du modal avec un beau style */
.modal-step-tour .shepherd-content {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    background: #021532 !important;
}

/* Si la bulle est trop basse, la repositionner */
.modal-step-tour.shepherd-element {
    max-height: 90vh;
    overflow: visible;
}

/* Ajustement pour les bulles qui seraient hors viewport */
@media (max-height: 800px) {
    .modal-step-tour.shepherd-element[data-popper-placement*="bottom"] {
        top: auto !important;
        bottom: 20px !important;
    }
}

.shepherd-content {
    padding: 5px;
    background: #021532;
    border-radius: 12px;
}

.shepherd-text {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
}

.shepherd-text h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: 600;
    color: #cda800;
}

.shepherd-text p {
    margin: 0;
    color: #ffffff;
}

.shepherd-header {
    padding: 0 0 16px 0;
    border-bottom: 1px solid #021532;;
    margin-bottom: 16px;
}

.shepherd-cancel-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    color: #cda800;
}

.shepherd-cancel-icon:hover {
    opacity: 1;
    color: #cda800;
}

.shepherd-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #cda800;
}

.shepherd-button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shepherd-button-primary {
    background: #3b82f6;
    color: white;
}

.shepherd-button-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.shepherd-button-secondary {
    background: #f3f4f6;
    color: #374151;
}

.shepherd-button-secondary:hover {
    background: #e5e7eb;
}

/* Animation d'apparition */
.shepherd-element {
    opacity: 0;
    transform: scale(0.95);
    animation: shepherdFadeIn 0.3s ease forwards;
}

@keyframes shepherdFadeIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Flèche du tooltip */
.shepherd-arrow {
    width: 16px;
    height: 16px;
}

.shepherd-arrow:before {
    background: #ffffff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Élément mis en surbrillance */
.shepherd-enabled.shepherd-element-attached-top .shepherd-target {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.5);
    border-radius: 8px;
    transition: box-shadow 0.3s ease;
}

/* Overlay modal */
.shepherd-modal-overlay-container.shepherd-modal-is-visible {
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 640px) {
    .custom-shepherd-theme {
        max-width: calc(100vw - 32px);
    }
    
    .shepherd-content {
        padding: 20px;
    }
    
    .shepherd-text h3 {
        font-size: 18px;
    }
    
    .shepherd-text {
        font-size: 14px;
    }
    
    .shepherd-footer {
        flex-direction: column;
    }
    
    .shepherd-button {
        width: 100%;
    }
}

/* Bouton pour relancer le tour (optionnel) */
.restart-tour-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.2s ease;
    z-index: 1000;
}

.restart-tour-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

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

/* ========================================== */
/* STYLES POUR CORRIGER L'OVERLAY SUR LES MENUS */
/* ========================================== */

/* Assurer que l'overlay englobe bien tout le texte du menu */
.shepherd-modal-overlay-container {
    pointer-events: auto;
}

/* Style pour les éléments de menu dans le tour */
.shepherd-enabled.shepherd-element {
    z-index: 9999 !important;
}

/* S'assurer que le texte des menus est bien visible pendant le tour */
.account-page-menu li.shepherd-target,
.account-page-menu li.shepherd-target a {
    position: relative;
    z-index: 9999;
}

/* Améliorer le contraste de l'élément surligné dans le menu */
.shepherd-target,
.account-page-menu a.shepherd-target {
    position: relative !important;
    z-index: 9999 !important;
    background-color: white !important;
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.95),
                0 0 30px rgba(0, 0, 0, 0.3) !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

/* Pour les liens de menu spécifiquement */
.account-page-menu a.shepherd-target {
    padding: 12px 20px !important;
    display: block !important;
}

/* Forcer l'ouverture dans l'overlay à être bien visible */
.shepherd-modal-overlay-container .shepherd-modal-is-visible path {
    pointer-events: auto;
}

/* Animation subtile pour attirer l'attention sur l'élément surligné */
@keyframes shepherd-pulse-menu {
    0%, 100% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.95),
                    0 0 30px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 0 14px rgba(255, 255, 255, 1),
                    0 0 40px rgba(0, 0, 0, 0.4);
    }
}

.shepherd-target {
    animation: shepherd-pulse-menu 2s ease-in-out infinite;
}

/* Désactiver l'animation sur les sous-menus ouverts pour éviter les conflits visuels */
.menu-has-children.current-menu-item .shepherd-target {
    animation: none;
}

/* Assurer que l'élément parent (li) ne masque pas l'effet */
.account-page-menu li {
    position: relative;
    overflow: visible !important;
}

/* Style spécial pour les éléments de menu qui ont des sous-menus */
.menu-has-children > a.shepherd-target {
    z-index: 10000 !important;
}

/* Forcer l'overlay sombre à être bien visible autour de l'élément ciblé */
.shepherd-modal-overlay-container.shepherd-modal-is-visible {
    background-color: rgba(0, 0, 0, 0.6) !important;
}

/* S'assurer que les icônes dans le menu restent visibles */
.shepherd-target .iconify {
    position: relative;
    z-index: 10001;
}

/* Fix pour Safari et autres navigateurs webkit */
@supports (-webkit-appearance: none) {
    .shepherd-target {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}
