/* ============================================================================
   CORE CSS - Monolito Login/Auth
   Ruta: /assets/css/core.css

   Responsabilidad:
   [x] Reset básico
   [x] Fuente global
   [x] Box sizing
   [x] Helpers genéricos
   [x] Fixes Bootstrap genéricos
   [x] Fixes DataTables genéricos
   [x] Fixes Select2 genéricos
   [x] Loaders
   [x] Toasts
   [x] Modales
   [x] Utilidades reusables

   No debe contener:
   [ ] nav
   [ ] sidebar
   [ ] dashboard
   [ ] topbar
   [ ] logo
   [ ] theme colors
   [ ] layout admin
   [ ] IDs específicos de módulos
============================================================================ */

/* Fuente base */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700;800;900&display=swap');

/* Reset seguro */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

img {
    display: inline-block;
}

a {
    text-decoration: none;
}

ol,
ul {
    padding-left: 0;
}

button,
input,
textarea,
select {
    font-family: inherit;
}

/* Variables core neutrales */

:root {
    --core-radius-sm: .375rem;
    --core-radius-md: .625rem;
    --core-radius-lg: .875rem;
    --core-radius-xl: 1.125rem;

    --core-transition-fast: all .18s ease;
    --core-transition-base: all .25s ease;
    --core-transition-slow: all .35s ease;

    --core-shadow-sm: 0 4px 14px rgba(15, 23, 42, .08);
    --core-shadow-md: 0 10px 28px rgba(15, 23, 42, .12);
    --core-shadow-lg: 0 18px 46px rgba(15, 23, 42, .16);

    --core-border-color: rgba(15, 23, 42, .12);
    --core-border-soft: rgba(15, 23, 42, .08);
    --core-muted-color: #6c757d;

    --core-z-dropdown: 1000;
    --core-z-sticky: 1020;
    --core-z-fixed: 1030;
    --core-z-modal-backdrop: 1040;
    --core-z-modal: 1050;
    --core-z-toast: 1090;
}

/* Utilidades globales */

.cursor-pointer {
    cursor: pointer !important;
}

.cursor-default {
    cursor: default !important;
}

.user-select-none {
    user-select: none !important;
}

.pointer-events-none {
    pointer-events: none !important;
}

.pointer-events-auto {
    pointer-events: auto !important;
}

.text-small {
    font-size: .875rem !important;
}

.text-xs {
    font-size: .75rem !important;
}

.fw-800 {
    font-weight: 800 !important;
}

.fw-900 {
    font-weight: 900 !important;
}

.rounded-core {
    border-radius: var(--core-radius-md) !important;
}

.rounded-core-lg {
    border-radius: var(--core-radius-lg) !important;
}

.rounded-core-xl {
    border-radius: var(--core-radius-xl) !important;
}

.shadow-core-sm {
    box-shadow: var(--core-shadow-sm) !important;
}

.shadow-core-md {
    box-shadow: var(--core-shadow-md) !important;
}

.shadow-core-lg {
    box-shadow: var(--core-shadow-lg) !important;
}

.overflow-x-auto {
    overflow-x: auto !important;
}

.overflow-y-auto {
    overflow-y: auto !important;
}

.min-w-0 {
    min-width: 0 !important;
}

.object-fit-cover {
    object-fit: cover !important;
}

.object-fit-contain {
    object-fit: contain !important;
}

/* Helpers de texto */

.text-truncate-2 {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.text-truncate-3 {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.word-break {
    word-break: break-word !important;
}

.white-space-nowrap {
    white-space: nowrap !important;
}

/* Helpers responsive */

@media (max-width: 767.98px) {
    .hide-mobile {
        display: none !important;
    }

    .w-mobile-100 {
        width: 100% !important;
    }

    .text-mobile-center {
        text-align: center !important;
    }
}

@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Fixes Bootstrap generales */

.btn:focus,
.btn:focus-visible,
.btn:active,
.btn-check:checked + .btn,
.btn.active,
.btn.show,
:not(.btn-check) + .btn:active {
    box-shadow: none !important;
    outline: none !important;
}

.btn-border-none {
    border-color: transparent !important;
    box-shadow: none !important;
}

.btn-border-none:focus,
.btn-border-none:focus-visible,
.btn-border-none:active {
    border-color: transparent !important;
    box-shadow: none !important;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--core-radius-md);
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
}

.btn-icon-lg {
    width: 46px;
    height: 46px;
}

.dropdown-menu {
    border-radius: var(--core-radius-md);
    z-index: var(--core-z-dropdown);
}

.modal-content {
    border-radius: var(--core-radius-lg);
    border: 1px solid var(--core-border-color);
}

.modal-header,
.modal-footer {
    border-color: var(--core-border-color);
}

.breadcrumb {
    margin-bottom: 0;
}

.breadcrumb-item a {
    text-decoration: none;
}

.accordion-button:focus {
    box-shadow: none;
}

/* Formularios genéricos */

.form-control:focus,
.form-select:focus {
    box-shadow: none;
}

.form-label {
    font-weight: 600;
}

.input-readonly,
.form-control[readonly] {
    cursor: default;
}

/* Select2 fixes genéricos */

.select2-container {
    width: 100% !important;
}

.select2-container .select2-selection--single {
    min-height: 38px;
    display: flex;
    align-items: center;
    border-color: var(--bs-border-color, #dee2e6);
    border-radius: var(--core-radius-sm);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: normal;
    padding-left: .75rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
}

.select2-dropdown {
    border-color: var(--bs-border-color, #dee2e6);
    border-radius: var(--core-radius-sm);
}

/* DataTables fixes genéricos */

div.dt-info,
div.dt-search label,
div.dt-length label,
.dataTables_info,
.dataTables_filter label,
.dataTables_length label {
    font-size: .8rem;
}

.dataTables_filter input[type="search"],
div.dt-search input[type="search"] {
    max-width: 100%;
    font-size: .9rem;
    padding: .375rem .75rem;
}

.dataTables_length select,
div.dt-length select {
    min-height: 36px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table.dataTable {
    width: 100% !important;
}

table.dataTable th,
table.dataTable td {
    vertical-align: middle;
}

.dt-buttons .btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

/* Tablas genéricas sin colores de theme */

.table {
    vertical-align: middle;
}

.table th {
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.table-actions {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.table-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Grid helpers */

.grid-icono a,
.grid-icono button {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.grid-icono a i,
.grid-icono button i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
}

/* Toasts */

.toast {
    border-radius: var(--core-radius-md);
    box-shadow: var(--core-shadow-md);
    z-index: var(--core-z-toast);
}

.toast-header {
    border-bottom-color: var(--core-border-color);
}

/* Loaders */

.loader-core {
    width: 42px;
    height: 42px;
    border: 4px solid rgba(0,0,0,.08);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: core-spin .75s linear infinite;
}

.loader-core-sm {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

.loader-core-lg {
    width: 64px;
    height: 64px;
    border-width: 5px;
}

@keyframes core-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Animaciones genéricas */

.fade-in {
    animation: core-fade-in .25s ease both;
}

.slide-up {
    animation: core-slide-up .25s ease both;
}

@keyframes core-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes core-slide-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar genérico */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,.04);
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,.25);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,.35);
}

/* Utilidades legacy seguras, no asociadas a layout admin */

.font-table {
    font-size: .8rem;
}

.title-form {
    font-weight: 700;
}