/**
 * 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 */
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;
}

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;
}

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

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

/* Textos secundarios y tenues con contraste seguro */
html.light .text-gray-400,
html.light .text-slate-400,
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,
[class*="bg-[#12171D]"] .text-white,
[class*="bg-slate-800"] .text-white,
[class*="bg-slate-900"] .text-white,
[class*="bg-blue-600"] .text-white,
[class*="bg-emerald-600"] .text-white,
[class*="bg-rose-600"] .text-white,
.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;
    -webkit-text-fill-color: transparent;
}

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

html.dark .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;
    }
}
