/* ==========================================
   AISCAN CHAT BOT - CSS LIMPIO
   ========================================== */

#aiscan-chat-bubble {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    z-index: 99999;
    transition: transform 0.2s;
}

#aiscan-chat-bubble:hover {
    transform: scale(1.08);
}

#aiscan-chat-bar {
    position: fixed;
    bottom: 0;
    right: 25px;
    width: 290px;
    height: 44px;
    background: #ffffff;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid #e4e4e7;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    z-index: 99999;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.aiscan-bar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    color: #18181b;
}

.aiscan-status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
}

#aiscan-chat-window {
    position: fixed;
    bottom: 20px;
    right: 25px;
    width: 380px;
    height: 560px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
    border: 1px solid #e4e4e7;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header */
.aiscan-chat-header {
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f4f4f5;
    background: #ffffff;
}

.aiscan-chat-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aiscan-header-title-row {
    font-size: 15px;
    color: #09090b;
    font-weight: 600;
}

.aiscan-header-subtitle {
    font-size: 11px;
    color: #71717a;
}

.aiscan-header-actions, .aiscan-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.aiscan-header-actions button, .aiscan-bar-actions button {
    background: transparent;
    border: none;
    color: #71717a;
    padding: 4px;
    cursor: pointer;
    font-size: 14px;
    border-radius: 4px;
}

.aiscan-header-actions button:hover {
    color: #18181b;
    background: #f4f4f5;
}

/* Body */
.aiscan-chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #ffffff;
    display: flex;
    flex-direction: column;
}

.aiscan-welcome-container {
    margin: auto 0;
    text-align: center;
}

.aiscan-welcome-container h3 {
    font-size: 18px;
    font-weight: 600;
    color: #09090b;
    margin-bottom: 20px;
}

.aiscan-chips-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.aiscan-chip-btn {
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12px;
    color: #27272a;
    cursor: pointer;
    text-align: center;
}

/* Mensajes */
.aiscan-msg {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 10px;
}

.aiscan-msg-system {
    max-width: 95%;
    background-color: #f4f4f5;
    color: #09090b;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.aiscan-msg-user {
    max-width: 82%;
    background-color: #18181b;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    word-break: break-word;
}

/* Tablas */
.aiscan-table-container {
    overflow-x: auto;
    margin-top: 8px;
    margin-bottom: 4px;
    border-radius: 8px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
}

.aiscan-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    text-align: left;
}

.aiscan-data-table th, 
.aiscan-data-table td {
    padding: 6px 10px !important;
    white-space: nowrap !important;
    border-bottom: 1px solid #f4f4f5;
}

.aiscan-data-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #334155;
    border-bottom: 2px solid #e2e8f0;
}

.aiscan-table-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.btn-excel, .btn-pdf {
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-excel { background-color: #10b981; }
.btn-pdf { background-color: #ef4444; }

/* Adjuntos y Footer */
.aiscan-file-preview {
    padding: 6px 16px;
    background: #f4f4f5;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e4e4e7;
}

.aiscan-file-preview button {
    background: none;
    border: none;
    cursor: pointer;
    color: #71717a;
}

.aiscan-chat-footer {
    padding: 12px 16px;
    border-top: 1px solid #f4f4f5;
    background: #ffffff;
}

.aiscan-input-pill {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid #18181b;
    border-radius: 25px;
    padding: 4px 6px 4px 12px;
    gap: 8px;
}

.aiscan-attach-btn {
    font-size: 20px;
    color: #71717a;
    cursor: pointer;
    font-weight: 300;
    user-select: none;
}

.aiscan-input-pill input[type="text"] {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    color: #09090b;
    background: transparent;
}

.aiscan-send-btn {
    width: 32px;
    height: 32px;
    background: #18181b;
    color: white;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.aiscan-disclaimer {
    text-align: center;
    font-size: 10px;
    color: #a1a1aa;
    margin-top: 8px;
}

.aiscan-d-none, .hidden {
    display: none !important;
}

/* ESTILOS DEL CIRCULO Y COLOR BLANCO DEL ICONO */
.aiscan-avatar-circle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #18181b !important;
    border-radius: 50% !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    box-sizing: border-box !important;
}
/* Tamaños de Avatar */
.aiscan-chat-title-group .aiscan-avatar-circle,
.aiscan-bar-info .aiscan-avatar-circle {
    width: 32px !important;
    height: 32px !important;
    padding: 6px !important;
}

.aiscan-welcome-container .aiscan-avatar-circle {
    width: 52px !important;
    height: 52px !important;
    padding: 10px !important;
    margin: 0 auto 16px !important;
}

#aiscan-chat-bubble .aiscan-avatar-circle {
    width: 56px !important;
    height: 56px !important;
    padding: 12px !important;
}

/* Formato del SVG */
.aiscan-openai-icon {
    width: 100% !important;
    height: 100% !important;
    color: #ffffff !important;
}

.aiscan-openai-icon path {
    fill: currentColor !important;
}

/* Dots */
.aiscan-typing-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #71717a;
    font-size: 12px;
}
.aiscan-typing-dots .dots { display: flex; gap: 3px; }
.aiscan-typing-dots .dot {
    width: 5px;
    height: 5px;
    background-color: #18181b;
    border-radius: 50%;
    animation: aiscanBounce 1.4s infinite ease-in-out both;
}
.aiscan-typing-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.aiscan-typing-dots .dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes aiscanBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Kontai IA — panel contextual del sistema */
#aiscan-chat-bubble {
    right: 24px;
    bottom: 22px;
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: linear-gradient(145deg, #00bd72, #008e58);
    box-shadow: 0 12px 30px rgba(0, 122, 79, .28);
}

#aiscan-chat-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(0, 122, 79, .34);
}

#aiscan-chat-window {
    right: 20px;
    bottom: 18px;
    width: min(410px, calc(100vw - 32px));
    height: min(650px, calc(100vh - 92px));
    border: 1px solid #dfe7e3;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(7, 23, 36, .2);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.aiscan-chat-header {
    min-height: 64px;
    padding: 13px 15px;
    background: #fff;
    border-bottom-color: #e5ece8;
}

.aiscan-header-title-row {
    color: #071724;
    font-weight: 750;
    letter-spacing: -.01em;
}

.aiscan-header-subtitle {
    color: #647789;
}

.aiscan-status-dot {
    background: #00ae68;
    box-shadow: 0 0 0 4px rgba(0, 174, 104, .1);
}

.aiscan-chat-body {
    padding: 15px;
    background: #f8faf9;
}

.aiscan-welcome-container h3 {
    color: #0b1d2d;
    font-weight: 720;
}

.aiscan-chip-btn {
    color: #214052;
    background: #fff;
    border-color: #dce6e1;
    border-radius: 10px;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.aiscan-chip-btn:hover {
    color: #007d4e;
    background: #eafbf3;
    border-color: rgba(0, 174, 104, .32);
    transform: translateY(-1px);
}

.aiscan-msg {
    border-radius: 13px;
    line-height: 1.5;
}

.aiscan-msg-system {
    color: #183246;
    background: #fff;
    border: 1px solid #e1e9e5;
}

.aiscan-msg-user {
    color: #fff;
    background: #08784e;
}

.aiscan-chat-footer {
    background: #fff;
    border-top-color: #e5ece8;
}

.aiscan-input-pill {
    min-height: 44px;
    border: 1px solid #ccd8d2;
    border-radius: 12px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.aiscan-input-pill:focus-within {
    border-color: #00ae68;
    box-shadow: 0 0 0 3px rgba(0, 174, 104, .11);
}

.aiscan-send-btn {
    background: #00ae68;
}

.aiscan-send-btn:hover {
    background: #008f57;
}

.aiscan-avatar-circle,
.aiscan-chat-title-group .aiscan-avatar-circle,
.aiscan-bar-info .aiscan-avatar-circle,
.aiscan-welcome-container .aiscan-avatar-circle,
#aiscan-chat-bubble .aiscan-avatar-circle {
    background: linear-gradient(145deg, #00bd72, #008e58) !important;
    box-shadow: 0 7px 18px rgba(0, 174, 104, .22) !important;
}

#aiscan-chat-bubble .aiscan-avatar-circle {
    width: 52px !important;
    height: 52px !important;
    border-radius: 15px !important;
}

.aiscan-typing-dots .dot {
    background-color: #00ae68;
}

@media (max-width: 575.98px) {
    #aiscan-chat-window {
        right: 8px;
        bottom: 8px;
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
    }
}
