/* Chatbot TIP — estilos aislados (independiente de Bootstrap / style.css) */

#chatWindow {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
    -webkit-font-smoothing: antialiased;
}

#chatWindow *,
#chatWindow *::before,
#chatWindow *::after {
    box-sizing: border-box;
}

#chatWindow h1,
#chatWindow h2,
#chatWindow h3,
#chatWindow h4,
#chatWindow h5,
#chatWindow h6,
#chatWindow p,
#chatWindow label {
    margin: 0;
    padding: 0;
    font-family: inherit;
}

#chatWindow button {
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

#chatWindow input {
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    color: #334155;
    background: #fff;
}

/* Widget */
.cb-widget {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #f8fafc;
}

/* Header */
.cb-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #2563eb 100%);
    overflow: hidden;
}

.cb-header__left {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1;
}

.cb-header__avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.cb-header__info h2 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}

.cb-header__status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #ccfbf1;
    margin-top: 2px;
}

.cb-header__dot {
    width: 6px;
    height: 6px;
    background: #6ee7b7;
    border-radius: 50%;
    animation: cb-pulse 2s ease-in-out infinite;
}

@keyframes cb-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.cb-header__close {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.85);
    transition: background 0.2s, color 0.2s;
}

.cb-header__close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.cb-header__close svg {
    width: 18px;
    height: 18px;
}

/* Avatares */
.cb-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 2px solid #fff;
}

.cb-avatar--bot {
    background: linear-gradient(135deg, #14b8a6, #2563eb);
}

.cb-avatar--user {
    background: linear-gradient(135deg, #475569, #1e293b);
}

.cb-avatar svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.cb-avatar__online {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    background: #34d399;
    border: 2px solid #0d9488;
    border-radius: 50%;
}

/* Mensajes */
.cb-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    max-height: 420px;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.cb-messages::-webkit-scrollbar {
    width: 4px;
}

.cb-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.cb-msg {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    animation: cb-slide-in-left 0.4s ease-out;
}

.cb-msg--user {
    flex-direction: row-reverse;
    animation: cb-slide-in-right 0.4s ease-out;
}

@keyframes cb-slide-in-left {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes cb-slide-in-right {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

.cb-msg__body {
    max-width: 85%;
}

.cb-msg__label {
    font-size: 10px;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 4px;
}

.cb-msg--user .cb-msg__label,
.cb-msg__label--right {
    text-align: right;
}

.cb-bubble {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.55;
    border-radius: 16px;
}

.cb-bubble--bot {
    background: #fff;
    color: #334155;
    border: 1px solid #f1f5f9;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.cb-bubble--bot .cb-bubble__muted {
    color: #64748b;
}

.cb-bubble--user {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

/* Chips de servicios */
.cb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cb-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    transition: all 0.2s ease;
}

.cb-chip:hover {
    border-color: #2dd4bf;
    color: #0d9488;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.cb-chip--active {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff !important;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.cb-chip--active svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    fill: none;
}

/* Botones de acción */
.cb-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.cb-actions--center {
    justify-content: center;
}

.cb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: #fff !important;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
    transition: transform 0.15s, box-shadow 0.2s;
}

.cb-btn:hover {
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.45);
    transform: translateY(-1px);
}

.cb-btn:active {
    transform: scale(0.97);
}

.cb-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

/* Opciones Empresa / Persona */
.cb-options {
    display: flex;
    gap: 8px;
}

.cb-option {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569 !important;
    transition: all 0.2s ease;
}

.cb-option:hover {
    border-color: #2dd4bf;
    color: #0d9488 !important;
}

.cb-option--active {
    background: linear-gradient(135deg, #14b8a6, #0d9488) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

/* Formulario */
#chatWindow .cb-form {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

#chatWindow .cb-form--contact {
    margin-top: 4px;
}

#chatWindow .cb-form__group {
    margin-bottom: 14px;
}

#chatWindow .cb-form__group:last-child {
    margin-bottom: 0;
}

#chatWindow .cb-form__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569 !important;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

/* Campos modernos con icono */
#chatWindow .cb-field {
    margin-bottom: 14px;
}

#chatWindow .cb-field:last-of-type {
    margin-bottom: 0;
}

#chatWindow .cb-field__label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b !important;
    margin-bottom: 8px;
}

#chatWindow .cb-field__control {
    position: relative;
    display: flex;
    align-items: center;
}

#chatWindow .cb-field__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.2s ease;
    z-index: 1;
}

#chatWindow .cb-field__icon svg {
    width: 18px;
    height: 18px;
}

#chatWindow .cb-field__input,
#chatWindow .cb-form__input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 44px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #1e293b !important;
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 12px !important;
    outline: none !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

#chatWindow .cb-field__input::placeholder,
#chatWindow .cb-form__input::placeholder {
    color: #94a3b8 !important;
    font-weight: 400;
    opacity: 1;
}

#chatWindow .cb-field__input:hover,
#chatWindow .cb-form__input:hover {
    border-color: #cbd5e1 !important;
    background: #fafbfc !important;
}

#chatWindow .cb-field__control:focus-within .cb-field__icon {
    color: #0d9488;
}

#chatWindow .cb-field__input:focus,
#chatWindow .cb-form__input:focus {
    border-color: #14b8a6 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12), 0 2px 8px rgba(13, 148, 136, 0.08) !important;
}

#chatWindow .cb-form__actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    margin-top: 4px;
    border-top: 1px solid #f1f5f9;
}

/* Footer */
.cb-footer {
    padding: 10px 16px;
    border-top: 1px solid #f1f5f9;
    background: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.cb-footer p {
    font-size: 10px;
    color: #94a3b8;
}

.cb-footer strong {
    color: #0d9488;
    font-weight: 600;
}

.cb-spacer {
    margin-bottom: 12px;
}

/* Validación */
.cb-validation {
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    line-height: 1.4;
}

.cb-validation--error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Input con botón buscar */
.cb-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cb-input-row .cb-form__input {
    flex: 1;
}

.cb-search-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff !important;
    border-radius: 8px;
    transition: opacity 0.2s, transform 0.15s;
}

.cb-search-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.cb-search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cb-search-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
}

.cb-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cb-spin 0.7s linear infinite;
}

@keyframes cb-spin {
    to { transform: rotate(360deg); }
}

.cb-form__hint {
    font-size: 11px;
    color: #d97706;
    margin-top: 6px;
    line-height: 1.4;
}

.cb-btn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Footer tipo chat */
.cb-chat-footer {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    background: #fff;
}

#chatWindow .cb-chat-input {
    flex: 1;
    height: 46px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b !important;
    background: #f8fafc !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 23px !important;
    outline: none !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

#chatWindow .cb-chat-input::placeholder {
    color: #94a3b8 !important;
    font-weight: 400;
}

#chatWindow .cb-chat-input:focus {
    border-color: #14b8a6 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12) !important;
}

.cb-chat-send {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff !important;
    border-radius: 50%;
    transition: transform 0.15s, opacity 0.2s;
}

.cb-chat-send:hover:not(:disabled) {
    transform: scale(1.05);
}

.cb-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cb-chat-send svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
}

/* Indicador escribiendo */
.cb-bubble--typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px;
}

.cb-typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: cb-typing 1.2s ease-in-out infinite;
}

.cb-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.cb-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes cb-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}
