/* Estilo de Sidebar personalizado para Filament Admin */
aside.fi-sidebar {
    background-color: #0b192c !important; /* Azul marino profundo corporativo Manuchar / Proquiel */
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Encabezado y logo del sidebar */
aside.fi-sidebar header.fi-sidebar-header {
    background-color: #081220 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

aside.fi-sidebar .fi-logo {
    color: #ffffff !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em;
}

/* Títulos de los grupos de navegación en Blanco Brillante */
aside.fi-sidebar .fi-sidebar-group-label,
aside.fi-sidebar .fi-sidebar-group-label span,
aside.fi-sidebar .fi-sidebar-group-label button {
    color: #ffffff !important;
    font-size: 0.74rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    opacity: 0.95 !important;
}

aside.fi-sidebar .fi-sidebar-group-collapse-button,
aside.fi-sidebar .fi-sidebar-group-collapse-button svg {
    color: #ffffff !important;
}

/* Ítems del menú no seleccionados: texto e iconos en Blanco */
aside.fi-sidebar .fi-sidebar-item-button,
aside.fi-sidebar .fi-sidebar-item-button span,
aside.fi-sidebar .fi-sidebar-item-label,
aside.fi-sidebar a.fi-sidebar-item-button {
    color: #ffffff !important;
    font-weight: 600 !important;
    opacity: 0.95 !important;
    transition: all 0.15s ease-in-out;
}

aside.fi-sidebar .fi-sidebar-item-button:hover {
    background-color: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    opacity: 1 !important;
}

aside.fi-sidebar .fi-sidebar-item-icon,
aside.fi-sidebar .fi-sidebar-item-button svg {
    color: #ffffff !important;
    opacity: 0.95 !important;
}

/* Ítem activo (Seleccionado): fondo ámbar/dorado con texto e icono contrastados */
aside.fi-sidebar .fi-sidebar-item-active .fi-sidebar-item-button,
aside.fi-sidebar .fi-sidebar-item-active .fi-sidebar-item-button span,
aside.fi-sidebar .fi-sidebar-item-active .fi-sidebar-item-label {
    background-color: #f59e0b !important;
    color: #0f172a !important; /* Texto oscuro sobre botón amarillo/naranja para legibilidad */
    font-weight: 800 !important;
    opacity: 1 !important;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35) !important;
}

aside.fi-sidebar .fi-sidebar-item-active .fi-sidebar-item-icon,
aside.fi-sidebar .fi-sidebar-item-active .fi-sidebar-item-button svg {
    color: #0f172a !important;
    opacity: 1 !important;
}

/* Pie del sidebar / usuario */
aside.fi-sidebar footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    background-color: #081220 !important;
}

aside.fi-sidebar footer span,
aside.fi-sidebar footer p {
    color: #e2e8f0 !important;
}

/* Cuerpo principal: en modo claro fondo claro, en modo oscuro fondo oscuro de Filament */
html:not(.dark) body.fi-body,
html:not(.dark) main.fi-main {
    background-color: #f8fafc !important;
}

/* ==============================================================
   CONTRASTE Y VISIBILIDAD EN MODO CLARO (LIGHT MODE)
   ============================================================== */
html:not(.dark) {
    /* Variables de escala de grises de Filament reforzadas para modo claro */
    --gray-950: 15, 23, 42;  /* Slate 900 / carbón profundo */
    --gray-900: 30, 41, 59;  /* Slate 800 */
    --gray-800: 51, 65, 85;  /* Slate 700 */
    --gray-700: 71, 85, 105; /* Slate 600 */
    --gray-600: 100, 116, 139; /* Slate 500 */
    --gray-500: 100, 116, 139;
    --gray-400: 148, 163, 184;
}

/* Encabezados y títulos de página en modo claro */
html:not(.dark) .fi-header-heading,
html:not(.dark) h1.fi-header-heading,
html:not(.dark) .fi-section-header-heading,
html:not(.dark) .fi-modal-heading {
    color: #0f172a !important;
    font-weight: 800 !important;
}

/* Subtítulos de página */
html:not(.dark) .fi-header-subheading,
html:not(.dark) .fi-section-header-description {
    color: #475569 !important;
}

/* Breadcrumbs (Migas de pan) */
html:not(.dark) .fi-breadcrumbs-item-label,
html:not(.dark) .fi-breadcrumbs-item a,
html:not(.dark) .fi-breadcrumbs-item span {
    color: #475569 !important;
    font-weight: 500 !important;
}
html:not(.dark) .fi-breadcrumbs-item:last-child .fi-breadcrumbs-item-label,
html:not(.dark) .fi-breadcrumbs-item:last-child span {
    color: #0f172a !important;
    font-weight: 600 !important;
}

/* Etiquetas de formulario (Form Labels) */
html:not(.dark) .fi-fo-field-wrp-label,
html:not(.dark) .fi-fo-field-wrp-label label,
html:not(.dark) .fi-fo-field-wrp-label span {
    color: #0f172a !important;
    font-weight: 600 !important;
}

/* Textos de ayuda (helper-text) */
html:not(.dark) .fi-fo-field-wrp-helper-text,
html:not(.dark) .fi-fo-field-wrp-helper-text p {
    color: #475569 !important;
}

/* Opciones de CheckboxList y Radio */
html:not(.dark) .fi-fo-checkbox-list-option-label,
html:not(.dark) .fi-fo-checkbox-list label span,
html:not(.dark) .fi-fo-radio-list-option-label {
    color: #1e293b !important;
    font-weight: 500 !important;
}

/* Textos en Inputs, Selects y Textareas */
html:not(.dark) .fi-input-wrp input,
html:not(.dark) .fi-input-wrp select,
html:not(.dark) .fi-input-wrp textarea,
html:not(.dark) .fi-select-input {
    color: #0f172a !important;
}

/* Dropzone de carga de archivos (Filepond / Upload) */
html:not(.dark) .filepond--drop-label,
html:not(.dark) .filepond--drop-label label,
html:not(.dark) .fi-fo-file-upload {
    color: #334155 !important;
}

/* Tablas: encabezados y celdas */
html:not(.dark) .fi-ta-header-cell-label {
    color: #334155 !important;
    font-weight: 700 !important;
}
html:not(.dark) .fi-ta-record-title,
html:not(.dark) .fi-ta-cell-content {
    color: #0f172a !important;
}

/* Barra superior (Top bar) */
html:not(.dark) header.fi-topbar {
    background-color: #ffffff !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
}
html:not(.dark) header.fi-topbar .fi-topbar-item-label,
html:not(.dark) header.fi-topbar button svg {
    color: #1e293b !important;
}

/* ==============================================================
   ESTILOS PERSONALIZADOS PARA PÁGINA DE LOGIN (/admin/login)
   ============================================================== */

/* Fondo de pantalla de login con imagen industrial Manuchar */
body:has(.fi-simple-layout),
.fi-simple-layout {
    background-image: url('/images/login-wallpaper.jpg') !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    min-height: 100vh !important;
    width: 100% !important;
}

/* Cuadro contenedor del formulario con 50% de opacidad y efecto glassmorphism */
main.fi-simple-main,
.fi-simple-main {
    background-color: rgba(255, 255, 255, 0.50) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.5) inset !important;
}

/* Contenedor del Logo de Login */
.fi-simple-header .fi-logo,
.fi-simple-header img {
    max-height: 4.8rem !important;
    width: auto !important;
    object-fit: contain !important;
    margin: 0 auto 0.75rem auto !important;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15)) !important;
}

/* En el sidebar interno mantener el logo visible sobre fondo oscuro */
aside.fi-sidebar .fi-logo img {
    filter: brightness(0) invert(1) !important; /* Si se desea blanco sobre oscuro en sidebar */
    max-height: 2.5rem !important;
}

/* Título de la página de login */
.fi-simple-header h1 {
    color: #1e293b !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
}

/* Botón de Login en el mismo Rojo Manuchar (#e30613 / #c8102e) */
.fi-simple-main button[type="submit"],
.fi-simple-page form button[type="submit"],
.fi-btn.fi-btn-color-primary[type="submit"] {
    background-color: #c8102e !important;
    background-image: linear-gradient(180deg, #e30613 0%, #c8102e 100%) !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    border-radius: 0.6rem !important;
    padding: 0.75rem 1.25rem !important;
    box-shadow: 0 4px 14px rgba(200, 16, 46, 0.4) !important;
    transition: all 0.2s ease-in-out !important;
}

.fi-simple-main button[type="submit"]:hover,
.fi-simple-page form button[type="submit"]:hover,
.fi-btn.fi-btn-color-primary[type="submit"]:hover {
    background-color: #a80d26 !important;
    background-image: linear-gradient(180deg, #c8102e 0%, #a80d26 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(200, 16, 46, 0.5) !important;
}

/* Input styling dentro del cuadro transparente para nitidez de lectura */
.fi-simple-main input[type="email"],
.fi-simple-main input[type="password"],
.fi-simple-main input[type="text"] {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(203, 213, 225, 0.9) !important;
    color: #0f172a !important;
    font-weight: 500 !important;
}

.fi-simple-main input:focus {
    border-color: #c8102e !important;
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.15) !important;
}

/* ==============================================================
   ESTANDARIZACIÓN DE ENCUADRE, MÁRGENES Y ANCHO DE TABLAS
   ============================================================== */

/* Contenedor principal expandido (~10-12% más ancho que 7xl) y márgenes uniformes */
main.fi-main {
    width: 100% !important;
    max-width: 92rem !important; /* ~1472px: ~12% más amplio que 1280px por defecto */
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    box-sizing: border-box !important;
}

@media (min-width: 1024px) {
    main.fi-main {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}

/* Estandarización del ancho completo en todas las páginas, secciones y widgets */
.fi-page,
.fi-page > section,
.fi-resource-list-records-page,
.fi-wi-table,
.fi-wi-stats-overview {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Contenedor de tablas Filament al 100% uniforme con bordes parejos */
.fi-ta,
.fi-ta-ctn,
.fi-ta-content {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.fi-ta-content {
    overflow-x: auto !important;
}

table.fi-ta-table {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: auto !important;
}

/* Padding lateral estandarizado en primera y última columna de todas las tablas */
table.fi-ta-table thead tr th.fi-ta-header-cell:first-child,
table.fi-ta-table tbody tr td.fi-ta-cell:first-child,
table.fi-ta-table thead tr th:first-child,
table.fi-ta-table tbody tr td:first-child {
    padding-left: 1.25rem !important;
}

table.fi-ta-table thead tr th.fi-ta-header-cell:last-child,
table.fi-ta-table tbody tr td.fi-ta-cell:last-child,
table.fi-ta-table thead tr th:last-child,
table.fi-ta-table tbody tr td:last-child {
    padding-right: 1.25rem !important;
}

/* Encabezado y barra de herramientas de tabla alineados al mismo ancho */
.fi-ta-header-ctn,
.fi-ta-header-toolbar,
.fi-ta-pagination {
    width: 100% !important;
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
    box-sizing: border-box !important;
}
