/* Chat flotante MartaPache — tema dark alineado al sistema v2 */

:root {
    --mp-pache-red-500: #e83f33;
    --mp-pache-red-600: #c72d22;
    --mp-sage-500: #4e7d5f;
    --mp-navy-800: #1b333e;
    --mp-navy-700: #264653;
    --mp-slate-950: #020617;
    --mp-slate-900: #0f172a;
    --mp-slate-800: #1e293b;
    --mp-slate-700: #334155;
    --mp-slate-400: #94a3b8;
    --mp-slate-200: #e2e8f0;
    --mp-slate-100: #f1f5f9;
}

.mp-chat-root {
    position: fixed !important;
    right: 1.5rem !important;
    bottom: 1.5rem !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 0.75rem !important;
    pointer-events: none !important;
}

.mp-chat-root * {
    pointer-events: auto !important;
    box-sizing: border-box;
}

.mp-chat-panel {
    display: flex;
    width: min(24rem, calc(100vw - 2rem));
    height: min(32rem, 70vh);
    flex-direction: column;
    overflow: hidden;
    border-radius: 1rem;
    border: 1px solid var(--mp-slate-800);
    background: color-mix(in srgb, var(--mp-slate-900) 95%, transparent);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.15), 0 8px 10px -6px rgb(0 0 0 / 0.15);
}

.mp-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--mp-navy-700);
    background: var(--mp-navy-800);
    flex-shrink: 0;
}

.mp-chat-header strong {
    display: block;
    color: var(--mp-slate-100);
    font-size: 0.875rem;
}

.mp-chat-header span {
    display: block;
    color: var(--mp-slate-400);
    font-size: 0.75rem;
}

.mp-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.mp-chat-header-actions button {
    border: 0;
    background: transparent;
    color: var(--mp-slate-400);
    border-radius: 0.5rem;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
}

.mp-chat-header-actions button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--mp-slate-100);
}

.mp-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    background: var(--mp-slate-900);
}

.mp-chat-empty,
.mp-chat-thinking {
    color: var(--mp-slate-400);
    font-size: 0.875rem;
    margin: 0;
}

.mp-chat-bubble-user,
.mp-chat-bubble-assistant {
    display: block;
    height: auto !important;
    max-height: none !important;
    width: fit-content;
    max-width: 92%;
    flex: 0 0 auto !important;
    padding: 0.45rem 0.7rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.mp-chat-bubble-user {
    align-self: flex-end;
    background: var(--mp-pache-red-500);
    color: #ffffff;
    border-radius: 1rem 1rem 0.25rem 1rem;
}

.mp-chat-bubble-assistant {
    align-self: flex-start;
    background: color-mix(in srgb, var(--mp-slate-800) 80%, transparent);
    color: var(--mp-slate-100);
    border: 1px solid var(--mp-slate-700);
    border-radius: 1rem 1rem 1rem 0.25rem;
}

.mp-chat-role {
    margin: 0 0 0.2rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.7;
    line-height: 1.2;
}

.mp-chat-text {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.mp-chat-text--md {
    white-space: normal;
}

.mp-chat-text > :first-child {
    margin-top: 0;
}

.mp-chat-text > :last-child {
    margin-bottom: 0;
}

.mp-chat-text p,
.mp-chat-text ul,
.mp-chat-text ol {
    margin: 0.35rem 0;
}

.mp-chat-text ul,
.mp-chat-text ol {
    padding-left: 1.15rem;
}

.mp-chat-text li {
    margin: 0.15rem 0;
}

.mp-chat-text strong {
    font-weight: 700;
}

.mp-chat-text a {
    color: #9ec7ac;
    text-decoration: underline;
}

.mp-chat-form {
    border-top: 1px solid var(--mp-slate-800);
    background: var(--mp-slate-950);
    padding: 0.75rem;
    flex-shrink: 0;
}

.mp-chat-form textarea {
    width: 100%;
    min-height: 3.5rem;
    max-height: 7rem;
    resize: vertical;
    border-radius: 0.75rem;
    border: 1px solid var(--mp-slate-700);
    background: var(--mp-slate-950);
    color: #ffffff;
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    line-height: 1.35;
}

.mp-chat-form textarea:focus {
    outline: none;
    border-color: var(--mp-sage-500);
    box-shadow: 0 0 0 2px rgba(78, 125, 95, 0.25);
}

.mp-chat-error {
    color: #fca5a5;
    font-size: 0.75rem;
    margin: 0 0 0.5rem;
}

.mp-chat-send {
    width: 100%;
    border: 0;
    border-radius: 0.75rem;
    background: var(--mp-sage-500);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
}

.mp-chat-send:hover {
    background: #3d644b;
}

.mp-chat-send:disabled {
    opacity: 0.6;
    cursor: wait;
}

.mp-chat-fab {
    width: 3.75rem !important;
    height: 3.75rem !important;
    border: 0 !important;
    border-radius: 9999px !important;
    background: var(--mp-pache-red-500) !important;
    color: #ffffff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 10px 15px -3px rgba(232, 63, 51, 0.35) !important;
    flex-shrink: 0;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.mp-chat-fab:hover {
    background: var(--mp-pache-red-600) !important;
    transform: scale(1.05);
}

.mp-chat-fab svg {
    width: 1.75rem;
    height: 1.75rem;
}
