/* Estilos base de Filament para inputs, botones, etc. */
.fi-input {
    border-width: 1px;
    border-color: rgb(209 213 219);
    border-radius: 0.5rem;
    background-color: #fff;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5rem;
    width: 100%;
    transition: all 150ms;
}

.fi-input:focus {
    outline: 2px solid rgb(59 130 246);
    outline-offset: 2px;
    border-color: rgb(59 130 246);
}

.dark .fi-input {
    background-color: rgb(31 41 55);
    border-color: rgb(55 65 81);
    color: #fff;
}

.fi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border-radius: 0.5rem;
    transition: all 150ms;
    cursor: pointer;
    border: none;
}

.fi-btn.fi-color-primary {
    background-color: rgb(59 130 246);
    color: #fff;
}

.fi-btn.fi-color-primary:hover {
    background-color: rgb(37 99 235);
}

.fi-fo-field-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: rgb(55 65 81);
}

.dark .fi-fo-field-label {
    color: rgb(209 213 219);
}

.fi-fo-field-label-required-mark {
    color: rgb(239 68 68);
    margin-left: 0.125rem;
}

.fi-fo-field {
    margin-bottom: 1rem;
}

.fi-section {
    background-color: #fff;
    border-radius: 0.75rem;
    border: 1px solid rgb(229 231 235);
}

.dark .fi-section {
    background-color: rgb(31 41 55);
    border-color: rgb(55 65 81);
}

.fi-section-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgb(229 231 235);
}

.dark .fi-section-header {
    border-color: rgb(55 65 81);
}

/* Eliminar espacios causados por elementos vacíos */
.fi-section-header > :empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Ocultar divs vacíos que causan líneas */
.fi-section-header div:empty,
.fi-section-content div:empty {
    display: none !important;
}

/* Eliminar márgenes de elementos vacíos */
.fi-section *:empty {
    margin: 0 !important;
    padding: 0 !important;
}

/* OCULTAR HEADERS COMPLETAMENTE VACÍOS */
.fi-section-header:empty {
    display: none !important;
}

/* Headers que solo contienen espacios en blanco o comentarios HTML */
.fi-section-header:not(:has(.fi-section-header-text-ctn)),
.fi-section-header:not(:has(h1)):not(:has(h2)):not(:has(h3)):not(:has(p)):not(:has(button)):not(:has(a)) {
    display: none !important;
}

/* Si el header no tiene texto visible, ocultarlo */
.fi-section-header:has(.fi-section-header-text-ctn:empty) {
    display: none !important;
}

.fi-section-header-heading {
    font-size: 1.125rem;
    font-weight: 600;
    color: rgb(17 24 39);
}

.dark .fi-section-header-heading {
    color: #fff;
}

.fi-section-header-description {
    font-size: 0.875rem;
    color: rgb(107 114 128);
    margin-top: 0.25rem;
}

.fi-section-content {
    padding: 1.5rem;
}

.fi-page-header-heading {
    font-size: 1.875rem;
    font-weight: 700;
    color: rgb(17 24 39);
}

.dark .fi-page-header-heading {
    color: #fff;
}

.fi-header-subheading {
    font-size: 0.875rem;
    color: rgb(107 114 128);
    margin-top: 0.5rem;
}

/* Estilos para modales */
.fi-modal-content {
    padding: 1.5rem !important;
}

.fi-modal-header {
    margin-bottom: 1rem !important;
}

.fi-modal-footer {
    margin-top: 1.5rem !important;
    padding-top: 1rem !important;
}

.fi-modal-actions {
    display: flex !important;
    gap: 0.75rem !important;
    justify-content: flex-end !important;
    margin-top: 1.5rem !important;
    padding-bottom: 1rem !important;
}

/* Asegurar que los botones en modales tengan espacio */
.fi-modal button {
    margin-bottom: 0.5rem !important;
}

/* Padding extra para el contenido del modal */
[x-data*="filamentActionModals"] .fi-modal-window {
    padding-bottom: 2rem !important;
}

/* MODAL: Contenedor principal debe ser fixed y cubrir toda la pantalla */
.fi-modal,
[role="dialog"] {
    position: fixed !important;
    inset: 0 !important;
    z-index: 50 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Modal backdrop - fondo oscuro */
.fi-modal-close-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 40 !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.dark .fi-modal-close-overlay {
    background-color: rgba(0, 0, 0, 0.7) !important;
}

/* Modal window container - centrado */
.fi-modal-window-ctn {
    position: relative !important;
    z-index: 51 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 100vh !important;
    padding: 1rem !important;
}

/* Modal window - la ventana real del modal */
.fi-modal-window {
    position: relative !important;
    z-index: 52 !important;
    width: 100% !important;
    max-width: 42rem !important;
    max-height: 90vh !important;
    overflow: auto !important;
    background-color: white !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
}

.dark .fi-modal-window {
    background-color: rgb(31 41 55) !important;
}

/* Modales anidados */
[role="dialog"]:nth-of-type(2) {
    z-index: 60 !important;
}

[role="dialog"]:nth-of-type(2) .fi-modal-close-overlay {
    z-index: 55 !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
}

/* CONTROL EXTREMO DE ICONOS SVG EN MODALES */
.fi-modal svg,
.fi-modal-window svg,
[role="dialog"] svg,
[x-data*="filamentActionModals"] svg {
    max-width: 48px !important;
    max-height: 48px !important;
    width: 48px !important;
    height: 48px !important;
}

/* Iconos en el contenido del modal */
.fi-modal-content svg,
.fi-modal-description svg {
    max-width: 48px !important;
    max-height: 48px !important;
    width: 48px !important;
    height: 48px !important;
}

/* Iconos de peligro/advertencia */
.fi-modal svg[class*="text-danger"],
.fi-modal svg[class*="text-warning"] {
    max-width: 64px !important;
    max-height: 64px !important;
    width: 64px !important;
    height: 64px !important;
}

/* Forzar tamaño en iconos de Heroicons dentro de modales */
[role="dialog"] svg[xmlns="http://www.w3.org/2000/svg"] {
    max-width: 48px !important;
    max-height: 48px !important;
    width: 48px !important;
    height: 48px !important;
}

/* Iconos en botones dentro de modales deben ser pequeños */
.fi-modal button svg,
.fi-modal-footer button svg {
    max-width: 20px !important;
    max-height: 20px !important;
    width: 20px !important;
    height: 20px !important;
}

/* ESTILOS COMPLETOS PARA MODALES */

/* Anchos de modales */
.fi-modal-window.fi-width-sm {
    width: 100% !important;
    max-width: 28rem !important;
}

.fi-modal-window.fi-width-md {
    width: 100% !important;
    max-width: 42rem !important;
}

.fi-modal-window.fi-width-lg {
    width: 100% !important;
    max-width: 56rem !important;
}

.fi-modal-window.fi-width-xl {
    width: 100% !important;
    max-width: 72rem !important;
}

.fi-modal-window.fi-width-2xl {
    width: 100% !important;
    max-width: 80rem !important;
}

.fi-modal-window.fi-width-3xl {
    width: 100% !important;
    max-width: 90vw !important;
}

.fi-modal-window.fi-width-4xl {
    width: 100% !important;
    max-width: 95vw !important;
}

.fi-modal-window.fi-width-5xl {
    width: 100% !important;
    max-width: 98vw !important;
}

.fi-modal-window.fi-width-6xl {
    width: 100% !important;
    max-width: 98vw !important;
}

.fi-modal-window.fi-width-7xl {
    width: 100% !important;
    max-width: 98vw !important;
}

.fi-modal-window.fi-width-screen {
    width: 100vw !important;
    max-width: 100vw !important;
}

/* Responsive: En pantallas pequeñas, asegurar que los modales usen todo el ancho disponible */
@media (max-width: 640px) {
    .fi-modal-window {
        width: calc(100vw - 2rem) !important;
        max-width: calc(100vw - 2rem) !important;
    }
}

/* Header del modal */
.fi-modal-header {
    padding: 1.5rem !important;
    margin-bottom: 0 !important;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

/* Título del modal */
.fi-modal-heading {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.75rem;
    color: rgb(17 24 39);
    margin: 0;
}

.dark .fi-modal-heading {
    color: #fff;
}

/* Descripción del modal */
.fi-modal-description {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: rgb(107 114 128);
    margin-top: 0.25rem;
}

.dark .fi-modal-description {
    color: rgb(156 163 175);
}

/* Contenedor del icono del modal */
.fi-modal-icon-ctn {
    flex-shrink: 0;
}

.fi-modal-icon-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
}

.fi-modal-icon-bg.fi-color-danger {
    background-color: rgb(254 226 226);
}

.dark .fi-modal-icon-bg.fi-color-danger {
    background-color: rgb(127 29 29);
}

.fi-modal-icon-bg.fi-color-warning {
    background-color: rgb(254 243 199);
}

.dark .fi-modal-icon-bg.fi-color-warning {
    background-color: rgb(120 53 15);
}

.fi-modal-icon-bg.fi-color-success {
    background-color: rgb(220 252 231);
}

.dark .fi-modal-icon-bg.fi-color-success {
    background-color: rgb(20 83 45);
}

.fi-modal-icon-bg svg {
    color: rgb(220 38 38);
}

.fi-modal-icon-bg.fi-color-danger svg {
    color: rgb(220 38 38);
}

.dark .fi-modal-icon-bg.fi-color-danger svg {
    color: rgb(248 113 113);
}

.fi-modal-icon-bg.fi-color-warning svg {
    color: rgb(217 119 6);
}

.dark .fi-modal-icon-bg.fi-color-warning svg {
    color: rgb(251 191 36);
}

.fi-modal-icon-bg.fi-color-success svg {
    color: rgb(22 163 74);
}

.dark .fi-modal-icon-bg.fi-color-success svg {
    color: rgb(74 222 128);
}

/* Botón de cerrar modal */
.fi-icon-btn.fi-modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: rgb(107 114 128);
    background-color: transparent;
    border: none;
    cursor: pointer;
    transition: all 150ms;
}

.fi-icon-btn.fi-modal-close-btn:hover {
    background-color: rgb(243 244 246);
    color: rgb(55 65 81);
}

.dark .fi-icon-btn.fi-modal-close-btn {
    color: rgb(156 163 175);
}

.dark .fi-icon-btn.fi-modal-close-btn:hover {
    background-color: rgb(55 65 81);
    color: rgb(209 213 219);
}

/* Contenido del modal */
.fi-modal-content {
    padding: 0 1.5rem 1.5rem 1.5rem !important;
}

.fi-modal-window.fi-modal-window-has-content .fi-modal-content {
    padding: 1.5rem !important;
}

/* Footer del modal */
.fi-modal-footer {
    padding: 1rem 1.5rem 1.5rem 1.5rem !important;
    margin-top: 0 !important;
    border-top: 1px solid rgb(229 231 235);
}

.dark .fi-modal-footer {
    border-top-color: rgb(55 65 81);
}

.fi-modal-footer.fi-align-start {
    justify-content: flex-start;
}

.fi-modal-footer.fi-align-center {
    justify-content: center;
}

.fi-modal-footer.fi-align-end {
    justify-content: flex-end;
}

/* Acciones del footer */
.fi-modal-footer-actions {
    display: flex !important;
    align-items: center;
    gap: 0.75rem !important;
    flex-wrap: wrap;
}

/* Botones de acción en modales */
.fi-ac-btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border-radius: 0.5rem;
    transition: all 150ms;
    cursor: pointer;
    border: 1px solid rgb(209 213 219);
    background-color: #fff;
    color: rgb(55 65 81);
}

.fi-ac-btn-action:hover {
    background-color: rgb(249 250 251);
    border-color: rgb(156 163 175);
}

.dark .fi-ac-btn-action {
    background-color: rgb(55 65 81);
    border-color: rgb(75 85 99);
    color: rgb(209 213 219);
}

.dark .fi-ac-btn-action:hover {
    background-color: rgb(75 85 99);
    border-color: rgb(107 114 128);
}

/* Botón Success */
.fi-ac-btn-action.fi-color-success {
    background-color: rgb(34 197 94);
    border-color: rgb(34 197 94);
    color: #fff;
}

.fi-ac-btn-action.fi-color-success:hover {
    background-color: rgb(22 163 74);
    border-color: rgb(22 163 74);
}

/* Botón Danger */
.fi-ac-btn-action.fi-color-danger {
    background-color: rgb(220 38 38);
    border-color: rgb(220 38 38);
    color: #fff;
}

.fi-ac-btn-action.fi-color-danger:hover {
    background-color: rgb(185 28 28);
    border-color: rgb(185 28 28);
}

/* Botón Primary */
.fi-ac-btn-action.fi-color-primary {
    background-color: rgb(59 130 246);
    border-color: rgb(59 130 246);
    color: #fff;
}

.fi-ac-btn-action.fi-color-primary:hover {
    background-color: rgb(37 99 235);
    border-color: rgb(37 99 235);
}

/* Indicador de carga en botones */
.fi-loading-indicator {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Inputs dentro de modales */
.fi-modal .fi-input,
.fi-modal-window .fi-input {
    border-width: 1px;
    border-color: rgb(209 213 219);
    border-radius: 0.5rem;
    background-color: #fff;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5rem;
    width: 100%;
    transition: all 150ms;
}

.fi-modal .fi-input:focus,
.fi-modal-window .fi-input:focus {
    outline: 2px solid rgb(59 130 246);
    outline-offset: 2px;
    border-color: rgb(59 130 246);
}

.dark .fi-modal .fi-input,
.dark .fi-modal-window .fi-input {
    background-color: rgb(31 41 55);
    border-color: rgb(55 65 81);
    color: #fff;
}

/* Etiquetas dentro de modales */
.fi-modal .fi-fo-field-label,
.fi-modal-window .fi-fo-field-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: rgb(55 65 81);
}

.dark .fi-modal .fi-fo-field-label,
.dark .fi-modal-window .fi-fo-field-label {
    color: rgb(209 213 219);
}

/* Campos dentro de modales */
.fi-modal .fi-fo-field,
.fi-modal-window .fi-fo-field {
    margin-bottom: 1rem;
}

.fi-modal .fi-fo-field:last-child,
.fi-modal-window .fi-fo-field:last-child {
    margin-bottom: 0;
}

/* Wrappers de inputs en modales */
.fi-modal .fi-input-wrp,
.fi-modal-window .fi-input-wrp {
    position: relative;
}

/* Arreglar el layout aside de las secciones */
.fi-section.fi-aside {
    display: grid !important;
    gap: 2rem !important;
}

@media (min-width: 1024px) {
    .fi-section.fi-aside {
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) !important;
    }
}

/* Espaciado interno consistente */
.fi-section-content {
    padding: 1.5rem !important;
}

/* Mejorar espaciado de formularios */
.fi-section-content form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Botones alineados correctamente */
.fi-section-content form .flex.justify-end {
    margin-top: 1rem;
}

/* QR Code tamaño razonable - selector más específico */
.fi-section-content svg[xmlns="http://www.w3.org/2000/svg"] {
    max-width: 200px !important;
    max-height: 200px !important;
    width: auto !important;
    height: auto !important;
}

/* Fix específico para el QR de 2FA */
.bg-white.dark\:bg-gray-800.p-4.rounded-lg svg {
    max-width: 150px !important;
    max-height: 150px !important;
}

/* Grid responsivo para códigos de recuperación */
.grid.grid-cols-2 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
}

/* Estilo para elementos de código */
code.font-mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.75rem;
    line-height: 1rem;
}

/* Contenedores de códigos de recuperación */
.bg-white.dark\:bg-gray-800.px-3.py-2.rounded {
    padding: 0.5rem 0.75rem !important;
    margin: 0 !important;
}

/* Mejorar la visualización de alertas */
.fi-section-content .rounded-md.bg-custom-50,
.fi-section-content .rounded.bg-custom-50 {
    margin-bottom: 1.5rem !important;
}

/* Contenedor principal de códigos de recuperación */
.bg-amber-50.dark\:bg-amber-900\/20 {
    padding: 1rem !important;
    border-radius: 0.5rem !important;
}

/* Separación para botones de acción */
.flex.gap-3.justify-end {
    margin-top: 1.5rem !important;
    padding-top: 1rem !important;
}

/* Mejora del diseño de la sección lateral (aside) */
.fi-section-header-text-ctn {
    max-width: 100% !important;
}

/* Texto de descripción más legible */
.fi-section-header-description {
    color: rgb(107 114 128);
    font-size: 0.875rem;
    line-height: 1.25rem;
}

/* Mejorar el espaciado del contenido de 2FA */
.flex.flex-col.lg\:flex-row.gap-6 {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
}

@media (min-width: 1024px) {
    .flex.flex-col.lg\:flex-row.gap-6 {
        flex-direction: row !important;
    }
}