html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: #f7f9fb;
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    display: flex;
    flex-direction: column;
}

.container-fluid {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#chatMessages {
    flex: 1;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    padding: 24px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0;
}

.message-row {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-row.assistant {
    align-items: flex-start;
}

.message {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 1.05rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    word-break: break-word;
    margin-bottom: 2px;
}

.user-message {
    background: linear-gradient(90deg, #fbcfe8 0%, #f9a8d4 100%);
    color: #7c2d12;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.assistant-message {
    background: #f1f5f9;
    color: #222;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.message-time {
    font-size: 0.82em;
    color: #b91c1c;
    margin-top: 2px;
    margin-bottom: 8px;
    text-align: right;
    font-style: italic;
    letter-spacing: 0.02em;
}

.message-row.assistant .message-time {
    color: #64748b;
    text-align: left;
}

/* Input siempre visible y cómodo */
#chatForm {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 8px;
    background: #fff;
    border-radius: 0;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.1);
    padding: 16px;
    margin: 0;
    z-index: 1000;
    align-items: center;
}

#attachBtn {
    height: 48px;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #f472b6;
    transition: background 0.2s, color 0.2s;
}

#attachBtn:hover {
    background: #fbcfe8;
    color: #b91c1c;
}

#messageInput {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    background: #fff;
    font-size: 1.1em;
    padding: 12px 16px;
    min-height: 48px;
}

#messageInput:focus {
    border-color: #f472b6;
    box-shadow: 0 0 0 2px rgba(244,114,182,0.1);
}

#chatForm button[type="submit"] {
    background: #f472b6;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 24px;
    font-size: 1em;
    transition: all 0.2s;
    height: 48px;
    display: flex;
    align-items: center;
}

#chatForm button[type="submit"]:hover {
    background: #ec4899;
    transform: translateY(-1px);
}

/* Soporte para multimedia */
.message-media {
    margin-top: 12px;
    max-width: 100%;
}

.message-media img {
    max-width: 200px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-media img:hover {
    transform: scale(1.02);
}

.message-media audio {
    width: 100%;
    max-width: 300px;
    margin-top: 8px;
}

/* Header y Footer */
.app-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.app-footer {
    background: #fff;
    border-top: 1px solid #e5e7eb;
    color: #64748b;
    padding: 16px 0;
    text-align: center;
    position: sticky;
    bottom: 0;
    z-index: 999;
}

.app-footer a {
    color: #ec4899;
    text-decoration: underline;
}

.app-footer a:hover {
    color: #b91c1c;
}

/* Responsive */
@media (max-width: 768px) {
    .message {
        max-width: 85%;
    }

    #chatForm {
        padding: 12px;
    }

    #chatForm button[type="submit"] {
        padding: 0 16px;
    }
}