/* 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);
}