:root {
    color-scheme: light;
}

html {
    scroll-behavior: smooth;
}

html, body {
    font-family: 'Inter', sans-serif;
}

body {
    min-height: 100dvh;
}

body.login-page {
    background-image: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url('../../img/Frabrica.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
}

@keyframes bounceIn {
    0% {
        transform: translateY(-32px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.animate-bounce-in {
    animation: bounceIn 0.45s ease-out forwards;
}

#mobile-drawer {
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
}

#mobile-drawer nav a {
    position: relative;
}

#mobile-drawer nav a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    border-radius: 0.5rem;
    pointer-events: none;
}

main {
    scroll-behavior: smooth;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: #94a3b8;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
}

#drawer-overlay {
    transition: opacity 0.3s ease;
}

#drawer-overlay.hidden {
    pointer-events: none;
}

.card-hover,
.card-hover:hover {
    transition: all 0.3s ease;
}

.dashboard-card-hover:hover {
    transform: translateY(-2px);
}

.chart-bar-height-70 { height: 70%; }
.chart-bar-height-60 { height: 60%; }
.chart-bar-height-85 { height: 85%; }
.chart-bar-height-50 { height: 50%; }
.chart-bar-height-40 { height: 40%; }
.chart-bar-height-65 { height: 65%; }
.chart-bar-height-35 { height: 35%; }
.chart-bar-height-30 { height: 30%; }
.chart-bar-height-25 { height: 25%; }
.chart-bar-height-45 { height: 45%; }
.chart-bar-height-48 { height: 48%; }
.chart-bar-height-80 { height: 80%; }

.progress-width-85 { width: 85%; }
.progress-width-60 { width: 60%; }
.progress-width-35 { width: 35%; }
.progress-width-92 { width: 92%; }
.progress-width-55 { width: 55%; }

/* ── Responsive Global Rules ── */
html, body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Touch-friendly minimum button/link tap targets */
button, a, [role="button"] {
    min-height: 40px;
}

/* Prevent iOS input zoom on small font sizes */
input, select, textarea {
    font-size: 16px;
}

@media (min-width: 768px) {
    input, select, textarea {
        font-size: 14px;
    }
}

/* Table wrapper should never cause page-level overflow */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}

/* Sidebar overlay: ensure complete coverage including notch areas */
#drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
}

/* Ensure action buttons in tables are always visible on touch devices */
@media (hover: none) {
    .group .lg\:opacity-0 {
        opacity: 1 !important;
    }
    .group-hover\:opacity-100 {
        opacity: 1 !important;
    }
}

/* Modal backdrop z-index fix for mobile */
[id$="-modal"].flex {
    display: flex !important;
}

/* Smooth scroll without hidden overflow issues */
main {
    scroll-behavior: smooth;
    max-width: 100%;
}

/* ==========================================================================
   STICKY TABLE HEADERS - SISTEMA GLOBAL
   Garantiza que en todas las tablas del sistema (inventario, productos,
   historial, bodegas, usuarios, reportes y modales) el encabezado con los
   títulos de las columnas se mantenga visible y fijo (sticky) tanto al
   hacer scroll hacia abajo como hacia arriba en la página.
   ========================================================================== */

/* Contenedores de tablas en página: scroll horizontal fluido sin doble scrollbar vertical */
.overflow-x-auto {
    overflow-x: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Modales: altura adaptada para que las tablas internas no desborden el diálogo */
[id$="-modal"] .overflow-x-auto,
.modal-body .overflow-x-auto {
    max-height: 48vh !important;
    overflow-y: auto !important;
}

[id$="-modal"] table thead,
[id$="-modal"] table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 20 !important;
    background-color: #f8fafc !important;
    box-shadow: inset 0 -1px 0 #cbd5e1, 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* Barra flotante de encabezados fijos (Sticky Header) */
#sgi-sticky-header-bar {
    border-collapse: separate;
    border-spacing: 0;
    pointer-events: none;
}

#sgi-sticky-header-bar table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100%;
}

#sgi-sticky-header-bar th {
    background-color: #f8fafc !important;
    border-bottom: 2px solid #cbd5e1 !important;
    box-shadow: inset 0 -1px 0 #cbd5e1, 0 2px 4px rgba(0, 0, 0, 0.04) !important;
    user-select: none;
}

/* Scrollbar refinado, discreto y moderno para todas las tablas */
.overflow-x-auto::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
