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

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    display: flex;
}

/* Panel principal - Chat */
.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.chat-header {
    background: white;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.chat-header .details h2 {
    font-size: 1.1rem;
    color: #1a202c;
}

.chat-header .details p {
    font-size: 0.85rem;
    color: #718096;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 16px;
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    background: #00405D1A;
    color: #00405D;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.bot {
    background: white;
    color: #2d3748;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.message.bot strong {
    color: #4a5568;
}

.message.bot em {
    color: #718096;
}

.message .page-ref {
    background: #edf2f7;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #5e81f4;
    font-weight: 500;
}

.message.system {
    background: #e6fffa;
    color: #234e52;
    align-self: center;
    text-align: center;
    font-size: 0.9rem;
    border: 1px solid #81e6d9;
}

.welcome-message {
    text-align: center;
    padding: 60px 40px;
    color: #718096;
}

.welcome-message .big-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.welcome-message h3 {
    color: #2d3748;
    margin-bottom: 10px;
}

.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 15px 20px;
    background: white;
    border-radius: 16px;
    align-self: flex-start;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #a0aec0;
    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;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.chat-input-container {
    padding: 20px 30px;
    background: white;
    display: flex;
    gap: 15px;
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
}

.chat-input {
    flex: 1;
    padding: 15px 25px;
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input:focus {
    border-color: #667eea;
}

.chat-input:disabled {
    background: #ffffff;
}

.send-button {
    padding: 15px 35px;
    background: #C61F3F;
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(198, 31, 63, 0.4);
}

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

.loading-spinner {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
}

/* Selector de idioma */
.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-selector label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.language-select {
    padding: 6px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    font-size: 13px;
    color: #2D3335;
    background: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.language-select:hover,
.language-select:focus {
    border-color: #C61F3F;
}

/* Responsive */
@media (max-width: 700px) {
    .main-panel {
        min-height: 100vh;
    }
}

/* Estilos para tablas markdown */
.message table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
    font-size: 12px;
    overflow-x: auto;
    display: block;
}

.message th,
.message td {
    border: 1px solid #ddd;
    padding: 6px 8px;
    text-align: left;
}

.message th {
    background: #f5f5f5;
    font-weight: 600;
}

.message tr:nth-child(even) {
    background: #fafafa;
}

.message code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.message pre {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
}

.message h1,
.message h2,
.message h3 {
    margin: 12px 0 6px 0;
}

.message ul,
.message ol {
    padding-left: 20px;
    margin: 6px 0;
}