/* ===== CORRECTIONS RESPONSIVE POUR LES BOUTONS ===== */

/* Corrections générales pour tous les boutons sur mobile */
@media screen and (max-width: 768px) {
    /* S'assurer que tous les conteneurs de boutons sont en colonne */
    .action-buttons,
    .digicode-actions,
    .enigma-buttons,
    .buttons-container,
    .puzzle-actions,
    .lake-actions,
    .navigation-actions,
    .statuettes-actions,
    .cooking-actions,
    .subway-actions,
    .gifts-actions,
    .sweets-actions,
    .alchemy-actions,
    .chess-actions,
    .numeric-actions,
    .text-actions,
    .maze-actions,
    .hint-navigation {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 15px auto !important;
        padding: 0 10px !important;
        box-sizing: border-box !important;
    }

    /* Taille uniforme pour tous les boutons */
    .action-buttons button,
    .digicode-actions button,
    .enigma-buttons button,
    .buttons-container button,
    .puzzle-actions button,
    .lake-actions button,
    .navigation-actions button,
    .statuettes-actions button,
    .cooking-actions button,
    .subway-actions button,
    .gifts-actions button,
    .sweets-actions button,
    .alchemy-actions button,
    .chess-actions button,
    .numeric-actions button,
    .text-actions button,
    .maze-actions button,
    #hintBtn,
    #validateBtn,
    #clearBtn,
    #resetBtn,
    #resetSequenceBtn,
    .btn-primary,
    .btn-secondary,
    .btn-clear {
        width: 100% !important;
        max-width: 280px !important;
        min-width: 0 !important;
        margin: 0 auto !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
        line-height: 1.2 !important;
        text-align: center !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Icônes et texte dans les boutons */
    .btn-icon {
        font-size: 1rem !important;
        margin-right: 6px !important;
    }

    .btn-text {
        font-size: 14px !important;
        font-weight: 500 !important;
    }

    /* Boutons avec icônes et texte */
    button .btn-icon + .btn-text {
        margin-left: 6px !important;
    }
}

/* Corrections spécifiques pour très petits écrans */
@media screen and (max-width: 480px) {
    .action-buttons,
    .digicode-actions,
    .enigma-buttons,
    .buttons-container,
    .puzzle-actions,
    .lake-actions,
    .navigation-actions,
    .statuettes-actions,
    .cooking-actions,
    .subway-actions,
    .gifts-actions,
    .sweets-actions,
    .alchemy-actions,
    .chess-actions,
    .numeric-actions,
    .text-actions,
    .maze-actions {
        padding: 0 5px !important;
        gap: 6px !important;
    }

    .action-buttons button,
    .digicode-actions button,
    .enigma-buttons button,
    .buttons-container button,
    .puzzle-actions button,
    .lake-actions button,
    .navigation-actions button,
    .statuettes-actions button,
    .cooking-actions button,
    .subway-actions button,
    .gifts-actions button,
    .sweets-actions button,
    .alchemy-actions button,
    .chess-actions button,
    .numeric-actions button,
    .text-actions button,
    .maze-actions button,
    #hintBtn,
    #validateBtn,
    #clearBtn,
    #resetBtn,
    #resetSequenceBtn,
    .btn-primary,
    .btn-secondary,
    .btn-clear {
        max-width: 260px !important;
        padding: 10px 14px !important;
        font-size: 13px !important;
    }

    .btn-icon {
        font-size: 0.9rem !important;
        margin-right: 4px !important;
    }

    .btn-text {
        font-size: 13px !important;
    }
}

/* Corrections pour écrans très étroits */
@media screen and (max-width: 360px) {
    .action-buttons,
    .digicode-actions,
    .enigma-buttons,
    .buttons-container,
    .puzzle-actions,
    .lake-actions,
    .navigation-actions,
    .statuettes-actions,
    .cooking-actions,
    .subway-actions,
    .gifts-actions,
    .sweets-actions,
    .alchemy-actions,
    .chess-actions,
    .numeric-actions,
    .text-actions,
    .maze-actions {
        padding: 0 2px !important;
    }

    .action-buttons button,
    .digicode-actions button,
    .enigma-buttons button,
    .buttons-container button,
    .puzzle-actions button,
    .lake-actions button,
    .navigation-actions button,
    .statuettes-actions button,
    .cooking-actions button,
    .subway-actions button,
    .gifts-actions button,
    .sweets-actions button,
    .alchemy-actions button,
    .chess-actions button,
    .numeric-actions button,
    .text-actions button,
    .maze-actions button,
    #hintBtn,
    #validateBtn,
    #clearBtn,
    #resetBtn,
    #resetSequenceBtn,
    .btn-primary,
    .btn-secondary,
    .btn-clear {
        max-width: 240px !important;
        padding: 9px 12px !important;
        font-size: 12px !important;
    }

    .btn-text {
        font-size: 12px !important;
    }
}

/* Corrections spécifiques pour certains boutons problématiques */
@media screen and (max-width: 768px) {
    /* Boutons de navigation dans les indices */
    .hint-navigation {
        justify-content: center !important;
        align-items: center !important;
        padding: 15px 10px !important;
        border-top: 1px solid var(--border-color) !important;
    }

    .hint-navigation button {
        width: 100% !important;
        max-width: 200px !important;
        margin: 0 auto !important;
    }

    /* Corrections pour les modales */
    .modal-content .action-buttons,
    .modal-content .hint-navigation {
        width: 100% !important;
        padding: 0 !important;
    }

    .modal-content button {
        width: 100% !important;
        max-width: 250px !important;
        margin: 5px auto !important;
    }

    /* Boutons spéciaux avec texte long */
    button[id*="validate"],
    button[id*="Validate"] {
        font-size: 13px !important;
        padding: 10px 12px !important;
    }

    /* Conteneurs avec besoins spéciaux */
    .enigma-section .action-buttons,
    .puzzle-container .action-buttons {
        margin: 10px 0 !important;
        padding: 0 5px !important;
    }
}

/* Assurer que les boutons ne débordent jamais */
@media screen and (max-width: 768px) {
    button,
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-clear {
        max-width: calc(100vw - 40px) !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* Empêcher le débordement horizontal */
    .action-buttons,
    .enigma-buttons,
    .buttons-container,
    .puzzle-actions {
        overflow-x: hidden !important;
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* Mode paysage sur mobile - boutons plus compacts */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .action-buttons,
    .digicode-actions,
    .enigma-buttons,
    .buttons-container,
    .puzzle-actions {
        gap: 5px !important;
        margin: 8px auto !important;
    }

    .action-buttons button,
    .digicode-actions button,
    .enigma-buttons button,
    .buttons-container button,
    .puzzle-actions button,
    #hintBtn,
    #validateBtn,
    #clearBtn {
        padding: 8px 12px !important;
        font-size: 12px !important;
        max-width: 200px !important;
    }
}

/* Corrections pour les thèmes alternatifs */
html[data-theme="alternate"] .action-buttons button,
html[data-theme="alternate"] .enigma-buttons button,
html[data-theme="minimal"] .action-buttons button,
html[data-theme="minimal"] .enigma-buttons button {
    max-width: 280px !important;
    width: 100% !important;
}

@media screen and (max-width: 768px) {
    html[data-theme="alternate"] .action-buttons,
    html[data-theme="alternate"] .enigma-buttons,
    html[data-theme="minimal"] .action-buttons,
    html[data-theme="minimal"] .enigma-buttons {
        flex-direction: column !important;
        width: 100% !important;
    }
}