/* ============================================================
   ORIENTAL PLUS CARS — CHATBOT WIDGET
   chatbot.css — Estilos del widget flotante
   ============================================================ */

/* === BOTÓN FLOTANTE === */
#opc-chat-btn {
    position: fixed;
    bottom: 28px;
    left: 28px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #F97316, #EA580C);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.45);
    z-index: 9990;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    border: none;
    outline: none;
}
#opc-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(249, 115, 22, 0.6);
}
#opc-chat-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: transform 0.3s ease;
}
#opc-chat-btn.is-open svg {
    transform: rotate(90deg);
}

/* Badge de notificación */
#opc-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f0f11;
    animation: pulse-badge 1.5s infinite;
}
@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.2); }
}

/* Tooltip "¿Necesitas ayuda?" */
#opc-chat-tooltip {
    position: fixed;
    bottom: 36px;
    left: 100px;
    background: #1c1c1f;
    border: 1px solid rgba(249,115,22,0.3);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 20px;
    white-space: nowrap;
    z-index: 9989;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    animation: fadeInLeft 0.4s ease forwards;
    font-family: 'Inter', sans-serif;
}
#opc-chat-tooltip::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
    border: 7px solid transparent;
    border-right-color: rgba(249,115,22,0.3);
    border-left: none;
}
@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* === VENTANA DEL CHAT === */
#opc-chat-window {
    position: fixed;
    bottom: 100px;
    left: 28px;
    width: 380px;
    max-height: 560px;
    background: #111113;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(249,115,22,0.1);
    display: flex;
    flex-direction: column;
    z-index: 9991;
    overflow: hidden;
    animation: slideUpChat 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    font-family: 'Inter', sans-serif;
}
#opc-chat-window.is-closing {
    animation: slideDownChat 0.25s ease forwards;
}
@keyframes slideUpChat {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideDownChat {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(20px) scale(0.97); }
}

/* Header del chat */
#opc-chat-header {
    background: linear-gradient(135deg, #1a1a1d, #1f1f23);
    border-bottom: 1px solid rgba(249,115,22,0.15);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.opc-header-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #F97316, #EA580C);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.opc-header-info { flex: 1; }
.opc-header-name {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    line-height: 1.2;
}
.opc-header-status {
    font-size: 11px;
    color: #22c55e;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}
.opc-status-dot {
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}
#opc-close-btn {
    background: rgba(255,255,255,0.07);
    border: none;
    color: #a1a1aa;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
#opc-close-btn:hover { background: rgba(239,68,68,0.2); color: #ef4444; }

/* Cuerpo del chat — mensajes */
#opc-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(249,115,22,0.2) transparent;
}
#opc-chat-body::-webkit-scrollbar { width: 4px; }
#opc-chat-body::-webkit-scrollbar-track { background: transparent; }
#opc-chat-body::-webkit-scrollbar-thumb { background: rgba(249,115,22,0.25); border-radius: 4px; }

/* Burbuja del bot */
.opc-bubble-bot {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: bubbleIn 0.3s ease forwards;
}
.opc-bubble-bot-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #F97316, #EA580C);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 2px;
}
.opc-bubble-bot-text {
    background: #1e1e22;
    border: 1px solid rgba(255,255,255,0.07);
    color: #e4e4e7;
    padding: 10px 14px;
    border-radius: 4px 16px 16px 16px;
    font-size: 13.5px;
    line-height: 1.5;
    max-width: 85%;
}
@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Indicador de "escribiendo..." */
.opc-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #1e1e22;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 4px 16px 16px 16px;
}
.opc-typing span {
    width: 6px;
    height: 6px;
    background: #F97316;
    border-radius: 50%;
    animation: typing-dot 1.2s infinite;
}
.opc-typing span:nth-child(2) { animation-delay: 0.2s; }
.opc-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1);   opacity: 1; }
}

/* Botones de opción (chips) */
.opc-options {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 4px;
    animation: bubbleIn 0.35s ease forwards;
}
.opc-option-btn {
    background: rgba(249,115,22,0.08);
    border: 1px solid rgba(249,115,22,0.25);
    color: #fff;
    padding: 9px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    text-align: left;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.opc-option-btn:hover {
    background: rgba(249,115,22,0.18);
    border-color: rgba(249,115,22,0.5);
    transform: translateX(3px);
}
.opc-option-btn:active { transform: translateX(3px) scale(0.98); }

/* Botón de WhatsApp dentro del chat */
.opc-wa-btn {
    background: linear-gradient(135deg, #25D366, #128C7E);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.15s;
    text-decoration: none;
}
.opc-wa-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Botón secundario (volver, link) */
.opc-sec-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: #a1a1aa;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12.5px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}
.opc-sec-btn:hover { background: rgba(255,255,255,0.06); color: #e4e4e7; }

/* === FORMULARIO DENTRO DEL CHAT === */
.opc-form { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.opc-form label {
    font-size: 11px;
    font-weight: 600;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.opc-form input,
.opc-form select,
.opc-form textarea {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
    padding: 9px 12px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.opc-form input:focus,
.opc-form select:focus,
.opc-form textarea:focus {
    border-color: rgba(249,115,22,0.5);
    box-shadow: 0 0 0 2px rgba(249,115,22,0.1);
}
.opc-form input::placeholder { color: #52525b; }
.opc-form select option { background: #1e1e22; color: #fff; }
.opc-form textarea { resize: none; height: 70px; }

.opc-submit-btn {
    background: linear-gradient(135deg, #F97316, #EA580C);
    border: none;
    color: white;
    padding: 11px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13.5px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.15s;
    margin-top: 4px;
}
.opc-submit-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.opc-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Mensaje de éxito/error */
.opc-form-success {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.25);
    color: #4ade80;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    text-align: center;
    animation: bubbleIn 0.3s ease;
}
.opc-form-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.25);
    color: #f87171;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    text-align: center;
}

/* Disclaimer */
.opc-disclaimer {
    font-size: 10.5px;
    color: #52525b;
    text-align: center;
    line-height: 1.4;
    margin-top: 2px;
}

/* Divider */
.opc-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 4px 0;
}

/* === RESPONSIVE MOBILE === */
@media (max-width: 480px) {
    #opc-chat-window {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
    }
    #opc-chat-btn {
        bottom: 20px;
        left: 20px;
    }
    #opc-chat-tooltip {
        display: none;
    }
}
