/**
 * Styles Frontend pour LinguaCommerce AI
 * Version Corrigée : Z-Index, Responsive, Ergonomie
 */

/* --- RESET DE BASE --- */
.lingua-selector * { box-sizing: border-box; margin: 0; padding: 0; }
.lingua-selector img { max-width: 100%; height: auto; display: inline-block; vertical-align: middle; }

/* --- TEMPLATE 1 : DRAPEAUX COMPACTS --- */
.lingua-template-flags_only { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.lingua-template-flags_only a { 
    line-height: 1; 
    padding: 2px; 
    border: 1px solid transparent; 
    border-radius: 3px; 
    transition: all 0.2s; 
}
.lingua-template-flags_only a:hover { opacity: 0.8; border-color: #2271b1; }
.lingua-template-flags_only img { width: 24px; height: 16px; object-fit: cover; border-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

/* --- TEMPLATE 2 : LISTE DÉROULANTE (DROPDOWN) --- */
.lingua-template-dropdown { position: relative; display: inline-block; z-index: 99999; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.lingua-dropdown-btn { 
    background: #fff; border: 1px solid #ddd; padding: 6px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; border-radius: 4px; min-width: 130px; justify-content: space-between; transition: all 0.2s; height: 36px;
}
.lingua-dropdown-btn:hover { border-color: #aaa; }
.lingua-dropdown-btn img { width: 22px; height: 16px; border-radius: 2px; }
.lingua-dropdown-btn::after { content: '▼'; font-size: 10px; color: #666; transition: transform 0.2s; }
.lingua-template-dropdown.open .lingua-dropdown-btn::after { transform: rotate(180deg); }

.lingua-dropdown-list { 
    position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid #ddd; display: none; min-width: 160px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.15); margin-top: 5px; border-radius: 4px; overflow: hidden; right: 0; /* Fix mobile */
}
.lingua-template-dropdown:hover .lingua-dropdown-list, .lingua-template-dropdown.open .lingua-dropdown-list { display: block; }

.lingua-dropdown-list a { 
    display: flex; align-items: center; gap: 10px; padding: 8px 12px; text-decoration: none; color: #333; font-size: 14px; transition: background 0.2s; border-bottom: 1px solid #f0f0f0;
}
.lingua-dropdown-list a:last-child { border-bottom: none; }
.lingua-dropdown-list a:hover { background: #f5f5f5; color: #000; }
.lingua-dropdown-list img { width: 22px; height: 16px; border-radius: 2px; }
.lingua-dropdown-list .active { background-color: #f0f7ff; font-weight: bold; pointer-events: none; opacity: 0.7; }

/* --- TEMPLATE 3 : MENU FLOTTANT (FLOATING) --- */
.lingua-template-floating_bubble { position: fixed; right: 0; top: 45%; z-index: 999999; font-family: sans-serif; }
.lingua-floating-btn { 
    background: #2271b1; color: #fff; width: 45px; height: 45px; border-radius: 5px 0 0 5px; cursor: pointer; 
    display: flex; align-items: center; justify-content: center; font-size: 20px; 
    box-shadow: -2px 2px 10px rgba(0,0,0,0.2); transition: width 0.3s;
}
.lingua-floating-list { 
    position: absolute; right: 100%; top: 0; background: #fff; border: 1px solid #ddd; margin-right: 5px; display: none; 
    box-shadow: -2px 2px 10px rgba(0,0,0,0.1); border-radius: 5px; overflow: hidden; min-width: 150px;
}
.lingua-floating-list a { display: flex; align-items: center; gap: 8px; padding: 10px 15px; color: #333; text-decoration: none; border-bottom: 1px solid #eee; font-size: 14px; white-space: nowrap; }
.lingua-floating-list a:hover { background: #f9f9f9; }
.lingua-floating-list img { width: 20px; height: 14px; border-radius: 2px; }

/* Hover logic for desktop */
@media (min-width: 768px) {
    .lingua-template-floating_bubble:hover .lingua-floating-list { display: block; }
}

/* Click logic for mobile handled in JS */

/* --- TEMPLATE 4 : PUCES TEXTUELLES (TEXT_PILLS) --- */
.lingua-template-text_pills { display: flex; gap: 4px; align-items: center; font-family: sans-serif; }
.lingua-template-text_pills a { 
    text-decoration: none; color: #555; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 15px; 
    transition: all 0.2s; border: 1px solid #eee;
}
.lingua-template-text_pills a:hover { background: #f0f0f0; border-color: #ccc; color: #000; }
.lingua-template-text_pills a.active { background: #2271b1; color: #fff; border-color: #2271b1; pointer-events: none; }

/* --- TEMPLATE 5 : MENU INJECTÉ (NAV_MENU) --- */
.lingua-template-nav_menu ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 15px; align-items: center; }
.lingua-template-nav_menu li { margin: 0; list-style: none; }
.lingua-template-nav_menu a { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 6px; font-size: 14px; }
.lingua-template-nav_menu a:hover { opacity: 0.8; }
.lingua-template-nav_menu img { width: 16px; height: 11px; border-radius: 2px; }

/* --- TEMPLATE 6 : POPIN MODAL (MODAL) --- */
.lingua-modal-trigger { 
    background: #fff; border: 1px solid #ccc; padding: 6px 12px; cursor: pointer; border-radius: 4px; 
    display: flex; align-items: center; gap: 6px; font-size: 14px; transition: all 0.2s; height: 36px;
}
.lingua-modal-trigger:hover { background: #f5f5f5; }

.lingua-modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); 
    z-index: 9999999; display: none; justify-content: center; align-items: center; 
    backdrop-filter: blur(3px);
}
.lingua-modal-overlay.active { display: flex; }
.lingua-modal-content { 
    background: #fff; padding: 30px; border-radius: 10px; max-width: 400px; width: 90%; text-align: center; 
    position: relative; max-height: 80vh; overflow-y: auto; animation: popIn 0.3s ease;
}
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.lingua-modal-close { position: absolute; top: 10px; right: 15px; font-size: 20px; cursor: pointer; color: #888; background: none; border: none; }
.lingua-modal-close:hover { color: #000; }
.lingua-modal-list { margin-top: 20px; display: grid; gap: 8px; }
.lingua-modal-list a { 
    display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid #eee; border-radius: 6px; 
    text-decoration: none; color: #333; justify-content: flex-start; transition: background 0.2s;
}
.lingua-modal-list a:hover { background: #f9f9f9; border-color: #ddd; }
.lingua-modal-list img { width: 24px; height: 16px; border-radius: 2px; }

/* --- RESPONSIVE FIXES --- */
@media (max-width: 768px) {
    .lingua-template-floating_bubble { bottom: 20px; top: auto; }
    .lingua-floating-list { position: fixed; top: auto; bottom: 70px; right: 10px; left: 10px; width: auto; margin-right: 0; min-width: 0; }
    .lingua-floating-list a { justify-content: center; font-size: 15px; }
    
    .lingua-dropdown-list { left: auto; right: 0; min-width: 140px; } /* Align right on mobile */
}