/* MASTER FUSION - PHPMaker 2024
   Paleta: Naranja (#F2511C), Oscuro (#2D2D2D), Granate (#8B0B0C)
   Estilo: Ultra Moderno / SaaS Medical
*/

:root {
    --color-orange: #F2511C;
    --color-dark: #2D2D2D;
    --color-maroon: #8B0B0C;
    --bg-body: #F4F7FE;
    --text-primary: #1B2559;
    --gradient-action: linear-gradient(135deg, var(--color-orange) 0%, var(--color-maroon) 100%);
    --shadow-card: 0 10px 30px rgba(45, 45, 45, 0.05);
    --shadow-hover: 0 15px 35px rgba(242, 81, 28, 0.12);
    --radius-lg: 16px;
    --radius-pill: 50px;
}

/* --- BASE Y TIPOGRAFÍA --- */
body {
    background-color: var(--bg-body) !important;
    font-family: 'Poppins', 'Inter', sans-serif !important;
    color: var(--text-primary) !important;
}

/* --- BARRA LATERAL (SIDEBAR) PREMIUM --- */
.main-sidebar {
    background-color: var(--color-dark) !important;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.1) !important;
    border: none !important;

}

.brand-link {
    background-color: var(--color-dark) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 1.2rem 1rem !important;
}

.nav-sidebar .nav-link {
    border-radius: var(--radius-pill) !important;
    margin: 6px 14px !important;
    padding: 12px 20px !important;
    color: #ced4da !important;
    transition: all 0.3s ease;
}

.nav-sidebar .nav-link.active {
    background: var(--gradient-action) !important;
    box-shadow: 0 5px 15px rgba(242, 81, 28, 0.35) !important;
    color: #fff !important;
}

/* --- CABECERA SUPERIOR GLASSMORFISMO --- */
.main-header {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: 250px !important;
    width: auto !important;
    margin: 0 !important;
    height: 60px !important;

    background: var(--gradient-action) !important;
    z-index: 1030 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;

    display: flex !important;
    align-items: center !important;
    /* Transición suave para cuando el menú se abre/cierra */
    transition: left 0.3s ease-in-out, width 0.3s ease-in-out !important;
}

/* --- TABLAS ESTILO ELITE (TIPO CARDS) --- */
.ew-grid {
    border: none !important;
    background: transparent !important;
}

.ew-grid-middle-panel {
    border: none !important;
    background: transparent !important;
}



/* --- BOTONES Y COMPONENTES --- */

/* Botón de Acción Principal (Píldora con Gradiente) */
.btn-primary,
.ew-add-edit-option .btn-primary {
    background: var(--gradient-action) !important;
    border: none !important;
    border-radius: var(--radius-pill) !important;
    padding: 10px 28px !important;
    font-weight: 700 !important;
    box-shadow: 0 6px 18px rgba(242, 81, 28, 0.25) !important;
    transition: all 0.3s ease !important;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(242, 81, 28, 0.4) !important;
}

/* Botones circulares para acciones de tabla (View/Edit) */
.ew-row-link,
.btn-group .btn {
    border-radius: 50% !important;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 4px;
    transition: all 0.2s ease;
}

/* --- FORMULARIOS --- */
.form-control {
    border-radius: 10px !important;
    border: 1.5px solid #E0E5F2 !important;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--color-orange) !important;
    box-shadow: 0 0 0 4px rgba(242, 81, 28, 0.1) !important;
}

/* Estilo para Badges (Estatus) */
.badge {
    padding: 8px 14px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 0.7rem !important;
}

/* --- REPARACIÓN DE TABLA: AJUSTE AL ANCHO DE PANTALLA --- */

/* Forzar que el contenedor principal nunca exceda el ancho de la pantalla */
.ew-grid-middle-panel {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: auto !important;
    /* Habilita scroll horizontal solo en la tabla */
    overflow-y: hidden !important;
    position: relative !important;
    -webkit-overflow-scrolling: touch;
    /* Scroll suave en móviles */
    border-radius: 12px;
}

/* --- CONFIGURACIÓN DE TABLA COMPACTA ELITE --- */

/* 1. Contenedor Maestro Ajustado */
.ew-grid-middle-panel {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    background: transparent !important;
    border: none !important;
}

/* --- NAVBAR UNIFICADO CON EL COLOR DE LOS BOTONES --- */

.main-header {
    margin: 10px 15px 20px 15px !important;
    height: 55px !important;
    /* Un poco más alta para que luzca el gradiente */
    border-radius: 12px !important;

    /* Aplicamos tu gradiente insignia */
    background: var(--gradient-action) !important;

    /* Eliminamos bordes y añadimos sombra de profundidad */
    border: none !important;
    box-shadow: 0 8px 20px rgba(242, 81, 28, 0.3) !important;

    display: flex !important;
    align-items: center !important;
    transition: all 0.3s ease;
}

/* --- AJUSTE DE TEXTOS E ICONOS EN NAVBAR (TODO A BLANCO) --- */

/* Iconos de hamburguesa, notificaciones y perfil */
.main-header .nav-link {
    color: #ffffff !important;
    font-weight: 500 !important;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.main-header .nav-link:hover {
    opacity: 1 !important;
    transform: scale(1.05);
}

/* Texto de Logout o nombre de usuario */
.navbar-nav .nav-item .nav-link {
    color: #ffffff !important;
}

/* Si tienes un buscador en la barra superior, lo hacemos discreto */
.navbar-search .form-control-navbar {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: white !important;
    border-radius: 8px;
}

.navbar-search .form-control-navbar::placeholder {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Ajuste de los Breadcrumbs (Migas de pan) */
/* Los mantenemos oscuros sobre el fondo gris azulado para que sean legibles */
.breadcrumb-item a {
    color: var(--color-orange) !important;
    font-weight: 600;
}

.breadcrumb-item.active {
    color: var(--text-primary) !important;
    opacity: 0.7;
}

/* --- REFUERZO DE TABLAS COMPACTAS (Para que no se muevan) --- */
.ew-table {
    table-layout: fixed !important;
    /* Ayuda a que no se desborde */
}

/* --- 4. CONTENIDO Y TABLAS (PARA QUE NO QUEDEN DEBAJO) --- */

.content-wrapper {
    margin-top: 60px !important;
    /* Espacio para la barra naranja */
    padding: 20px !important;
    background-color: var(--bg-body) !important;
}

/* Tabla compacta alineada */
.ew-grid {
    border: none !important;
    background: transparent !important;
}

.ew-table {
    table-layout: auto !important;
    width: 100% !important;
}

/* Reducción de tamaño de celdas para que quepa todo */
.ew-table td {
    padding: 10px 12px !important;
    font-size: 0.85rem !important;
}

/* --- SOLUCIÓN AL HUECO: ESTADOS DEL SIDEBAR --- */

/* Cuando el sidebar está colapsado (cerrado), la barra va al 100% */
.sidebar-collapse .main-header {
    left: 0 !important;
}

/* Ajuste para el contenido principal para que también use todo el espacio */
.sidebar-collapse .content-wrapper {
    margin-left: 0 !important;
    transition: margin-left 0.3s ease-in-out;
}

/* En pantallas pequeñas (Móviles) siempre debe ser 100% */
@media (max-width: 768px) {
    .main-header {
        left: 0 !important;
        width: 100% !important;
    }
}

.sidebar-collapse .ew-grid {
    transition: all 0.3s ease;
    margin-left: auto;
    margin-right: auto;
}

/* --- ESTILIZACIÓN DE PAGINACIÓN PREMIUM --- */

/* Contenedor de la paginación */
.pagination {
    margin-top: 20px !important;
    gap: 5px;
    /* Espacio entre números */
}

/* Estilo base para cada link de página */
.pagination .page-link,
.pagination_link {
    border: none !important;
    color: var(--color-dark) !important;
    border-radius: 8px !important;
    /* Cuadrado redondeado elegante */
    padding: 8px 14px !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s ease !important;
}

/* --- ESTADO ACTIVO (Página donde estás) --- */
.pagination .page-item.active .page-link,
.pagination .page-item.active span {
    background: var(--gradient-action) !important;
    /* Gradiente Naranja-Granate */
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(242, 81, 28, 0.3) !important;
    border-radius: 8px !important;
    transform: translateY(-2px);
    /* Efecto de elevación */
}

/* --- ESTADO HOVER (Al pasar el mouse) --- */
.pagination .page-link:hover {
    background-color: var(--color-orange) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(242, 81, 28, 0.2) !important;
}

/* Botones de 'Anterior' y 'Siguiente' */
.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    border-radius: 12px !important;
    background-color: var(--color-dark) !important;
    color: #ffffff !important;
}

.pagination .page-item:first-child .page-link:hover,
.pagination .page-item:last-child .page-link:hover {
    background: var(--gradient-action) !important;
}

/* Deshabilitado (Gris suave) */
.pagination .page-item.disabled .page-link {
    background-color: #e9ecef !important;
    color: #adb5bd !important;
    box-shadow: none !important;
    transform: none !important;
}