/* ========================================================================= */
/* =========   ESTILOS GENERALES Y TEMA PRINCIPAL (NEURA)    ========= */
/* ========================================================================= */
:root {
    --primary-dark: #2C3E50;
    --secondary-dark: #34495E;
    --accent-red: #E74C3C;
    --accent-yellow: #F39C12;
    --light-bg: #F8F9FA;
    --dark-text: #212529;
    --border-color: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--primary-dark);
    padding-top: 70px; /* Espacio para el navbar fijo */
}

/* --- NavBar Fijo --- */
.navbar {
    background-color: var(--primary-dark) !important;
    border-bottom: 1px solid var(--border-color);
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}
.navbar-brand { color: white !important; font-weight: 700; display: flex; align-items: center; }
.navbar-brand img { margin-right: 10px; border-radius: 5px; filter: brightness(0) invert(1); }
.navbar .btn-outline-light { color: white; border-color: rgba(255, 255, 255, 0.5); }
.navbar .btn-outline-light:hover { color: var(--primary-dark); background-color: white; }

/* --- Contenedor y Paneles del Dashboard --- */
.main-container { padding-top: 2rem; padding-bottom: 2rem; max-width: 1400px; }
.config-panel { background-color: #ffffff; padding: 2rem; border-radius: 12px; box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); height: 100%; }
.config-panel h2 { color: var(--dark-text); margin-bottom: 1.5rem; }
.text-muted { color: #6c757d !important; }

/* --- Forms Generales --- */
.form-label { font-weight: 500; color: var(--dark-text); }
.form-control, .form-select { border: 1px solid #ced4da; border-radius: 8px; padding: 0.75rem 1rem; background-color: #f0f2f5; }
.form-control:focus, .form-select:focus { border-color: var(--accent-red); box-shadow: 0 0 0 0.25rem rgba(231, 76, 60, 0.15); }

/* --- Botones Generales --- */
.btn { border-radius: 8px; padding: 0.8rem 1.5rem; font-weight: 600; transition: all 0.2s ease-in-out; }
.btn-primary { background-color: var(--accent-red) !important; border-color: var(--accent-red) !important; }
.btn-primary:hover { background-color: #C0392B !important; border-color: #C0392B !important; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); }
.btn-success { background-color: var(--accent-yellow) !important; border-color: var(--accent-yellow) !important; color: #fff !important; }
.btn-success:hover { background-color: #D68910 !important; border-color: #D68910 !important; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); }


/* ========================================================================= */
/* =========     ESTILOS PARA SIMULADOR DE WHATSAPP (DASHBOARD)    ========= */
/* ========================================================================= */
.whatsapp-simulator {
    background-color: #E5DDD5;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    height: 85vh;
    min-height: 600px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    padding: 0;
}
.whatsapp-simulator .chat-header { background-color: #005E54; color: white; padding: 10px 15px; display: flex; align-items: center; flex-shrink: 0; }
.whatsapp-simulator .chat-header .avatar {font-size: 2.2rem; margin-right: 15px;}
.whatsapp-simulator .chat-header .contact-info { flex-grow: 1; }
/* CORRECCIÓN FINAL: Quita el margen de los párrafos en el header */
.whatsapp-simulator .chat-header .contact-name,
.whatsapp-simulator .chat-header .status {
    margin: 0;
    line-height: 1.2;
}
/* Iconos del header - espaciado correcto */
.whatsapp-simulator .chat-header .icons {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 1.3rem;
    margin-left: 10px;
}
.whatsapp-simulator .chat-header .icons i {
    cursor: pointer;
    transition: opacity 0.2s;
}
.whatsapp-simulator .chat-header .icons i:hover {
    opacity: 0.7;
}
.whatsapp-simulator .chat-body { flex-grow: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.whatsapp-simulator .chat-footer { background-color: #f0f2f5; padding: 10px 15px; display: flex; align-items: center; flex-shrink: 0; border-top: 1px solid #ddd; gap: 10px; }
.whatsapp-simulator .chat-footer .form-control { border-radius: 20px !important; border: none !important; background-color: #ffffff !important; padding: 8px 12px !important; }
.whatsapp-simulator .chat-footer .btn-icon { background: none; border: none; font-size: 1.5rem; color: #54656f; padding: 0; }
.whatsapp-simulator .btn-send { background-color: #005E54; color: white; border-radius: 50%; width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border: none; transition: background-color 0.2s; padding: 0 !important; flex-shrink: 0; }
.whatsapp-simulator .btn-send:hover { background-color: #004b43; }


/* ========================================================================= */
/* =========      ESTILOS PARA PÁGINA DE CONVERSACIONES (CRM)      ========= */
/* ========================================================================= */
.chat-layout { height: calc(100vh - 70px); overflow: hidden; }
.chat-layout .row, .chat-layout .col-md-4, .chat-layout .col-md-8, .chat-panel { height: 100%; }
.conversation-list { background-color: #ffffff; height: 100%; overflow-y: auto; border-right: 1px solid #dee2e6; }
.chat-panel { display: flex; flex-direction: column; background-color: #E5DDD5; }
.chat-header-crm { background-color: #f0f2f5; color: #3b4a54; flex-shrink: 0; box-shadow: 0 1px 2px rgba(0,0,0,0.1); padding: 1rem 1.5rem; }
.chat-body-crm { flex-grow: 1; overflow-y: auto; padding: 20px; background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png'); display: flex; flex-direction: column; gap: 8px; }
.chat-footer-crm { padding: 10px 15px; background-color: #f0f2f5; border-top: 1px solid #ddd; flex-shrink: 0; display: flex; align-items: center; gap: 15px; }
.chat-footer-crm .form-control { border-radius: 20px; border: none; background-color: #ffffff; padding: 10px 15px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.05); }
.chat-footer-crm .btn-send-crm { background-color: #005E54; color: white; border-radius: 50%; width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border: none; transition: background-color 0.2s; flex-shrink: 0; }
.chat-footer-crm .btn-send-crm:hover { background-color: #004b43; }
.wa-chat-list-item { display: flex; align-items: center; padding: 1rem; cursor: pointer; border-bottom: 1px solid #f0f2f5; transition: background-color 0.2s ease-in-out; }
.wa-chat-list-item:hover { background-color: #f0f2f5; }
.wa-chat-list-item.active { background-color: #e9ecef; }
.wa-chat-list-item .avatar { width: 50px; height: 50px; border-radius: 50%; background-color: #dfe5e7; color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-right: 15px; flex-shrink: 0; }
.wa-chat-list-item .chat-info { flex-grow: 1; overflow: hidden; }
.wa-chat-list-item .chat-info .info-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.25rem; }
.wa-chat-list-item .chat-info .info-top .name { font-weight: 600; color: #111b21; white-space: nowrap; }
.wa-chat-list-item .chat-info .info-top .time { font-size: 0.75rem; color: #667781; white-space: nowrap; margin-left: 10px; }
.wa-chat-list-item .chat-info .message-snippet { font-size: 0.9rem; color: #667781; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* ========================================================================= */
/* =========   BURBUJAS DE MENSAJE (UNIFICADO Y CORREGIDO)   ========= */
/* ========================================================================= */
.message {
    max-width: 75%; padding: 8px 12px; border-radius: 8px; word-wrap: break-word; white-space: pre-wrap; font-size: 0.95em; line-height: 1.4; box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}
/* Burbujas para el SIMULADOR del Dashboard */
.whatsapp-simulator .message.user { align-self: flex-end; background-color: #dcf8c6; }
.whatsapp-simulator .message.bot { align-self: flex-start; background-color: #ffffff; }
/* Burbujas para la PÁGINA DE CONVERSACIONES (CRM) */
.chat-panel .message.user { align-self: flex-start; background-color: #ffffff; }
.chat-panel .message.bot { align-self: flex-end; background-color: #dcf8c6; }


/* ========================================================================= */
/* =========      OFFCANVAS, AUTH & ADMIN STYLES   ========= */
/* ========================================================================= */
.offcanvas-header { background-color: var(--primary-dark); color: white; padding: 1.5rem; border-bottom: none; }
.offcanvas-header .offcanvas-title {color: white; font-weight: 600;}
.offcanvas-header .btn-close {filter: invert(1);}
.offcanvas-body {padding: 1.5rem; background-color: var(--light-bg);}
.offcanvas-body h6 { color: var(--primary-dark); font-weight: 600; margin-bottom: 1rem; border-bottom: 2px solid rgba(231, 76, 60, 0.3); padding-bottom: 0.5rem; }
.plan-card { background-color: #ffffff; border: 2px solid #e9ecef; border-radius: 10px; padding: 1rem; margin-bottom: 10px; transition: all 0.2s ease-in-out; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
.plan-card:hover {border-color: var(--accent-red); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); transform: translateY(-2px);}
.form-check-input:checked + .form-check-label .plan-card { border-color: var(--accent-red); background-color: #ffe6e6; box-shadow: 0 4px 15px rgba(231, 76, 60, 0.2); }

.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding-top: 0; background-color: #f0f2f5;}
.auth-container { max-width: 450px; width: 100%; }
.auth-container .card { border-radius: 12px; box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); border: none; }
.auth-container .card-title {color: var(--primary-dark); font-weight: 700;}

.admin-dashboard body { padding-top: 70px; background-color: #f8f9fa; }
.admin-dashboard .navbar { box-shadow: 0 2px 4px rgba(0,0,0,.1); }
.admin-dashboard .main-content { padding-left: 2rem; padding-right: 2rem; }
.admin-dashboard .table .badge { font-size: 0.9em; padding: 0.5em 0.75em; }
.admin-dashboard .actions-btn-group .btn { margin-right: 5px; }



/* --- Estilos para Acordeón de Disparadores --- */
.accordion-item {
    border-radius: 8px !important;
    border: 1px solid #dee2e6;
    margin-bottom: 0.5rem;
    overflow: hidden; /* Para que el borde redondeado se aplique bien */
}
.accordion-button {
    font-weight: 500;
    color: var(--primary-dark);
}
.accordion-button:not(.collapsed) {
    background-color: #fff3e6; /* Color amarillo suave al expandir */
    color: var(--primary-dark);
    box-shadow: none;
}
.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(231, 76, 60, 0.15);
}
.accordion-body {
    background-color: #f8f9fa;
}


/* ========================================================================= */
/* =========      ESTILOS PARA PÁGINA DE CONVERSACIONES (CRM)      ========= */
/* ========================================================================= */
.chat-layout { 
    height: calc(100vh - 70px);
    overflow: hidden;
}
.chat-layout .row, .chat-layout .col-md-4, .chat-layout .col-md-8, .chat-panel {
    height: 100%;
}
.conversation-list {
    background-color: #ffffff;
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid #dee2e6;
}
.chat-panel {
    display: flex;
    flex-direction: column;
    background-color: #E5DDD5;
}
.chat-header-crm {
    background-color: #f0f2f5;
    color: #3b4a54;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    padding: 1rem 1.5rem;
}
.chat-body-crm {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    display: flex;
    flex-direction: column;
    gap: 8px; 
}
.chat-footer-crm {
    padding: 10px 15px;
    background-color: #f0f2f5;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}
.chat-footer-crm .form-control {
    border-radius: 20px;
    border: none;
    background-color: #ffffff;
    padding: 10px 15px; 
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.chat-footer-crm .btn-send-crm {
    background-color: #005E54;
    color: white;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: background-color 0.2s;
    flex-shrink: 0;
}
.wa-chat-list-item { display: flex; align-items: center; padding: 1rem; cursor: pointer; border-bottom: 1px solid #f0f2f5; transition: background-color 0.2s ease-in-out; }
.wa-chat-list-item:hover { background-color: #f0f2f5; }
.wa-chat-list-item.active { background-color: #e9ecef; }
.wa-chat-list-item .avatar { width: 50px; height: 50px; border-radius: 50%; background-color: #dfe5e7; color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-right: 15px; flex-shrink: 0; }
.wa-chat-list-item .chat-info { flex-grow: 1; overflow: hidden; }
.wa-chat-list-item .chat-info .info-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.25rem; }
.wa-chat-list-item .chat-info .info-top .name { font-weight: 600; color: #111b21; white-space: nowrap; }
.wa-chat-list-item .chat-info .info-top .time { font-size: 0.75rem; color: #667781; white-space: nowrap; margin-left: 10px; }
.wa-chat-list-item .chat-info .message-snippet { font-size: 0.9rem; color: #667781; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ========================================================================= */
/* =========      ESTILOS PARA TOOLSBOX      ========= */
/* ========================================================================= */
.toolbox-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.toolbox-card:hover {
    border-color: var(--accent-red);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.2);
}

.toolbox-card-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.toolbox-card-disabled:hover {
    border-color: #e9ecef;
    transform: none;
    box-shadow: none;
}

.toolbox-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--accent-red) 0%, #C0392B 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    transition: all 0.3s ease;
}

.toolbox-card:hover .toolbox-icon {
    transform: scale(1.1);
}

.toolbox-card-disabled .toolbox-icon {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
}

.toolbox-card h5 {
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.toolbox-card .badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* REGLAS RESPONSIVAS CORREGIDAS */
@media (max-width: 767.98px) {
    .chat-layout .chat-col {
        display: none;
    }
    .chat-layout.chat-active .conversation-col {
        display: none;
    }
    .chat-layout.chat-active .chat-col {
        display: block;
    }
}