/* Estilos CSS para FAQs API - Camino de Santiago */

/* Estilos generales del diseño anterior */
body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #0f1419 0%, #1a2e1a 100%); /* Gradiente verde oscuro elegante */
    color: #e2f5e2;
    min-height: 100vh;
}
.header-bg {
    background: linear-gradient(135deg, #059669 0%, #047857 100%); /* Verde esmeralda */
    border-bottom: 1px solid #065f46;
}
.btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%); /* Gradiente verde */
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    border: none;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.35);
}
.border-color {
    border-color: #10b981; /* Verde para bordes */
}
.text-color-primary {
    color: #6ee7b7; /* Verde claro para texto principal */
}
.text-color-secondary {
    color: #fbbf24; /* Dorado para texto secundario */
}
.textarea-custom {
    min-height: 100px;
    background-color: #1a2e1a;
    border: 1px solid #065f46;
    color: #e2f5e2;
}
.textarea-custom:focus {
    background-color: #22543d;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.sandbox-output {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%); /* Verde profundo elegante */
    border-left: 4px solid #10b981;
    color: #d1fae5;
}
.card {
    background: linear-gradient(135deg, #1a2e1a 0%, #22543d 100%);
    border-radius: 0.75rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border: 1px solid #065f46;
}
.logo-img {
    height: 40px; /* Ajusta la altura del logo */
    width: auto; /* Mantiene la relación de aspecto */
    max-width: 100%; /* Asegura que no se desborde en pantallas pequeñas */
    margin-right: 1rem;
    object-fit: contain; /* Evita distorsión del logo */
    border-radius: 0.375rem; /* Bordes redondeados suaves */
}

.page-logo {
    width: 128px; /* Ancho fijo */
    height: 128px; /* Alto fijo */
    object-fit: contain; /* Mantiene aspecto sin distorsión */
    background-color: #ffffff; /* Fondo blanco para contraste */
    padding: 8px; /* Espaciado interno */
    border-radius: 0.75rem; /* Bordes redondeados */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Sombra suave */
}
/* Estilos mejorados para el sistema de estrellas */
.star-rating-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Contenedor del rating con ancho fijo para evitar saltos */
.rating-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rating-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 2.5rem; /* Altura mínima fija */
}

.rating-label {
    flex-shrink: 0;
    min-width: 100px; /* Ancho mínimo fijo para la etiqueta */
}

.rating-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.rating-display {
    min-width: 140px; /* Ancho fijo para el texto de rating */
    max-width: 140px; /* Máximo también para evitar expansión */
    text-align: left;
    white-space: nowrap; /* Evita salto de línea */
    overflow: hidden;
    text-overflow: ellipsis; /* Si es muy largo, muestra ... */
}

.star-btn {
    background: none;
    border: none;
    font-size: 1.75rem; /* Tamaño del emoji */
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.3s ease;
    color: #6b7280; /* Gris por defecto */
    border-radius: 0.25rem;
    position: relative;
    transform: scale(1);
}

.star-btn:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 0 8px rgba(245, 213, 71, 0.6));
}

.star-btn.selected {
    color: #f59e0b; /* Amarillo/naranja para seleccionadas */
    filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.4));
    transform: scale(1.1);
}

.star-btn.preview {
    color: #fbbf24; /* Amarillo claro para preview hover */
    transform: scale(1.15);
}

.star-btn:active {
    transform: scale(0.95);
}

/* Animación para las estrellas */
@keyframes starSelect {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.1); }
}

.star-btn.just-selected {
    animation: starSelect 0.3s ease-in-out;
}

/* Colores consistentes en modo claro */
body.light-mode .star-btn {
    color: #9ca3af; /* Gris por defecto en modo claro */
}
body.light-mode .star-btn.selected {
    color: #f59e0b; /* Amarillo/naranja en modo claro */
}
body.light-mode .star-btn.preview {
    color: #fbbf24; /* Amarillo claro para preview en modo claro */
}

/* Inputs y controles verdes */
input, textarea, select {
    background-color: #1a2e1a !important;
    border: 1px solid #065f46 !important;
    color: #e2f5e2 !important;
    border-radius: 0.5rem;
}
input:focus, textarea:focus, select:focus {
    background-color: #22543d !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
    outline: none;
}
input::placeholder, textarea::placeholder {
    color: #9ca3af !important;
}

/* Labels */
label {
    color: #d1fae5 !important;
    font-weight: 500;
}

/* Toggle de modo verde/claro integrado mejorado */
.theme-toggle {
    position: relative;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 25px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    min-width: 100px;
    height: 40px;
    cursor: pointer;
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.theme-toggle:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.theme-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.theme-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.theme-text {
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: scale(1.1);
}

/* Modo claro para el toggle */
body.light-mode .theme-toggle {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

body.light-mode .theme-toggle:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .theme-toggle {
        min-width: 80px;
        height: 36px;
        padding: 6px 12px;
        gap: 6px;
    }
    
    .theme-icon {
        font-size: 14px;
    }
    
    .theme-text {
        font-size: 12px;
    }
    
    /* Header responsive */
    .header-responsive {
        flex-direction: column;
        gap: 1rem;
    }
    
    .logo-section {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
    
    .nav-section {
        width: 100%;
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .nav-links {
        order: 2;
    }
    
    .theme-toggle-container {
        order: 1;
    }
    
    /* Logo responsive */
    .page-logo {
        width: 96px;
        height: 96px;
    }
}

/* Variables CSS para modo claro verde */
body.light-mode {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
    color: #1f2937 !important;
}

body.light-mode .header-bg {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}

body.light-mode .card {
    background: linear-gradient(135deg, #ffffff 0%, #f9fffe 100%) !important;
    border: 1px solid #d1fae5 !important;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.1) !important;
}

/* Notificaciones elegantes modo oscuro */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transform: translateX(500px);
    transition: transform 0.3s ease-in-out;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}
.notification.show {
    transform: translateX(0);
}
.notification.success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #d1fae5;
}
.notification.error {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #fecaca;
}
.notification.info {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #dbeafe;
}

/* Estilos adicionales para la respuesta AI formateada */
.ai-response-content {
    line-height: 1.6;
    font-size: 0.95rem;
}

.ai-response-content p {
    margin-bottom: 1rem;
}

.ai-response-content ul, .ai-response-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.ai-response-content li {
    margin-bottom: 0.5rem;
    position: relative;
}

.ai-response-content strong {
    color: #6ee7b7;
    font-weight: 600;
}

.ai-response-content em {
    color: #fbbf24;
    font-style: italic;
}

.ai-response-content .numbered-list {
    background: rgba(16, 185, 129, 0.05);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    border-left: 3px solid #10b981;
}

.ai-response-content .bullet-list {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.question-highlight {
    color: #fbbf24 !important;
    background: rgba(251, 191, 36, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border-left: 3px solid #fbbf24;
    display: inline-block;
    margin: 0.25rem 0;
}

.ai-response-content .tip-box {
    background: linear-gradient(135deg, #065f46 0%, #047857 100%);
    border-left: 4px solid #10b981;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
    border: 1px solid #065f46;
}

.ai-response-content .tip-box .tip-icon {
    color: #fbbf24;
    font-size: 1.1rem;
    margin-right: 0.5rem;
}

/* Estilos para solicitudes de información */
.information-request {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-left: 4px solid #3b82f6;
    color: #dbeafe;
    border-radius: 0.5rem;
    border: 1px solid #1e40af;
}

.information-request .request-header {
    color: #93c5fd;
}

.information-request .request-content {
    color: #dbeafe;
}

.information-request .request-footer {
    color: #7dd3fc;
}

/* Modo claro para elementos de respuesta */
body.light-mode .ai-response-content strong {
    color: #047857;
}

body.light-mode .ai-response-content em {
    color: #d97706;
}

body.light-mode .question-highlight {
    color: #d97706 !important;
    background: rgba(217, 119, 6, 0.1);
    border-left: 3px solid #d97706;
}

body.light-mode .ai-response-content .tip-box {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-left: 4px solid #10b981;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

body.light-mode .information-request {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 4px solid #3b82f6;
    color: #1e3a8a;
    border: 1px solid #93c5fd;
}

body.light-mode .information-request .request-header {
    color: #1e3a8a !important;
    font-weight: 600;
}

body.light-mode .information-request .request-content {
    color: #1f2937 !important;
    font-weight: 500;
}

body.light-mode .information-request .request-footer {
    color: #374151 !important;
    font-weight: 400;
}

/* Mejorar legibilidad en modo claro */
body.light-mode .text-color-primary {
    color: #047857 !important; /* Verde oscuro para mejor contraste */
}

body.light-mode .text-color-secondary {
    color: #d97706 !important; /* Ámbar oscuro para mejor contraste */
}

/* Clases de Tailwind para textos en modo claro */
body.light-mode .text-e2f5e2 {
    color: #374151 !important; /* Gris oscuro para mejor legibilidad */
}

body.light-mode .text-d1fae5 {
    color: #1f2937 !important; /* Gris muy oscuro para contenido principal */
}

/* Inputs y controles en modo claro */
body.light-mode input, 
body.light-mode textarea, 
body.light-mode select {
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #1f2937 !important;
}

body.light-mode input:focus, 
body.light-mode textarea:focus, 
body.light-mode select:focus {
    background-color: #f9fafb !important;
    border-color: #10b981 !important;
    color: #1f2937 !important;
}

body.light-mode input::placeholder, 
body.light-mode textarea::placeholder {
    color: #6b7280 !important;
}

/* Labels en modo claro */
body.light-mode label {
    color: #374151 !important;
}

/* Respuesta de IA en modo claro */
body.light-mode .ai-response-content {
    color: #1f2937 !important;
}

body.light-mode .sandbox-output {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%) !important;
    color: #065f46 !important;
    border-left: 4px solid #10b981;
}

/* Estilos para controles de voz */
.voice-control-btn {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
}

.voice-control-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    transform: scale(1.05);
}

.voice-control-btn:active {
    transform: scale(0.95);
}

.voice-control-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
    animation: pulse-recording 2s infinite;
}

@keyframes pulse-recording {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#voice-status {
    color: #10b981;
    font-style: italic;
}

#voice-status.listening {
    animation: pulse-text 2s infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Estilos en modo claro */
body.light-mode .voice-control-btn {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #047857;
}

body.light-mode .voice-control-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
}

body.light-mode .voice-control-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #dc2626;
}

body.light-mode #voice-status {
    color: #047857;
}

/* Nuevo sistema de layout responsive para 2 columnas */
.responsive-layout {
    max-width: 7xl;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Desktop: Layout de 2 columnas */
@media (min-width: 1024px) {
    .responsive-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        padding: 0 2rem;
    }
    
    .chat-column {
        order: 1;
    }
    
    .forms-column {
        order: 2;
    }
}

/* Tablet: Layout de 2 columnas más compacto */
@media (min-width: 768px) and (max-width: 1023px) {
    .responsive-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
        padding: 0 1.5rem;
    }
    
    .chat-column {
        order: 1;
    }
    
    .forms-column {
        order: 2;
    }
    
    /* Rating ajustado para tablet */
    .rating-display {
        min-width: 120px;
        max-width: 120px;
        font-size: 0.875rem;
    }
    
    .rating-label {
        min-width: 90px;
        font-size: 0.875rem;
    }
}

/* Mobile: Layout vertical con scroll */
@media (max-width: 767px) {
    .responsive-layout {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 0 1rem;
    }
    
    .chat-column,
    .forms-column {
        width: 100%;
    }
    
    /* Mejorar espaciado en móvil */
    .card {
        margin-bottom: 1rem;
    }
    
    /* Ajustar tamaños de texto en móvil */
    .card h2 {
        font-size: 1.5rem;
    }
    
    .card h3 {
        font-size: 1.25rem;
    }
    
    /* Botones más grandes en móvil */
    .btn-primary {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Textareas más accesibles en móvil */
    textarea {
        min-height: 120px;
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    input[type="text"], 
    input[type="file"], 
    select {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 0.75rem;
    }
}

/* Estilos específicos para el área de resultados */
#ingestion-results {
    position: sticky;
    top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

#results-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Scrollbar personalizado para resultados */
#results-content::-webkit-scrollbar {
    width: 6px;
}

#results-content::-webkit-scrollbar-track {
    background: rgba(16, 185, 129, 0.1);
    border-radius: 3px;
}

#results-content::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.5);
    border-radius: 3px;
}

#results-content::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.7);
}

/* Animación suave para las cards */
.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

/* Optimizaciones para pantallas muy pequeñas */
@media (max-width: 480px) {
    .responsive-layout {
        padding: 0 0.5rem;
    }
    
    .card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .star-rating-container {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .star-btn {
        font-size: 1.5rem;
    }
    
    /* Rating responsive en móvil */
    .rating-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        min-height: auto;
    }
    
    .rating-label {
        min-width: auto;
        text-align: center;
        width: 100%;
    }
    
    .rating-controls {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
    }
    
    .rating-display {
        min-width: auto;
        text-align: center;
        width: 100%;
    }
}

/* Ajustes para pantallas muy grandes */
@media (min-width: 1440px) {
    .responsive-layout {
        max-width: 1400px;
        gap: 3rem;
        padding: 0 3rem;
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .card,
    .btn-primary,
    .star-btn,
    .voice-control-btn {
        transition: none;
        transform: none;
        animation: none;
    }
    
    .card:hover {
        transform: none;
    }
}