/* chatbot_cimentando.css */
/* Widget de Chat — Cimentando Fleet Analytics */

/* ─── Variables ─────────────────────────────────────────── */
:root {
    --chat-navy-1: #1e3c72;
    --chat-navy-2: #2a5298;
    --chat-gold: #ffd700;
    --chat-bg-bot: #ffffff;
    --chat-bg-user: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --chat-text: #2c3e50;
    --chat-muted: #6b7280;
    --chat-border: #e5e7eb;
    --chat-radius: 16px;
    --chat-shadow: 0 12px 28px rgba(0,0,0,0.18);
    --chat-font: 'Inter', 'Segoe UI', Tahoma, sans-serif;
}

/* ─── Contenedor ────────────────────────────────────────── */
.cimentando-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: var(--chat-font);
}

/* ─── Botón flotante ────────────────────────────────────── */
.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-navy-1) 0%, var(--chat-navy-2) 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform .2s ease, box-shadow .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}
.chat-button svg { width: 28px; height: 28px; }

/* ─── Ventana ───────────────────────────────────────────── */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity .2s ease, transform .2s ease;
}

.chat-window.hidden {
    display: none;
}

/* ─── Header ────────────────────────────────────────────── */
.chat-header {
    background: linear-gradient(135deg, var(--chat-navy-1) 0%, var(--chat-navy-2) 100%);
    color: white;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-header-actions {
    display: flex;
    gap: 4px;
}
.reset-chat, .close-chat {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background .15s;
}
.reset-chat:hover, .close-chat:hover {
    background: rgba(255,255,255,.15);
}

/* ─── Mensajes ──────────────────────────────────────────── */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f5f7fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

/* Bot */
.bot-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.bot-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--chat-navy-1) 0%, var(--chat-navy-2) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.bot-text {
    background: var(--chat-bg-bot);
    padding: 12px 16px;
    border-radius: 18px;
    border-top-left-radius: 4px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.5;
    color: var(--chat-text);
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    white-space: pre-wrap;
}
.bot-text a { color: var(--chat-navy-2); text-decoration: underline; }

/* User */
.user-message {
    display: flex;
    justify-content: flex-end;
}
.user-text {
    background: var(--chat-bg-user);
    color: white;
    padding: 12px 16px;
    border-radius: 18px;
    border-top-right-radius: 4px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ─── Typing ────────────────────────────────────────────── */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.typing-indicator span {
    width: 8px; height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: .2s; }
.typing-indicator span:nth-child(3) { animation-delay: .4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: .4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ─── Quick replies ─────────────────────────────────────── */
.chat-options {
    padding: 10px 16px;
    background: white;
    border-top: 1px solid var(--chat-border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.option-btn {
    background: #f0f2f5;
    border: 1px solid var(--chat-border);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s ease;
    color: var(--chat-text);
    font-family: inherit;
}
.option-btn:hover {
    background: var(--chat-navy-1);
    color: white;
    border-color: var(--chat-navy-1);
}

/* ─── Input ─────────────────────────────────────────────── */
.chat-input-container {
    display: flex;
    padding: 12px;
    background: white;
    border-top: 1px solid var(--chat-border);
    gap: 8px;
}
.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--chat-border);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color .2s;
}
.chat-input:focus { border-color: var(--chat-navy-2); }
.send-btn {
    background: linear-gradient(135deg, var(--chat-navy-1) 0%, var(--chat-navy-2) 100%);
    border: none;
    color: white;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s;
}
.send-btn:hover { transform: scale(1.05); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Tarjeta de producto/herramienta ───────────────────── */
.chat-card {
    background: white;
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    padding: 14px 16px;
    max-width: 85%;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
    font-size: 13px;
    color: var(--chat-text);
}
.chat-card-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--chat-navy-1);
    margin-bottom: 4px;
}
.chat-card-desc {
    color: var(--chat-muted);
    margin-bottom: 10px;
    line-height: 1.4;
}
.chat-card-prices {
    display: flex;
    gap: 12px;
    font-size: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.chat-card-price {
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--chat-text);
}
.chat-card-price strong { color: var(--chat-navy-1); }
.chat-card-cta {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--chat-navy-1) 0%, var(--chat-navy-2) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: transform .15s;
}
.chat-card-cta:hover { transform: translateY(-1px); }
.chat-card-cta.secondary {
    background: white;
    color: var(--chat-navy-1);
    border: 1px solid var(--chat-navy-1);
}

/* ─── Tarjeta de simulación ─────────────────────────────── */
.chat-sim {
    background: #f9fafb;
    border: 1px solid var(--chat-border);
    border-left: 4px solid var(--chat-gold);
    border-radius: 8px;
    padding: 12px 14px;
    max-width: 85%;
    font-size: 13px;
}
.chat-sim-title {
    font-weight: 600;
    color: var(--chat-navy-1);
    margin-bottom: 8px;
    font-size: 14px;
}
.chat-sim-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    color: var(--chat-text);
}
.chat-sim-row.total {
    border-top: 1px solid var(--chat-border);
    margin-top: 6px;
    padding-top: 8px;
    font-weight: 600;
    color: var(--chat-navy-1);
}
.chat-sim-note {
    font-size: 11px;
    color: var(--chat-muted);
    margin-top: 8px;
    line-height: 1.4;
    font-style: italic;
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 24px);
        right: -8px;
        height: auto;
        max-height: calc(100vh - 100px);
        bottom: 72px;
    }
    .bot-text, .user-text, .chat-card, .chat-sim {
        max-width: 90%;
    }
}

/* Coordinación del chat con el WhatsApp flotante */

/* El chat va abajo a la derecha */
.cimentando-chat-widget {
    position: fixed !important;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* El WhatsApp sube por encima del chat */
.whatsapp-float {
    bottom: 96px !important;
    right: 20px !important;
    z-index: 9998;
}

/* En móvil, ajustamos también */
@media (max-width: 480px) {
    .cimentando-chat-widget {
        bottom: 16px;
        right: 16px;
    }
    .whatsapp-float {
        bottom: 88px !important;
        right: 16px !important;
    }
    .chat-button {
        width: 52px;
        height: 52px;
    }
    .chat-button svg {
        width: 24px;
        height: 24px;
    }
}

