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

html, body {
    font-family: 'Roboto', sans-serif;
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
    color: #CFD8DC;
    height: 100%;
    overflow: hidden;
    width: 100%;
}

.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: rgba(128, 203, 196, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #80CBC4;
    text-decoration: none;
    transition: all 0.3s ease;
    z-index: 1001;
    backdrop-filter: blur(5px);
}

.back-button:hover {
    background: rgba(128, 203, 196, 0.4);
    transform: scale(1.1);
}

.back-button svg {
    width: 24px;
    height: 24px;
}

.chat-container {
    width: 100%;
    max-width: 900px;
    height: 90%;
    margin: 20px auto;
    background: rgba(23, 32, 42, 0.95);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(128, 203, 196, 0.3);
}

.chat-header {
    padding: 20px;
    background: rgba(15, 22, 29, 0.95);
    border-bottom: 1px solid rgba(128, 203, 196, 0.3);
    position: relative;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.chat-title h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    color: #80CBC4;
}

.status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status.online {
    background-color: #4CAF50;
    box-shadow: 0 0 5px #4CAF50;
}

.chat-subtitle {
    font-size: 0.9rem;
    color: #90A4AE;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 15px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2C3E50;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar svg {
    width: 24px;
    height: 24px;
    color: #B2DFDB;
}

.message-content {
    background: rgba(38, 50, 56, 0.8);
    padding: 12px 16px;
    border-radius: 12px;
    border-top-left-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.message-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent rgba(38, 50, 56, 0.8) transparent transparent;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.user .message-avatar {
    background: #304FFE;
}

.message.user .message-content {
    background: rgba(48, 79, 254, 0.2);
    border-radius: 12px;
    border-top-right-radius: 4px;
}

.message.user .message-content::before {
    left: auto;
    right: -8px;
    border-width: 8px 8px 0 0;
    border-color: rgba(48, 79, 254, 0.2) transparent transparent transparent;
}

.message.assistant .message-avatar {
    background: #00897B;
}

.message.assistant .message-content {
    background: rgba(0, 137, 123, 0.2);
}

.message.assistant .message-content::before {
    border-color: transparent rgba(0, 137, 123, 0.2) transparent transparent;
}

.message.loading .message-content {
    display: flex;
    align-items: center;
    gap: 5px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #80CBC4;
    animation: pulse 1.5s infinite ease-in-out;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1); opacity: 1; }
}

.chat-input {
    background: rgba(15, 22, 29, 0.95);
    padding: 15px 20px;
    border-top: 1px solid rgba(128, 203, 196, 0.3);
}

#chat-form {
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 12px 15px;
    border-radius: 20px;
    border: 1px solid rgba(128, 203, 196, 0.5);
    background: rgba(38, 50, 56, 0.5);
    color: #CFD8DC;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

#user-input:focus {
    border-color: #80CBC4;
    box-shadow: 0 0 5px rgba(128, 203, 196, 0.5);
}

#user-input::placeholder {
    color: #78909C;
}

#send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #00897B;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

#send-button:hover {
    background: #00796B;
    transform: scale(1.05);
}

#send-button svg {
    width: 20px;
    height: 20px;
    margin-left: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        height: 95%;
        margin: 10px;
        border-radius: 10px;
    }
    
    .back-button {
        top: 10px;
        left: 10px;
        width: 35px;
        height: 35px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-header {
        padding: 15px;
    }
    
    .chat-messages {
        padding: 15px;
    }
}

/* Estilos responsive para el chatbot */
@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        margin: 0;
    }
    
    .chat-header {
        border-radius: 0;
        padding: 15px;
    }
    
    .chat-messages {
        height: calc(100vh - 140px);
    }
    
    .chat-form {
        padding: 10px;
    }
    
    .user-input {
        font-size: 14px;
    }
    
    .message {
        padding: 10px;
        margin-bottom: 8px;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
    }
    
    .message-content {
        padding-left: 10px;
    }
    
    .api-status {
        right: 40px;
        top: 12px;
    }
    
    .clear-button {
        right: 10px;
        top: 12px;
    }
}