/* ===== COMPONENTS - BOUTONS, CARTES, TOAST, HANGMAN ===== */

/* ===== BOUTONS ===== */

.btn {
    background: linear-gradient(135deg, var(--primary-color), #e67e22);
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-round);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.3);
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(243, 156, 18, 0.4);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #e67e22);
    color: #fff;
    border: none;
    padding: calc(var(--spacing-md) * 1.5) var(--spacing-xxl);
    font-size: 1.2rem;
    border-radius: var(--radius-round);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 8px 20px rgba(243, 156, 18, 0.3);
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(243, 156, 18, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-primary);
    padding: 1.2rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-round);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.2);
}

.btn-restart {
    background: linear-gradient(135deg, #2ed573, #1dd8aa);
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-round);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 5px 15px rgba(46, 213, 115, 0.3);
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

.btn-restart:hover {
    background: linear-gradient(135deg, #1dd8aa, #2ed573);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(46, 213, 115, 0.4);
}

/* ===== CARTES ===== */

.card {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-primary);
    transition: all var(--transition-normal);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.stat-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-primary);
    transition: all var(--transition-normal);
    text-align: center;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.stat-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-shadow);
}

.stat-label {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cartes de jeu */
.category-card, 
.progress-card,
.streak-card {
    flex: 1;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
    border: 1px solid var(--border-light);
}

.category-card h3, 
.progress-card h3,
.streak-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-card p {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-primary);
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    margin: 0;
}

.progress-card p {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
}

.streak-card p {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--warning-color);
    text-shadow: 0 0 10px rgba(255, 107, 53, 0.5);
}

/* Cartes statistiques détaillées */
.big-stat-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xxl) var(--spacing-xl);
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-primary);
    transition: all var(--transition-normal);
}

.big-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
}

.big-stat-number {
    font-size: 4rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 20px var(--primary-shadow);
    margin-bottom: var(--spacing-sm);
}

.big-stat-label {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.big-stat-total,
.big-stat-current {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ===== ACHIEVEMENTS ===== */

.achievement-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    border: 2px solid;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.achievement-card.unlocked {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.3);
}

.achievement-card.locked {
    border-color: var(--border-primary);
    opacity: 0.6;
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
}

.achievement-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.achievement-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.achievement-card.unlocked::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    color: var(--success-color);
    font-weight: bold;
}

/* ===== HANGMAN SVG ===== */

.hangman-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

#hangman .part {
    display: none;
}

#hangman .part.visible {
    display: block;
}

/* ===== CLAVIER MOBILE ===== */

.keyboard {
    display: none; /* Sera affiché par le JS sur mobile */
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Afficher le clavier sur mobile uniquement */
@media (max-width: 768px) {
    .keyboard:not(:empty) {
        display: grid;
    }
}

.keyboard button {
    background: rgba(233, 69, 96, 0.2);
    color: #fff;
    border: 1px solid rgba(233, 69, 96, 0.5);
    padding: 0.8rem;
    font-size: 1.2rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
}

.keyboard button:hover:not(:disabled) {
    background: rgba(233, 69, 96, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(233, 69, 96, 0.3);
}

.keyboard button:active:not(:disabled) {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.keyboard button:disabled {
    cursor: not-allowed;
}

/* Boutons disabled sans état spécial (gris) - avec scale seulement pour ceux-ci */
.keyboard button:disabled:not(.correct):not(.wrong) {
    background: rgba(0, 0, 0, 0.5);
    color: #666;
    transform: scale(0.95); /* Scale seulement pour les boutons gris */
}

.keyboard button.correct {
    background: #2ed573 !important; /* Force la couleur même si disabled */
    border-color: #27ae60;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(46, 213, 115, 0.4);
}

.keyboard button.wrong {
    background: #e74c3c !important; /* Force la couleur même si disabled */
    border-color: #c0392b;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

/* ===== AFFICHAGE DU MOT ===== */

.word-display {
    font-size: 2.5rem;
    letter-spacing: 0;
    text-align: center;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.2rem;
    width: 100%;
    padding: 0 var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.word-display .word-group {
    display: inline-flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
}

.word-display span {
    border-bottom: 3px solid var(--primary-color);
    margin: 0 0.2rem;
    padding: 0 0.5rem;
    display: inline-block;
    min-width: 2rem;
    min-height: 1.2em;
    line-height: 1.2;
    text-align: center;
}

/* Assurer un espacement consistant pour les lettres vides */
.word-display span:empty::before {
    content: '\00a0'; /* Espace insécable pour maintenir la hauteur et largeur */
    visibility: hidden;
}

/* Indicateur d'espace entre les mots */
.space-indicator {
    display: inline-flex;
    width: 1.5rem;
    justify-content: center;
    align-items: flex-end;
    position: relative;
}

.space-indicator::after {
    content: '·';
    font-size: 1.5rem;
    color: var(--primary-color);
    opacity: 0.5;
    position: absolute;
    bottom: -0.3em;
}

/* ===== TOASTS ===== */

.toast {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, 0) scale(0.8);
    background: var(--bg-secondary);
    border: 2px solid;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg) var(--spacing-xl);
    z-index: 1000;
    opacity: 0;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    min-width: 300px;
    text-align: center;
}

.toast-show {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.toast-hide {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.8);
}

.toast-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
}

.toast-icon {
    font-size: 2rem;
    line-height: 1;
}

.toast-message {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
}

.toast-win {
    border-color: var(--success-color);
    background: rgba(46, 213, 115, 0.1);
    color: var(--success-color);
}

.toast-lose {
    border-color: var(--error-color);
    background: rgba(255, 107, 107, 0.1);
    color: var(--error-color);
}

/* ===== GAME MESSAGE ===== */

.game-message {
    text-align: center;
    margin-top: var(--spacing-md);
    font-size: 1.1rem;
    font-weight: 600;
}