/* --- ESTILOS DEL MODAL --- */
.crm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.crm-modal-contenedor {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
.crm-modal-btn button {
    margin: 5px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

/* --- ESTILOS DE BOTONES Y MENÚ INFERIOR --- */
.crm-btn-section {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    background-color: #f8f9fa;
    padding: 12px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    box-sizing: border-box;
}

.crm-btn-primario {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    padding: 10px 15px;
    font-size: 16px;
    border: 1px solid #71639e;
    border-radius: 8px;
    background-color: #71639e;
    color: #FFFFFF;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}


.crm-btn-primario:hover {
    background-color: #5a4f7f;
    border-color: #443b60;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.crm-btn-primario i {
    margin-right: 8px;
}

/* --- ESTILOS PARA LA SECCIÓN DE FILTROS --- */
.crm-filtros-contenedor {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin: 20px 0 30px 0;
}

.filtro-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.crm-filtros-contenedor label {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: #555;
    text-align: left;
}

.crm-filtros-contenedor input[type="date"] {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.crm-filtros-contenedor input[type="date"]:focus {
    outline: none;
    border-color: #71639e;
    box-shadow: 0 0 8px rgba(113, 99, 158, 0.4);
}

.crm-filtros-contenedor .crm-btn-primario {
    min-width: 150px;
    align-self: flex-end;
}

/* --- ESTILOS PARA EL DASHBOARD --- */
#dashboard_crm {
    padding: 0 15px;
    margin-bottom: 30px;
}

.kpi-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.kpi-card {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    flex: 1;
    min-width: 220px;
    position: relative;
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateY(-5px);
}

.kpi-title {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 10px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 600;
    color: #343a40;
}

.kpi-icon {
    text-align: center;
    font-size: 2.5em;
    color: #009879;
    opacity: 0.3;
}

/* Contenedor para los gráficos */
.charts-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: stretch;
}

.chart-card {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    /* CAMBIO: Eliminamos la altura mínima de aquí para que el wrapper la controle */
}

.chart-card h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
    font-family: 'Inter', sans-serif;
    color: #495057;
}

/* ================================================= */
/* INICIO DE LA SECCIÓN CORREGIDA PARA EVITAR EL BUG */
/* ================================================= */

/* NUEVO: Contenedor "marco" para el canvas */
.chart-wrapper {
    position: relative;
    flex-grow: 1; /* Hace que el marco ocupe todo el espacio vertical disponible en la tarjeta */
    min-height: 350px; /* Le damos una altura mínima para asegurar simetría */
}

.chart-card-dona {
    flex-grow: 1;
    flex-basis: 320px;
    max-width: 400px;
}

.chart-card-barras {
    flex-grow: 2;
    flex-basis: 400px;
}

.chart-card-full {
    flex-basis: 100%;
}

/* --- ESTILOS PARA LA TABLA --- */
.tabla-contenedor-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabla-reporte-crm {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 0.9em;
    font-family: 'Inter', sans-serif;
    min-width: 1800px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    overflow: hidden;
}

.tabla-reporte-crm thead tr {
    background-color: #009879;
    color: #ffffff;
}

.tabla-reporte-crm th,
.tabla-reporte-crm td {
    padding: 12px 15px;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}

.tabla-reporte-crm tbody tr {
    border-bottom: 1px solid #dddddd;
}

.tabla-reporte-crm tbody tr:nth-of-type(even) {
    background-color: #f3f3f3;
}

.tabla-reporte-crm tbody tr:last-of-type {
    border-bottom: 2px solid #009879;
}

.tabla-reporte-crm tbody tr:hover {
    background-color: #f1f1f1;
    cursor: pointer;
}

.tabla-reporte-crm strong {
    font-weight: 600;
    color: #005a48;
}

/* --- SECCIÓN RESPONSIVE GENERAL --- */
@media screen and (max-width: 768px) {
    .solo-desktop {
        display: none;
    }

    .crm-btn-section {
        flex-wrap: nowrap;
        padding: 12px;
        gap: 8px;
    }

    .crm-btn-primario {
        flex: 1;
        width: auto;
        min-width: 0;
        padding: 10px 5px;
        font-size: 18px;
    }

    .crm-btn-primario i {
        margin: 0;
    }
    
    .kpi-container, .charts-container {
        flex-direction: column;
    }

    .chart-card-dona {
        max-width: 100%;
    }
    
    /* En móvil, le damos una altura fija para que no sea gigante */
    .chart-wrapper {
        min-height: 300px;
    }
}

/* --- ESTILOS PARA MEJORAR EL CALENDARIO --- */

/* 1. Estilo base para que los eventos parezcan tarjetas rectangulares */
/* --- ESTILOS COMPLETOS Y CORREGIDOS PARA FULLCALENDAR --- */

/* 1. Estilo base para que los eventos parezcan tarjetas rectangulares */
.fc-event {
    
    border-radius: 4px !important;
    border: none !important;
    padding: 5px 8px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* IMPORTANTE: Permite que el contenido interno controle el desbordamiento */
    overflow: hidden;
}

.fc-event:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 2. Colores para los estados de las actividades */
.evento-pendiente {
    background-color: #ffe082 !important; /* Amarillo claro */
    color: #4c4013 !important;
}

.evento-hecho {
    background-color: #a5d6a7 !important; /* Verde claro */
    color: #1b3d1c !important;
}
.evento-hecho .titulo-evento {
    text-decoration: line-through;
}

/* 3. Estructura interna del evento (creada por nuestro JS) */
.contenido-evento {
    display: flex;color: black !important;
    flex-direction: column;
    width: 100%;
    overflow: hidden; /* Seguridad extra */
}


/* 4. LA CORRECCIÓN CLAVE: Control del texto que se desborda */

/* Forzamos a que el título y los detalles NO salten de línea y muestren "..." */
.titulo-evento,
.detalle-cliente,
.detalle-usuario {
    white-space: nowrap;      /* No permitir saltos de línea */
    overflow: hidden;         /* Ocultar el texto que no cabe */
    text-overflow: ellipsis;  /* Mostrar los puntos suspensivos */
    display: block;           /* Asegura que ocupe el ancho disponible */
}

/* 5. Estilos para alinear los detalles (cliente y usuario) */
.linea-principal {
    display: flex;
    align-items: center;
    font-weight: bold;
    margin-bottom: 4px;
}

.detalles-evento {
    font-size: 0.8em;
    opacity: 0.8;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detalles-evento i,
.linea-principal i {
    margin-right: 6px;
}

/* --- ESTILOS PARA EL MODAL DE ACTIVIDADES --- */
.estado-modal { 
    display: inline-block; 
    padding: 4px 10px; 
    border-radius: 14px; 
    font-weight: bold; 
    font-size: 0.9em; 
    text-align: center; 
}
.estado-modal-pendiente { background-color: #ffe082; color: #4c4013; }
.estado-modal-hecho { background-color: #a5d6a7; color: #1b3d1c; }
.usuario-modal { margin-top: 15px; font-size: 0.9em; text-align: right; color: #6c757d; }


/* --- AÑADE ESTOS ESTILOS A TU ARCHIVO CSS --- */

.contenido-evento {
    /* Mantiene todo el contenido junto y evita que se desborde */
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
}

.linea-principal {
    /* Para el ícono y el título de la actividad */
    display: flex;
    align-items: center;
    font-weight: bold;
    margin-bottom: 4px; /* Espacio hacia los detalles de abajo */
}

.detalles-evento {
    /* Contenedor para la información extra (cliente, usuario) */
    font-size: 0.8em;
    opacity: 0.8; /* Lo hacemos un poco más tenue que el título */
    display: flex;
    flex-direction: column;
    gap: 2px; /* Pequeño espacio entre el cliente y el usuario */
}

.detalle-cliente, .detalle-usuario {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Añade ... si el texto es muy largo */
}

.detalles-evento i {
    margin-right: 5px; /* Espacio entre el ícono y el nombre */
    width: 12px; /* Ancho fijo para que se alineen bien */
}

/* --- AÑADE ESTOS ESTILOS PARA EL MODAL DE ACTIVIDADES --- */

/* Estilo base para el contenedor del estado */
.estado-modal {
    display: inline-block; /* Para que el fondo no ocupe toda la línea */
    padding: 4px 10px;
    border-radius: 14px; /* Para hacerlo tipo "píldora" */
    font-weight: bold;
    font-size: 0.9em;
    text-align: center;
}

/* Color para estado Pendiente */
.estado-modal-pendiente {
    background-color: #ffe082; /* Mismo amarillo que en el calendario */
    color: #4c4013;
}

/* Color para estado Hecha */
.estado-modal-hecho {
    background-color: #a5d6a7; /* Mismo verde que en el calendario */
    color: #1b3d1c;
}

/* Estilo para el texto del usuario al final del modal */
.usuario-modal {
    margin-top: 15px;
    font-size: 0.9em;
    text-align: right;
    color: #6c757d;
}



