/* =============================================
   Dashboard Sellers - crm_ai.css
   ============================================= */

/* --- Tarjetas KPI globales --- */
.kpi-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12) !important;
}
.kpi-card-active {
    outline: 2px solid #dc3545;
    outline-offset: -2px;
    background-color: #fff5f5 !important;
}
.kpi-card .kpi-icon {
    opacity: 0.7;
}
.kpi-sellers .kpi-icon { color: #0d6efd; }
.kpi-pedidos .kpi-icon { color: #6610f2; }
.kpi-valoracion .kpi-icon { color: #ffc107; }
.kpi-alertas .kpi-icon { color: #dc3545; }
.kpi-ventas .kpi-icon { color: #198754; }
.kpi-total .kpi-icon { color: #6c757d; }

.kpi-card .kpi-value {
    line-height: 1.2;
}
.kpi-yoy {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 2px;
    min-height: 18px;
}

/* --- Tarjetas de seller --- */
.seller-dashboard-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-left: 4px solid transparent !important;
}
.seller-dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
}
.seller-dashboard-card.border-start-success {
    border-left-color: #198754 !important;
}
.seller-dashboard-card.border-start-warning {
    border-left-color: #ffc107 !important;
}
.seller-dashboard-card.border-start-danger {
    border-left-color: #dc3545 !important;
}

/* --- Indicador de salud --- */
.health-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}
.health-indicator.salud-excelente {
    background-color: #198754;
    box-shadow: 0 0 6px rgba(25, 135, 84, 0.5);
}
.health-indicator.salud-warning {
    background-color: #ffc107;
    box-shadow: 0 0 6px rgba(255, 193, 7, 0.5);
}
.health-indicator.salud-peligro {
    background-color: #dc3545;
    box-shadow: 0 0 6px rgba(220, 53, 69, 0.5);
    animation: pulse-danger 1.5s infinite;
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 0 6px rgba(220, 53, 69, 0.5); }
    50% { box-shadow: 0 0 14px rgba(220, 53, 69, 0.8); }
}

/* --- Métricas con barras de progreso --- */
.metric-label {
    min-width: 100px;
    flex-shrink: 0;
}
.metric-value {
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
}
.metric-count {
    min-width: 28px;
    flex-shrink: 0;
}
.metric-bar-container .progress {
    background-color: #e9ecef;
    border-radius: 3px;
}

/* --- Datos pendientes truncados --- */
.datos-pendientes-badge {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

/* --- Periodo toggle (cápsulas) --- */
#periodo_selector {
    gap: 6px;
}
#periodo_selector .btn {
    border-radius: 50px !important;
    padding: 4px 16px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1.5px solid #0d6efd;
    transition: all 0.2s ease;
}
#periodo_selector .btn:not(.active) {
    background-color: transparent;
    color: #0d6efd;
}
#periodo_selector .btn:not(.active):hover {
    background-color: rgba(13, 110, 253, 0.08);
}
#periodo_selector .btn.active {
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

/* --- Rounded 10 utilitario --- */
.rounded-10 {
    border-radius: 10px !important;
}

/* --- Responsive ajustes tarjetas --- */
@media (max-width: 575.98px) {
    .seller-dashboard-card .card-body {
        padding: 0.75rem !important;
    }
    .metric-label {
        min-width: 75px;
        font-size: 0.75rem;
    }
    .kpi-card .kpi-value {
        font-size: 1.5rem !important;
    }
}

/* --- Sello de vacaciones --- */
.seller-on-vacation {
    position: relative;
    overflow: hidden;
}
.seller-on-vacation .card-body {
    opacity: 0.45;
}
.vacation-stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
    z-index: 10;
    pointer-events: none;
}
.vacation-stamp span {
    display: inline-block;
    padding: 6px 22px;
    border: 4px solid #b91c1c;
    border-radius: 10px;
    color: #b91c1c;
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    opacity: 0.85;
    font-family: 'Arial Black', 'Impact', sans-serif;
    text-shadow: 1px 1px 0 rgba(185, 28, 28, 0.15);
    white-space: nowrap;
}
.vacation-stamp small {
    display: block;
    text-align: center;
    color: #b91c1c;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    opacity: 0.85;
    margin-top: 2px;
    white-space: nowrap;
}

/* --- Dropdown Opciones del Dashboard (corrige position:relative global de style.css) --- */
#seller_dashboard_page .dropdown .dropdown-menu {
    /* position: absolute !important; */
    right: 0 !important;
    left: auto !important;
}

/* =============================================
   Chatbot Julia (RAG)
   ============================================= */

/* Botón Flotante */
.chatbot-btn-container {
    position: fixed;
    bottom: 25px;
    left: 25px;
    z-index: 1050;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.chatbot-btn-container:hover {
    transform: scale(1.08);
}
.chatbot-btn-container img {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 3px solid #fff;
}

/* Ventana emergente del Chat */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    left: 25px;
    width: 380px;
    max-width: 90vw;
    height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1045;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.chatbot-window.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

.chatbot-header {
    background: linear-gradient(135deg, #0d6efd 0%, #0043a8 100%);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chatbot-header-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
}
.chatbot-header-info h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.chatbot-header-info p {
    margin: 0;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
}
.chatbot-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
}
.chatbot-close-btn:hover {
    opacity: 1;
}

/* Cuerpo del Chat */
.chatbot-body {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    word-break: break-word;
}
.chat-bubble p {
    margin-bottom: 0.8rem;
}
.chat-bubble p:last-child {
    margin-bottom: 0;
}
.chat-bubble ul, .chat-bubble ol {
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
}
.chat-bubble ul:last-child, .chat-bubble ol:last-child {
    margin-bottom: 0;
}
.chat-bubble.model {
    background: #fff;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.chat-bubble.user {
    background: #0d6efd;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Sección Input */
.chatbot-footer {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eaebec;
}
.chatbot-input-group {
    display: flex;
    gap: 10px;
}
.chatbot-input-group input {
    flex-grow: 1;
    border: 1px solid #ced4da;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
}
.chatbot-input-group input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}
.chatbot-input-group button {
    background: #0d6efd;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.chatbot-input-group button:hover {
    background: #0b5ed7;
}

.chatbot-loading {
    display: none;
    font-size: 0.85rem;
    color: #6c757d;
    padding-top: 8px;
    padding-left: 10px;
}
