/* Variables de color */
:root {
    /* Modo claro */
    --bg-primary: #fefefe;
    --bg-secondary: #f9f5f0;
    --bg-tertiary: #f2ede6;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-tertiary: #95a5a6;
    --border-color: #e8e2d9;
    --accent-primary: #e67e22;
    --accent-secondary: #d35400;
    --accent-orange: #e67e22;
    --accent-blue: #3498db;
    --accent-green: #27ae60;
    --accent-red: #e74c3c;
    --accent-purple: #9b59b6;
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    
    /* Radios */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;
    
    /* Transiciones */
    --transition: 0.25s ease;
}

/* Modo oscuro */
.dark-mode {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-tertiary: #999999;
    --border-color: #444444;
    --accent-primary: #ff8c00;
    --accent-secondary: #ffa500;
    --accent-orange: #ff8c00;
    --accent-blue: #5dade2;
    --accent-green: #58d68d;
    --accent-red: #ec7063;
    --accent-purple: #bb8fce;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* Contenido del modal - ALTURA FIJA SIN SCROLL */
.modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    width: 95%;
    max-width: 500px;
    height: 85vh;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

/* Modal principal - SIN HEADER */
#searchModal .modal-content {
    background: transparent;
    box-shadow: none;
    border: none;
    height: auto;
}

/* Header SOLO para sub-modales */
.modal-header {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-primary);
    min-height: 50px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}

/* NO header para modal principal */
#searchModal .modal-header {
    display: none;
}

/* Query en header */
.modal-query {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-primary);
    flex-grow: 1;
}

.modal-query i {
    color: var(--accent-orange);
    font-size: 1.1rem;
}

.modal-query span {
    color: var(--accent-orange);
    font-weight: 500;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

/* X SOLO en la derecha */
.close-modal {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.close-modal:hover {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
    transform: rotate(90deg);
}

/* Contenido principal - SIN SCROLL, USANDO FLEX */
.modal-body {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Opciones de búsqueda - PARA MODAL PRINCIPAL */
.search-options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    flex-grow: 1;
    align-content: center;
}

.option-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 15px 10px;
    border-radius: 15px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    height: 120px;
    justify-content: center;
}

.option-item:hover {
    border-color: var(--accent-orange);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.option-item.selected {
    border-color: var(--accent-orange);
    background: rgba(230, 126, 34, 0.1);
}

.option-icon {
    width: 50px;
    height: 50px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-orange);
    font-size: 1.5rem;
    margin-bottom: 10px;
    transition: all var(--transition);
}

.option-item:hover .option-icon {
    background: var(--accent-orange);
    color: white;
    transform: scale(1.1);
}

.option-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.option-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* Plataformas - PARA OTROS MÓDULOS */
.platform-options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    flex-grow: 1;
    align-content: center;
}

.platform-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 12px 8px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    height: 110px;
    justify-content: center;
}

.platform-item:hover {
    border-color: var(--accent-orange);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.platform-icon {
    width: 45px;
    height: 45px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-orange);
    font-size: 1.4rem;
    margin-bottom: 8px;
    transition: all var(--transition);
}

.platform-item:hover .platform-icon {
    background: var(--accent-orange);
    color: white;
    transform: scale(1.05);
}

.platform-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.platform-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.1;
}

/* Secciones */
.section-title {
    grid-column: 1 / -1;
    padding: 10px 0;
    margin-bottom: 5px;
}

.section-title h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.section-title i {
    color: var(--accent-orange);
}

/* ===== ESTILOS PARA MENSAJES DE ERROR ===== */

.error-message {
    text-align: center;
    padding: 40px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.error-message i {
    font-size: 3rem;
    color: var(--accent-red);
    margin-bottom: 10px;
}

.error-message h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.error-message p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
    max-width: 400px;
}

.retry-btn {
    padding: 12px 24px;
    background: var(--accent-orange);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition);
    margin-top: 20px;
}

.retry-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

/* CONTENEDOR DE INFORMACIÓN SIN SCROLL - ESPACIO FLEXIBLE */
.info-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    gap: 20px;
}

/* Información de Wikipedia - ALTURA LIMITADA SIN SCROLL */
.wiki-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.wiki-info-inner {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wiki-thumbnail {
    margin-bottom: 15px;
    text-align: center;
    flex-shrink: 0;
}

.wiki-thumbnail img {
    max-width: 180px;
    max-height: 130px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wiki-description {
    font-size: 0.9rem;
    color: var(--accent-orange);
    font-weight: 600;
    margin-bottom: 10px;
    padding: 5px 10px;
    background: rgba(230, 126, 34, 0.1);
    border-radius: 8px;
    display: inline-block;
    border: 1px solid rgba(230, 126, 34, 0.2);
    flex-shrink: 0;
}

/* Extracto de Wikipedia con scroll interno SOLO si es necesario */
.wiki-extract-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.wiki-extract {
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 0.9rem;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 5px;
    margin-bottom: 10px;
}

.wiki-extract p {
    margin-bottom: 10px;
}

.wiki-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 5px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    flex-shrink: 0;
    margin-top: auto;
}

.wiki-note i {
    color: var(--accent-blue);
}

/* Contenedor compacto SIN SCROLL */
.info-content-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
}

.info-section-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.info-section-compact h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-orange);
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--accent-orange);
    padding-bottom: 8px;
    flex-shrink: 0;
}

.info-section-compact p {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.info-section-compact strong {
    color: var(--accent-orange);
    font-weight: 600;
}

.info-section-compact ul, .info-section-compact ol {
    padding-left: 20px;
    margin-left: 5px;
    margin-bottom: 10px;
}

.info-section-compact li {
    margin-bottom: 5px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* ===== ESTILOS PARA VERSIÓN SEGURA (módulo Generar) ===== */

/* Etiqueta de información */
.info-tag {
    display: inline-block;
    background: rgba(230, 126, 34, 0.1);
    color: var(--accent-orange);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 15px;
    border: 1px solid rgba(230, 126, 34, 0.2);
}

.info-tag i {
    margin-right: 5px;
}

/* Extracto seguro */
.safe-extract {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.safe-extract p {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Atribución de fuente */
.source-attribution {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px dashed var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.source-attribution i {
    color: var(--accent-orange);
}

.wiki-link {
    margin-left: auto;
    color: var(--accent-blue);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    transition: color var(--transition);
}

.wiki-link:hover {
    color: var(--accent-orange);
    text-decoration: underline;
}

.wiki-link i {
    font-size: 0.7rem;
}

/* Nota de traducción */
.translation-note {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent-blue);
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 0.75rem;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.translation-note i {
    font-size: 0.8rem;
}

/* Acciones rápidas - FIJO EN LA PARTE INFERIOR */
.quick-actions-compact {
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    margin-top: auto;
}

.quick-actions-compact h4 {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-actions-compact h4 i {
    color: var(--accent-orange);
}

.action-buttons-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.action-btn-compact {
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: all var(--transition);
    font-size: 0.85rem;
    font-weight: 500;
}

.action-btn-compact:hover {
    background: var(--accent-orange);
    color: white;
    border-color: var(--accent-orange);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(230, 126, 34, 0.2);
}

.action-btn-compact i {
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        max-width: 90%;
        height: 80vh;
        max-height: 80vh;
    }
    
    .search-options-grid,
    .platform-options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .option-item,
    .platform-item {
        height: 100px;
        padding: 10px 5px;
    }
    
    .option-icon,
    .platform-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .modal-query span {
        max-width: 200px;
    }
    
    .action-buttons-compact {
        grid-template-columns: 1fr;
    }
    
    .wiki-thumbnail img {
        max-width: 140px;
        max-height: 100px;
    }
    
    .wiki-extract {
        max-height: 150px;
        font-size: 0.85rem;
    }
    
    .info-section-compact p {
        font-size: 0.85rem;
    }
    
    .safe-extract {
        padding: 12px;
    }
    
    .source-attribution {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .wiki-link {
        margin-left: 0;
    }
    
    /* Responsive para mensajes de error */
    .error-message {
        padding: 30px 15px;
    }
    
    .error-message i {
        font-size: 2.5rem;
    }
    
    .error-message h3 {
        font-size: 1.3rem;
    }
    
    .retry-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .search-options-grid,
    .platform-options-grid {
        grid-template-columns: 1fr;
    }
    
    .option-item,
    .platform-item {
        height: 90px;
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 15px;
        gap: 15px;
    }
    
    .option-icon,
    .platform-icon {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .modal-query span {
        max-width: 150px;
    }
    
    .wiki-thumbnail img {
        max-width: 100px;
        max-height: 80px;
    }
    
    .wiki-extract {
        max-height: 120px;
        font-size: 0.8rem;
    }
    
    .modal-content {
        height: 75vh;
    }
    
    .safe-extract {
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .action-buttons-compact {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Responsive para mensajes de error en móvil */
    .error-message {
        padding: 20px 10px;
    }
    
    .error-message i {
        font-size: 2rem;
    }
    
    .error-message h3 {
        font-size: 1.1rem;
    }
    
    .error-message p {
        font-size: 0.9rem;
    }
    
    .retry-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* Scrollbar personalizada SOLO para extracto de Wikipedia */
.wiki-extract::-webkit-scrollbar {
    width: 4px;
}

.wiki-extract::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 2px;
}

.wiki-extract::-webkit-scrollbar-thumb {
    background: var(--accent-orange);
    border-radius: 2px;
}

.wiki-extract::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* Animación de carga */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wiki-info, .info-section-compact {
    animation: fadeIn 0.3s ease-out;
}

/* Animación para extracto seguro */
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.safe-extract {
    animation: slideIn 0.4s ease-out;
}

/* Animación para mensaje de error */
@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.error-message {
    animation: fadeIn 0.5s ease-out;
}

.error-message i {
    animation: shakeError 0.8s ease-in-out;
}

/* Scrollbar para modales (si es necesario) */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--accent-orange);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* Modo oscuro para mensajes de error */
.dark-mode .error-message h3 {
    color: var(--text-primary);
}

.dark-mode .error-message p {
    color: var(--text-secondary);
}

/* Mejoras de accesibilidad */
.action-btn-compact:focus-visible,
.retry-btn:focus-visible,
.close-modal:focus-visible,
.option-item:focus-visible,
.platform-item:focus-visible {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

/* Estados de carga */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--accent-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 10px;
}

/* ===== ESTILOS MEJORADOS PARA MÓDULO GENERATE ===== */

/* Pantalla de carga */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    min-height: 400px;
}

.loading-animation {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 30px;
}

.spinner {
    width: 100%;
    height: 100%;
    border: 4px solid rgba(230, 126, 34, 0.1);
    border-top: 4px solid var(--accent-orange);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.spinner-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 2px solid rgba(230, 126, 34, 0.05);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.loading-title {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-text {
    font-size: 1.1rem;
    color: var(--accent-orange);
    font-weight: 500;
    margin-bottom: 30px;
    font-style: italic;
}

.loading-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 350px;
    margin-bottom: 30px;
}

.loading-detail {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.loading-detail i {
    color: var(--accent-orange);
    width: 20px;
    text-align: center;
}

.loading-progress {
    width: 100%;
    max-width: 300px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-orange), #ff9f43);
    width: 0%;
    animation: loadingProgress 2s ease-in-out infinite;
    border-radius: 3px;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    display: block;
    text-align: center;
}

@keyframes loadingProgress {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 0%; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 0.3; }
}

/* Encabezado mejorado */
.enhanced-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-btn {
    padding: 8px 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
}

.header-btn:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.translation-badge {
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent-blue);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 10px;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

/* Contenedor principal mejorado */
.enhanced-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 20px;
}

/* Encabezado del artículo */
.article-header {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.article-title-section {
    flex: 1;
}

.article-title {
    font-size: 1.6rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.article-title i {
    color: var(--accent-orange);
}

.article-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(230, 126, 34, 0.1);
    color: var(--accent-orange);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(230, 126, 34, 0.2);
}

.article-thumbnail {
    width: 150px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-thumbnail:hover img {
    transform: scale(1.05);
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.article-thumbnail:hover .thumbnail-overlay {
    opacity: 1;
}

.thumbnail-overlay i {
    color: white;
    font-size: 1.2rem;
}

/* Extracto del artículo */
.article-extract {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 25px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.extract-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--accent-orange);
}

.extract-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.extract-header h3 i {
    color: var(--accent-orange);
}

.translation-toggle {
    padding: 8px 15px;
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.2);
    border-radius: 8px;
    color: var(--accent-blue);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
}

.translation-toggle:hover {
    background: var(--accent-blue);
    color: white;
}

.extract-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.extract-content p {
    margin: 0;
    text-align: justify;
}

.translation-note {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: rgba(155, 89, 182, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(155, 89, 182, 0.2);
    color: var(--accent-purple);
    font-size: 0.9rem;
    margin-top: 20px;
}

.translation-note i {
    font-size: 1rem;
}

/* Versión alternativa */
.alternative-version {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05), rgba(155, 89, 182, 0.05));
    border-radius: 15px;
    padding: 25px;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.alternative-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.alternative-header h3 {
    font-size: 1.1rem;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.switch-language-btn {
    padding: 8px 16px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
}

.switch-language-btn:hover {
    background: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.alternative-preview {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.alternative-preview p {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
    font-style: italic;
}

.view-alternative {
    align-self: flex-start;
    padding: 10px 20px;
    background: transparent;
    border: 2px solid var(--accent-blue);
    color: var(--accent-blue);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
}

.view-alternative:hover {
    background: var(--accent-blue);
    color: white;
    transform: translateX(5px);
}

/* Acciones rápidas */
.quick-actions-section {
    margin-top: 10px;
}

.quick-actions-section h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.quick-actions-section h3 i {
    color: var(--accent-orange);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.action-card:hover {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(230, 126, 34, 0.2);
}

.action-card:hover .action-icon {
    background: white;
    color: var(--accent-orange);
}

.action-card:hover .action-title,
.action-card:hover .action-desc {
    color: white;
}

.action-icon {
    width: 50px;
    height: 50px;
    background: var(--bg-secondary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-orange);
    font-size: 1.2rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.action-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.action-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color var(--transition);
}

.action-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: color var(--transition);
}

/* Información de fuente */
.source-info-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 10px;
}

.source-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.source-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.source-detail i {
    color: var(--accent-orange);
    width: 16px;
}

.source-link {
    padding: 12px 20px;
    background: var(--accent-orange);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
}

.source-link:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

/* Pantallas de error y sin resultados */
.error-screen, .no-results-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    min-height: 400px;
}

.error-icon, .no-results-icon {
    font-size: 4rem;
    color: var(--accent-red);
    margin-bottom: 25px;
}

.no-results-icon {
    color: var(--accent-blue);
}

.error-screen h3, .no-results-screen h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.error-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    max-width: 400px;
}

.error-details, .suggestions {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
    max-width: 400px;
}

.error-details p, .suggestions h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.error-details ul, .suggestions ul {
    padding-left: 20px;
    color: var(--text-secondary);
}

.error-details li, .suggestions li {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.error-actions, .action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.retry-btn, .alternative-btn, .search-other-btn, .create-article-btn {
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
    border: none;
    font-size: 0.95rem;
}

.retry-btn, .search-other-btn {
    background: var(--accent-orange);
    color: white;
}

.alternative-btn, .create-article-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.retry-btn:hover, .search-other-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

.alternative-btn:hover, .create-article-btn:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

/* Responsive para versión mejorada */
@media (max-width: 768px) {
    .article-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .article-thumbnail {
        width: 100%;
        height: 150px;
        align-self: center;
    }
    
    .action-grid {
        grid-template-columns: 1fr;
    }
    
    .source-info-section {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .extract-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .alternative-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .enhanced-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .header-actions {
        align-self: stretch;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .loading-detail {
        font-size: 0.8rem;
        padding: 10px 12px;
    }
    
    .article-title {
        font-size: 1.3rem;
    }
    
    .article-extract {
        padding: 20px;
    }
    
    .alternative-version {
        padding: 20px;
    }
    
    .action-card {
        padding: 15px;
    }
    
    .error-actions, .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .retry-btn, .alternative-btn, .search-other-btn, .create-article-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== ANIMACIONES MEJORADAS ===== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Aplicar animaciones a los elementos */
.enhanced-container {
    animation: fadeIn 0.3s ease-out;
}

.article-header {
    animation: slideUp 0.4s ease-out 0.1s both;
}

.article-extract {
    animation: slideUp 0.4s ease-out 0.2s both;
}

.alternative-version {
    animation: slideUp 0.4s ease-out 0.3s both;
}

.quick-actions-section {
    animation: slideUp 0.4s ease-out 0.4s both;
}

.source-info-section {
    animation: slideUp 0.4s ease-out 0.5s both;
}

.action-card {
    animation: scaleIn 0.3s ease-out;
}

.action-card:nth-child(1) { animation-delay: 0.5s; }
.action-card:nth-child(2) { animation-delay: 0.6s; }
.action-card:nth-child(3) { animation-delay: 0.7s; }
.action-card:nth-child(4) { animation-delay: 0.8s; }

/* Efectos hover mejorados */
.action-card, .header-btn, .translation-toggle, .switch-language-btn, .view-alternative {
    position: relative;
    overflow: hidden;
}

.action-card::after, .header-btn::after, 
.translation-toggle::after, .switch-language-btn::after,
.view-alternative::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.action-card:hover::after, .header-btn:hover::after,
.translation-toggle:hover::after, .switch-language-btn:hover::after,
.view-alternative:hover::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(40, 40);
        opacity: 0;
    }
}

/* Efecto de brillo en hover */
.action-card:hover .action-icon {
    animation: iconGlow 0.6s ease-out;
}

@keyframes iconGlow {
    0%, 100% { box-shadow: 0 0 0 rgba(255, 255, 255, 0); }
    50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }
}

/* Efecto de aparición para texto */
.extract-content p {
    animation: textReveal 0.8s ease-out;
}

@keyframes textReveal {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Efecto de carga para imágenes */
.article-thumbnail img {
    animation: imageLoad 0.5s ease-out;
}

@keyframes imageLoad {
    from {
        opacity: 0;
        filter: blur(5px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Indicador de caché */
.cache-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(39, 174, 96, 0.1);
    color: var(--accent-green);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
    animation: pulse 2s infinite;
}

.cache-indicator i {
    font-size: 0.7rem;
}

/* Tooltips para botones */
.action-card, .header-btn, .translation-toggle,
.switch-language-btn, .view-alternative {
    position: relative;
}

.action-card:hover::before, .header-btn:hover::before,
.translation-toggle:hover::before, .switch-language-btn:hover::before,
.view-alternative:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 8px;
    pointer-events: none;
    animation: tooltipFade 0.2s ease-out;
}

@keyframes tooltipFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Dark mode específico */
.dark-mode .article-extract {
    background: var(--bg-tertiary);
}

.dark-mode .alternative-version {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(155, 89, 182, 0.1));
}

.dark-mode .action-card {
    background: var(--bg-secondary);
}

.dark-mode .source-info-section {
    background: var(--bg-tertiary);
}

.dark-mode .error-details, .dark-mode .suggestions {
    background: var(--bg-tertiary);
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .enhanced-container,
    .article-header,
    .article-extract,
    .alternative-version,
    .quick-actions-section,
    .source-info-section,
    .action-card,
    .extract-content p,
    .article-thumbnail img {
        animation: none;
    }
    
    .action-card:hover::after,
    .header-btn:hover::after,
    .translation-toggle:hover::after,
    .switch-language-btn:hover::after,
    .view-alternative:hover::after {
        animation: none;
    }
    
    .action-card:hover .action-icon {
        animation: none;
    }
}

/* ===== SCROLL SOLO PARA GENERATE ===== */

/* Contenedor principal del módulo Generate */
.enhanced-container {
    max-height: 70vh;      /* límite de altura */
    overflow-y: auto;      /* activa scroll vertical */
    padding-right: 10px;   /* espacio para que la barra no tape texto */
}

/* Scroll más bonito (opcional pero recomendado) */
.enhanced-container::-webkit-scrollbar {
    width: 8px;
}

.enhanced-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

.enhanced-container::-webkit-scrollbar-thumb {
    background: #e67e22;
    border-radius: 10px;
}

.enhanced-container::-webkit-scrollbar-thumb:hover {
    background: #d35400;
}
