/**
 * SISTEMA POS & INVENTARIO PERFUMERÍA DE RECARGAS
 * DISEÑO MINIMALISTA ENTERPRISE — ÍNTEGRA
 * Enfoque: Limpieza visual, reducción de ruido cromático y máxima usabilidad
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Acento Único Corporativo ÍNTEGRA */
    --brand-primary: #0077FF;
    --brand-primary-hover: #0062D6;
    --brand-primary-soft: rgba(0, 119, 255, 0.08);
}

/* ============================================================================== */
/* 1. MODO CLARO (PREDETERMINADO / BLANCO LIMPIO) */
/* ============================================================================== */
html.light, :root:not(.dark) {
    --bg-page: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-subtle: #F1F5F9;
    --bg-input: #FFFFFF;
    --border-main: #E2E8F0;
    --border-subtle: #F1F5F9;
    --border-focus: #0077FF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --text-subtle: #94A3B8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
}

/* ============================================================================== */
/* 2. MODO OSCURO (NEGRO / AZUL NOCHE SOBRIO) */
/* ============================================================================== */
html.dark {
    --bg-page: #0B132B;
    --bg-surface: #111C38;
    --bg-subtle: #080F21;
    --bg-input: #080F21;
    --border-main: #1E293B;
    --border-subtle: #152244;
    --border-focus: #00E5FF;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --text-subtle: #64748B;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* ============================================================================== */
/* BASE & CONFINAMIENTO MÓVIL ESTRICTO (CERO DESPLAZAMIENTO LATERAL) */
/* ============================================================================== */
html {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    -webkit-text-size-adjust: 100%;
}

body, button, input, select, textarea {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
}

button {
    cursor: pointer;
    border: none;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
}

/* Regla para ocultar elementos, respetando clases responsivas de Tailwind */
.hidden:not(.md\:block):not(.md\:flex):not(.md\:inline):not(.sm\:block):not(.sm\:flex):not(.sm\:inline):not(.lg\:block):not(.lg\:flex),
[hidden],
.modal.hidden,
.admin-seccion.hidden,
#vista-ticket-publico.hidden,
#portal-landing-integra.hidden {
    display: none !important;
}

/* Reglas responsivas garantizadas para tablas de escritorio vs tarjetas móviles */
@media (min-width: 768px) {
    .tabla-desktop-container,
    .md\:block {
        display: block !important;
    }
    .md\:flex {
        display: flex !important;
    }
    .md\:inline {
        display: inline !important;
    }
    .cards-mobile-container,
    .md\:hidden {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .tabla-desktop-container {
        display: none !important;
    }
    .cards-mobile-container {
        display: block !important;
    }
}

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
}

.grid {
    display: grid;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.text-center {
    text-align: center;
}

/* ============================================================================== */
/* ESTILOS ROBUSTOS PARA EL PORTAL DE BIENVENIDA, LOGIN Y REGISTRO ÍNTEGRA       */
/* ============================================================================== */
#portal-landing-integra {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    background-color: #FFFFFF !important;
    color: #1E293B !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

@media (max-width: 639px) {
    #portal-header-top {
        display: none !important;
    }
}

#portal-landing-integra .portal-card {
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 24px !important;
    padding: 24px 18px !important;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04) !important;
    width: 100% !important;
    max-width: 440px !important;
    margin: 0 auto !important;
}

@media (min-width: 640px) {
    #portal-landing-integra .portal-card {
        padding: 32px !important;
    }
}

#portal-landing-integra label {
    display: block !important;
    width: 100% !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #334155 !important;
    margin-bottom: 6px !important;
    text-align: left !important;
}

#portal-landing-integra input {
    display: block !important;
    width: 100% !important;
    height: 44px !important;
    box-sizing: border-box !important;
    background-color: #F8FAFC !important;
    border: 1.5px solid #CBD5E1 !important;
    border-radius: 12px !important;
    padding: 0 14px !important;
    font-size: 16px !important; /* 16px previene auto-zoom molesto en Safari iOS */
    color: #0F172A !important;
    outline: none !important;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s !important;
    -webkit-appearance: none !important;
}

@media (min-width: 640px) {
    #portal-landing-integra input {
        font-size: 13px !important;
        height: 42px !important;
    }
}

#portal-landing-integra input:focus {
    border-color: #0077FF !important;
    background-color: #FFFFFF !important;
    box-shadow: 0 0 0 3px rgba(0, 119, 255, 0.15) !important;
}

#portal-landing-integra .space-y-4 > * + * {
    margin-top: 1rem !important;
}

#portal-landing-integra .space-y-3\.5 > * + * {
    margin-top: 0.875rem !important;
}

#portal-form-login, #portal-form-registro {
    width: 100% !important;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-main);
    transition: background-color 0.2s ease, color 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    position: relative;
    overscroll-behavior-x: none !important;
}

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

header, main, footer, section, aside, nav, div {
    max-width: 100%;
}

/* Confinamiento y deslizamiento táctil fluido para menús con scroll horizontal interno */
.overflow-x-auto,
.scrollbar-none {
    max-width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
    overscroll-behavior-x: contain !important;
    scrollbar-width: none !important;
}
.overflow-x-auto::-webkit-scrollbar,
.scrollbar-none::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

h1, h2, h3, h4, .font-display {
    font-family: var(--font-display);
    letter-spacing: -0.015em;
}

.font-mono {
    font-family: var(--font-mono);
}

/* Scrollbar Minimalista */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
html.light ::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 9999px;
}
html.dark ::-webkit-scrollbar-thumb {
    background: #1E293B;
    border-radius: 9999px;
}

/* Segmented Control (Selector iOS / Minimalista) */
.segmented-control {
    display: flex;
    background-color: var(--bg-subtle);
    padding: 3px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    gap: 2px;
}

.segmented-item {
    flex: 1;
    text-align: center;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    transition: all 0.15s ease;
    color: var(--text-muted);
}

.segmented-item.active {
    background-color: var(--bg-surface);
    color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html.dark .segmented-item.active {
    background-color: #1A2649;
    color: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Botón Primario ÍNTEGRA (Limpio y Sólido) */
.btn-integra-primary {
    background-color: #0077FF;
    color: #FFFFFF;
    font-weight: 600;
    font-size: 12px;
    border-radius: 10px;
    padding: 8px 16px;
    transition: all 0.15s ease;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 119, 255, 0.2);
}

.btn-integra-primary:hover {
    background-color: #0062D6;
    box-shadow: 0 2px 6px rgba(0, 119, 255, 0.3);
}

.btn-integra-primary:active {
    transform: scale(0.98);
}

/* Botón Secundario Outline (Neutro) */
.btn-neutral-outline {
    background-color: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-main);
    font-weight: 600;
    font-size: 12px;
    border-radius: 10px;
    padding: 7px 14px;
    transition: all 0.15s ease;
}

.btn-neutral-outline:hover {
    background-color: var(--bg-subtle);
    border-color: #CBD5E1;
}

.btn-neutral-outline:active {
    transform: scale(0.98);
}

/* Teclado Numérico Táctil Minimalista */
.btn-teclado-num {
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border: 1px solid var(--border-main);
    transition: all 0.12s ease;
    box-shadow: var(--shadow-sm);
}

.btn-teclado-num:hover {
    background-color: var(--bg-subtle);
}

.btn-teclado-num:active {
    transform: scale(0.96);
    background-color: #0077FF;
    color: #FFFFFF;
    border-color: #0077FF;
}

/* ============================================================================== */
/* SOBRESCRITURA DE MODO CLARO (GARANTIZAR MÁXIMA LIMPIEZA VISUAL) */
/* ============================================================================== */
/* REGLAS MAESTRAS DE ALTO CONTRASTE Y LEGIBILIDAD (MODO BLANCO Y MODO OSCURO) */
/* ============================================================================== */

/* 1. MODO BLANCO (Fondo claro / Texto nítido oscuro) */
html.light body {
    background-color: #F8FAFC !important;
    color: #0F172A !important;
}

html.light header {
    background-color: #FFFFFF !important;
    border-color: #E2E8F0 !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03) !important;
}

/* En modo blanco, títulos siempre oscuros y legibles */
html.light h1,
html.light h2,
html.light h3,
html.light h4,
html.light h5,
html.light h6 {
    color: #0F172A !important;
}

/* Tarjetas y superficies en modo blanco con bordes y contraste nítido */
html.light .bg-white {
    background-color: #FFFFFF !important;
    border-color: #E2E8F0 !important;
}

/* Controles segmentados en modo blanco (Frasco Nuevo vs Recarga) */
html.light .segmented-control {
    background-color: #E2E8F0 !important;
    border-color: #CBD5E1 !important;
}

html.light .segmented-item {
    color: #475569 !important;
    font-weight: 700 !important;
}

html.light .segmented-item.active {
    background-color: #FFFFFF !important;
    color: #0077FF !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
    font-weight: 800 !important;
}

/* Botones de filtros de catálogo en modo blanco */
html.light .pos-tab-filtro:not(.active) {
    background-color: #FFFFFF !important;
    color: #334155 !important;
    border: 1px solid #CBD5E1 !important;
    font-weight: 600 !important;
}

html.light .pos-tab-filtro:not(.active):hover {
    background-color: #F1F5F9 !important;
    color: #0F172A !important;
    border-color: #94A3B8 !important;
}

/* Botones de tamaño (30ml, 50ml, 100ml) no seleccionados en modo blanco */
html.light button.border-slate-200,
html.light button.border-slate-300 {
    background-color: #FFFFFF !important;
    color: #1E293B !important;
    border-color: #CBD5E1 !important;
    font-weight: 700 !important;
}

/* Inputs en modo blanco */
html.light input:not([type="checkbox"]):not([type="radio"]),
html.light select,
html.light textarea {
    background-color: #FFFFFF !important;
    color: #0F172A !important;
    border-color: #CBD5E1 !important;
}

html.light input::placeholder {
    color: #94A3B8 !important;
}

/* Tablas en modo blanco */
html.light th {
    color: #334155 !important;
    border-color: #E2E8F0 !important;
    background-color: #F8FAFC !important;
}

html.light td {
    color: #0F172A !important;
    border-color: #E2E8F0 !important;
}

/* Textos secundarios y tenues con contraste seguro */
html.light .text-gray-400,
html.light .text-slate-400 {
    color: #64748B !important;
}

html.light .text-gray-500,
html.light .text-slate-500 {
    color: #475569 !important;
}

html.light .text-gray-300,
html.light .text-slate-300 {
    color: #334155 !important;
}

html.light .text-gray-200,
html.light .text-gray-100 {
    color: #0F172A !important;
}

/* Botones y elementos con texto blanco explícito mantienen siempre su texto blanco */
button.text-white,
button .text-white,
.text-white,
.bg-blue-600,
.bg-blue-600 *,
.bg-emerald-600,
.bg-emerald-600 *,
.bg-emerald-500,
.bg-emerald-500 *,
.bg-rose-600,
.bg-rose-600 *,
.bg-indigo-600,
.bg-indigo-600 *,
.btn-integra-primary,
.btn-integra-primary * {
    color: #FFFFFF !important;
}

/* ============================================================================== */
/* ESTILOS OFICIALES DE IDENTIDAD DE MARCA ÍNTEGRA (Manual Oficial) */
/* ============================================================================== */
.brand-logo-integra {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-badge-integra {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #00E5FF 0%, #0077FF 100%);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 119, 255, 0.28);
    flex-shrink: 0;
}

.logo-badge-integra-lg {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 119, 255, 0.35);
}

.logo-in-symbol-integra {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-weight: 900;
    font-size: 1.25rem;
    color: #FFFFFF !important;
    line-height: 1;
}

.logo-badge-integra-lg .logo-in-symbol-integra {
    font-size: 1.75rem;
}

.brand-text-integra {
    display: flex;
    flex-direction: column;
    line-height: 1;
    text-align: left;
}

.brand-name-group-integra {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-weight: 800;
    font-size: 1.35rem;
    line-height: 1;
    letter-spacing: -0.01em;
}

.brand-name-group-integra-lg {
    font-size: 1.95rem;
}

.brand-in-integra {
    background: linear-gradient(135deg, #00E5FF 0%, #0077FF 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.brand-tegra-integra {
    color: #0F172A;
    display: inline-block;
}

/* En el portal de bienvenida con fondo blanco, siempre debe ser oscuro */
#portal-landing-integra .brand-tegra-integra {
    color: #0F172A !important;
}

/* En la app POS interior cuando el modo oscuro está activo */
html.dark:not(:has(#portal-landing-integra:not(.hidden))) .brand-tegra-integra,
html.dark .sidebar-integra .brand-tegra-integra,
html.dark header:not(#portal-landing-integra header) .brand-tegra-integra {
    color: #FFFFFF;
}

.brand-sub-integra {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748B;
    letter-spacing: 0.18em;
    margin-top: 4px;
}

/* Botón Primario Oficial ÍNTEGRA con Alto Contraste */
.btn-integra-primary {
    background: linear-gradient(135deg, #00E5FF 0%, #0077FF 100%) !important;
    color: #FFFFFF !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(0, 119, 255, 0.3) !important;
    transition: all 0.2s ease !important;
}

.btn-integra-primary:hover {
    background: linear-gradient(135deg, #00D4EE 0%, #0066EE 100%) !important;
    box-shadow: 0 6px 20px rgba(0, 119, 255, 0.45) !important;
    transform: translateY(-1px);
}

/* Badges de género y estado con fondo suave y texto legible en modo blanco */
html.light .bg-blue-900\/40,
html.light .bg-blue-950\/80 {
    background-color: #EFF6FF !important;
    border-color: #BFDBFE !important;
    color: #1D4ED8 !important;
}

html.light .bg-pink-900\/40,
html.light .bg-rose-950\/80 {
    background-color: #FFF1F2 !important;
    border-color: #FECDD3 !important;
    color: #BE123C !important;
}

html.light .bg-purple-900\/40 {
    background-color: #FAF5FF !important;
    border-color: #E9D5FF !important;
    color: #7E22CE !important;
}

html.light .bg-amber-900\/40,
html.light .bg-amber-950\/80,
html.light .bg-amber-950 {
    background-color: #FFFBEB !important;
    border-color: #FDE68A !important;
    color: #B45309 !important;
}

/* Colores de estado con contraste seguro sobre blanco */
html.light .text-amber-400,
html.light .text-amber-300 {
    color: #B45309 !important;
}

html.light .text-cyan-400,
html.light .text-cyan-300 {
    color: #0284C7 !important;
}

html.light .text-emerald-400,
html.light .text-emerald-300 {
    color: #047857 !important;
}

html.light .text-rose-400,
html.light .text-rose-300 {
    color: #BE123C !important;
}

html.light .text-blue-400,
html.light .text-blue-300 {
    color: #1D4ED8 !important;
}

/* Contenedores y tarjetas en modo blanco */
html.light .bg-\[\#0F172A\],
html.light .bg-\[\#090D16\],
html.light .bg-\[\#0B132B\],
html.light .bg-gray-900,
html.light .bg-gray-900\/90,
html.light .bg-gray-900\/80,
html.light .bg-gray-900\/95,
html.light .bg-\[\#111C38\] {
    background-color: #FFFFFF !important;
    border-color: #E2E8F0 !important;
    color: #0F172A !important;
}

html.light .bg-gray-950,
html.light .bg-gray-950\/60,
html.light .bg-gray-950\/80,
html.light .bg-gray-950\/90,
html.light .bg-\[\#080F21\] {
    background-color: #F8FAFC !important;
    border-color: #E2E8F0 !important;
    color: #0F172A !important;
}

html.light .bg-gray-800,
html.light .bg-gray-800\/80 {
    background-color: #F1F5F9 !important;
    border-color: #E2E8F0 !important;
    color: #1E293B !important;
}

html.light .border-gray-800,
html.light .border-gray-800\/80,
html.light .border-gray-700 {
    border-color: #E2E8F0 !important;
}

/* Botones que siempre llevan fondo de color y texto blanco */
.bg-blue-600,
.bg-blue-600 *,
.btn-integra-primary,
.btn-integra-primary *,
.pos-tab-filtro.active,
.bg-rose-600,
.bg-rose-600 *,
.bg-emerald-600,
.bg-emerald-600 * {
    color: #FFFFFF !important;
}

button:disabled,
button[disabled] {
    color: #94A3B8 !important;
}

html.light input:not([type="checkbox"]):not([type="radio"]),
html.light select,
html.light textarea {
    background-color: #FFFFFF !important;
    color: #0F172A !important;
    border-color: #CBD5E1 !important;
}

html.light input:focus,
html.light select:focus,
html.light textarea:focus {
    border-color: #0077FF !important;
    box-shadow: 0 0 0 3px rgba(0, 119, 255, 0.12) !important;
}

/* Modales */
html.light .fixed.inset-0.bg-black\/85,
html.light .fixed.inset-0.bg-black\/80,
html.light .fixed.inset-0.bg-black\/90 {
    background-color: rgba(15, 23, 42, 0.5) !important;
}

/* 2. MODO OSCURO (Azul Oscuro / Noche Sobrio) */
html.dark body {
    background-color: #0B132B !important;
    color: #F8FAFC !important;
}

html.dark h1,
html.dark h2,
html.dark h3,
html.dark h4,
html.dark h5,
html.dark h6 {
    color: #FFFFFF;
}

html.dark th {
    color: #94A3B8 !important;
    border-color: #1E293B !important;
}

html.dark td {
    color: #E2E8F0 !important;
    border-color: #1E293B !important;
}

html.dark .text-gray-400,
html.dark .text-slate-400 {
    color: #94A3B8 !important;
}

html.dark .text-gray-300,
html.dark .text-slate-300 {
    color: #CBD5E1 !important;
}

/* Impresión térmica */
@media print {
    body * {
        visibility: hidden !important;
    }

    #pos-modal-ticket,
    #ticket-imprimible,
    #ticket-imprimible * {
        visibility: visible !important;
    }

    #pos-modal-ticket {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #ticket-imprimible {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 80mm !important;
        margin: 0 !important;
        padding: 4mm !important;
        border: none !important;
        box-shadow: none !important;
        background: #fff !important;
        color: #000 !important;
    }

    .no-print {
        display: none !important;
    }
}
