/**
 * ESTILOS PARA SISTEMA DE TRADUCCIÓN AUTOMÁTICA
 * 
 * Diseño moderno, animaciones suaves y responsive
 */

/* ============================================ */
/* SELECTOR DE IDIOMA */
/* ============================================ */

/* Selector en navbar */
#navbar-language-selector {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Selector flotante (fallback) */
.language-selector {
    position: fixed !important;
    top: 80px !important;
    right: 20px !important;
    z-index: 99999 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    pointer-events: all !important;
}

.language-selector-btn {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(139, 92, 246, 0.95) !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    font-size: 14px;
    font-weight: 600;
    color: white !important;
}

/* Estilo específico para navbar */
.navbar-language-btn {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-light)) !important;
    border: none !important;
    padding: 8px 16px !important;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3) !important;
}

.navbar-language-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5) !important;
}

.language-selector-btn:hover {
    background: rgba(168, 85, 247, 1) !important;
    border-color: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5) !important;
    transform: translateY(-2px) scale(1.05);
}

.language-icon {
    font-size: 20px;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.language-selector.translated .language-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.language-current {
    font-weight: 700;
    color: white !important;
    min-width: 24px;
    text-align: center;
}

.language-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
    color: white !important;
}

.language-selector-btn:hover .language-arrow {
    transform: translateY(2px);
}

/* Dropdown */
.language-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(26, 22, 37, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    min-width: 280px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 10000;
}

.language-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.language-dropdown.hidden {
    display: none;
}

.language-dropdown-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-light));
    color: var(--light-cream);
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
}

.language-dropdown-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.language-dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.language-dropdown-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.language-dropdown-list::-webkit-scrollbar-thumb {
    background: #8b5cf6;
    border-radius: 3px;
}

.language-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #ffffff;
    text-align: left;
}

.language-item:hover {
    background: rgba(139, 92, 246, 0.1);
}

.language-item.active {
    background: rgba(139, 92, 246, 0.15);
    font-weight: 600;
}

.language-flag {
    font-size: 24px;
    min-width: 30px;
}

.language-name {
    flex: 1;
    color: #ffffff;
}

.language-badge {
    padding: 2px 8px;
    background: #8b5cf6;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* ============================================ */
/* BANNER DE TRADUCCIÓN */
/* ============================================ */

.translation-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.translation-banner.show {
    transform: translateY(0);
}

.translation-banner.hidden {
    display: none;
}

.translation-banner-content {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.translation-banner-icon {
    font-size: 40px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.translation-banner-text {
    flex: 1;
    color: white;
}

.translation-banner-text strong {
    font-size: 18px;
    display: block;
    margin-bottom: 5px;
}

.translation-banner-text p {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

.translation-banner-text span {
    font-weight: 600;
}

.translation-banner-actions {
    display: flex;
    gap: 12px;
}

.translation-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.translation-btn-primary {
    background: white;
    color: #8b5cf6;
}

.translation-btn-primary:hover {
    background: #f3e9d4;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.translation-btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}

.translation-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.translation-banner-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.translation-banner-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ============================================ */
/* INDICADOR DE CARGA */
/* ============================================ */

.translation-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.translation-loading-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.translation-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.translation-loading-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

.translation-loading-progress {
    width: 100%;
    height: 8px;
    background: #f3f3f3;
    border-radius: 4px;
    overflow: hidden;
}

.translation-loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ============================================ */
/* RESPONSIVE */
/* ============================================ */

@media (max-width: 768px) {
    .language-selector {
        top: 15px;
        right: 15px;
    }
    
    .language-selector-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .navbar-language-btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
    }
    
    .language-icon {
        font-size: 18px;
    }
    
    .language-dropdown {
        min-width: 240px;
        right: -10px;
    }
    
    /* En móvil, el selector aparece en el menú hamburguesa */
    #navbar-language-selector {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    
    #navbar-language-selector .language-dropdown {
        right: auto;
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
    }
    
    #navbar-language-selector .language-dropdown.show {
        transform: translateX(-50%) translateY(0);
    }
    
    .translation-banner-content {
        flex-direction: column;
        padding: 20px;
        text-align: center;
    }
    
    .translation-banner-icon {
        font-size: 32px;
    }
    
    .translation-banner-text strong {
        font-size: 16px;
    }
    
    .translation-banner-text p {
        font-size: 13px;
    }
    
    .translation-banner-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .translation-btn {
        width: 100%;
    }
    
    .translation-loading-content {
        padding: 30px 20px;
        min-width: 250px;
    }
}

@media (max-width: 480px) {
    .language-dropdown {
        right: -10px;
        min-width: 220px;
    }
    
    .language-item {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .language-flag {
        font-size: 20px;
        min-width: 25px;
    }
}

/* ============================================ */
/* ANIMACIONES ADICIONALES */
/* ============================================ */

.language-item {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Efecto de traducción en progreso */
.translating {
    position: relative;
    overflow: hidden;
}

.translating::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.2), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}
