/* ===== VARIABLES Y RESET ===== */
:root {
    /* Colores corporativos World Connection */
    --primary-blue: #0080C8;
    --accent-green: #8DC63F;
    
    /* Paleta modo claro */
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --border-color: #E2E8F0;
    
    /* Efectos */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, var(--primary-blue) 0%, #0066A3 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-green) 0%, #7AB82D 100%);
    --gradient-bg: linear-gradient(180deg, #FFFFFF 0%, var(--bg-main) 100%);
}

/* MODO OSCURO */
[data-theme="dark"] {
    --bg-main: #0F172A;
    --bg-card: #1E293B;
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    --border-color: #334155;
    --gradient-bg: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gradient-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    height: 50px;
    width: auto;
    max-width: 300px;
}

.header-divider {
    width: 2px;
    height: 40px;
    background: var(--border-color);
}

.header-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* THEME TOGGLE BUTTON */
.theme-toggle {
    background: var(--bg-main);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.theme-toggle:hover {
    background: var(--bg-card);
    border-color: var(--primary-blue);
    transform: scale(1.05);
}

.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== MAIN CONTAINER ===== */
.main-container {
    padding: 2rem 0 10rem 0; /* Más padding bottom para el input fijo */
    min-height: calc(100vh - 100px);
}

/* ===== WELCOME CARD ===== */
.welcome-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.welcome-card h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

.example-questions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.example-btn {
    background: var(--bg-main);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.example-btn:hover {
    border-color: var(--primary-blue);
    background: var(--bg-card);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .example-btn:hover {
    background: #334155;
}

/* ===== MESSAGES ===== */
.messages {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    display: flex;
    gap: 1rem;
    animation: slideUp 0.3s ease-out;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--gradient-primary);
}

.message.assistant .message-avatar {
    background: var(--gradient-accent);
}

.message-content {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.message.user .message-content {
    background: var(--primary-blue);
    color: white;
}

.message-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.message.user .message-content h3 {
    color: rgba(255, 255, 255, 0.8);
}

.message-text {
    font-size: 1rem;
    line-height: 1.7;
}

.message-text p {
    margin-bottom: 1rem;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text ul, .message-text ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.message-text li {
    margin: 0.5rem 0;
}

.message-text code {
    background: var(--bg-main);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

.message-text pre {
    background: #1E293B;
    color: #F8FAFC;
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 1rem 0;
}

[data-theme="dark"] .message-text pre {
    background: #0F172A;
    border: 1px solid var(--border-color);
}

.message-text strong {
    font-weight: 600;
    color: var(--primary-blue);
}

.message.user .message-text strong {
    color: white;
}

.message-sources {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.source-tag {
    display: inline-block;
    background: var(--bg-main);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    margin: 0.25rem 0.25rem 0.25rem 0;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
}

.message-meta {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
}

/* ===== INPUT AREA ===== */
.input-wrapper {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 900px;
    padding: 1.5rem;
    background: transparent;
    z-index: 50;
}

.input-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
    transition: border-color 0.2s ease;
}

.input-container:focus-within {
    border-color: var(--primary-blue);
}

#questionInput {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    resize: none;
    outline: none;
    max-height: 200px;
    padding: 0.5rem;
}

#questionInput::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== LOADING INDICATOR ===== */
.typing-indicator {
    display: flex;
    gap: 0.4rem;
    padding: 1rem 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .logo {
        height: 40px;
        max-width: 200px;
    }
    
    .header-divider {
        height: 30px;
    }
    
    .header-text h1 {
        font-size: 1.1rem;
    }
    
    .theme-toggle {
        padding: 0.5rem;
    }
    
    .welcome-card {
        padding: 1.5rem;
    }
    
    .welcome-card h2 {
        font-size: 1.5rem;
    }
    
    .example-questions {
        grid-template-columns: 1fr;
    }
    
    .input-wrapper {
        max-width: 100%;
        padding: 1rem;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
