/* ============================================================
   🌌 TUKSON BITÁCORA NÚCLEO
   Módulo: UI COMPARTIDA
   Programa: CORE_ui_styles.css
   Propósito: CSS compartido del ERP Tukson — reduce duplicación inline en HTML.
   Detalles: Incluir como <link> ANTES del <style> inline de cada HTML.
             Las reglas inline en cada HTML prevalecen sobre este archivo.
             MOBI = mobile, DESK = desktop.
   Relaciones: TODOS los HTML del ERP, CORE_ui_bootstrap.js
   ============================================================ */

/* --- RESET BÁSICO --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: 'Segoe UI', sans-serif; background: #f0f2f5; }

/* --- TOAST SYSTEM (19 archivos) --- */
.toast-container { position: fixed; z-index: 10000; display: flex; flex-direction: column; gap: 10px; }
.toast-container.mobi { top: 6px; right: 8px; gap: 4px; max-width: 90vw; }
.toast-container.desk { top: 20px; right: 20px; min-width: 280px; }
.toast { pointer-events: auto; padding: 12px 18px; border-radius: 8px; color: white; font-size: 0.85rem; font-weight: 500; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); animation: slideIn 0.3s ease-out; }
.toast.desk { padding: 15px 20px; border-radius: 6px; min-width: 280px; }
.toast.mobi { padding: 10px 14px; font-size: 0.78rem; }
.toast-success { background: #27ae60; }
.toast-error { background: #e74c3c; }
.toast-info { background: #3498db; }
.toast-warning { background: #f39c12; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- NAVBAR (18 archivos) --- */
.tukson-nav { display: flex; justify-content: space-between; align-items: center; background: #2c3e50; color: white; }
.tukson-nav.mobi { position: fixed; top: 0; left: 0; right: 0; z-index: 100; min-height: 56px; padding: 4px 14px; padding-top: calc(24px + constant(safe-area-inset-top, 0px)); padding-top: calc(24px + env(safe-area-inset-top, 0px)); align-items: flex-end; flex-shrink: 0; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.tukson-nav.desk { padding: 10px 20px; margin: -15px -15px 20px -15px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.tukson-nav.compact { padding: 8px 16px; margin: -12px -12px 12px -12px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.tukson-nav-brand { font-weight: bold; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; letter-spacing: 1px; }
.tukson-nav-brand.mobi { font-size: 0.85rem; gap: 6px; }
.tukson-nav-actions { display: flex; align-items: center; gap: 6px; }
.tukson-nav-btn { background: #34495e; border: 1px solid #456281; color: white; border-radius: 6px; cursor: pointer; font-weight: bold; white-space: nowrap; text-decoration: none; transition: all 0.2s; }
.tukson-nav-btn.desk { padding: 8px 15px; font-size: 0.85rem; }
.tukson-nav-btn.mobi { padding: 4px 10px; font-size: 0.7rem; }
.tukson-nav-btn:hover { background: #456281; transform: scale(1.05); }
.tukson-nav-btn.primary { background: #3498db; border-color: #2980b9; }
.tukson-nav-btn.primary:hover { background: #2980b9; }
.tukson-nav-btn.danger { background: #e74c3c; border-color: #c0392b; }
.tukson-nav-btn.danger:hover { background: #c0392b; }
.tukson-nav-btn.warning { background: #e67e22; border-color: #d35400; }
.tukson-nav-btn.warning:hover { background: #d35400; }
.tukson-nav-btn.success { background: #27ae60; border-color: #1e8449; }
.tukson-nav-btn.success:hover { background: #1e8449; }
.tukson-nav-refresh { background: #e67e22; border-color: #d35400; font-size: 1.1rem; transition: transform 0.3s; }
.tukson-nav-refresh:hover { transform: rotate(90deg) scale(1.1); }

/* --- BUTTON SYSTEM (24 archivos) --- */
.btn, button, input[type="button"], input[type="submit"] { cursor: pointer; border: none; border-radius: 6px; font-weight: bold; transition: background 0.2s, transform 0.1s; }
.btn:active, button:active { transform: scale(0.97); }
.btn.mobi { padding: 10px 14px; font-size: 0.8rem; min-height: 40px; }
.btn.desk { padding: 10px 18px; font-size: 0.82rem; }
.btn-primary { background: #6c5ce7; color: white; }
.btn-primary:hover { background: #5a4bd1; }
.btn-primary.mobi { background: #0891b2; }
.btn-primary.mobi:hover { background: #067a96; }
.btn-success { background: #27ae60; color: white; }
.btn-success:hover { background: #1e8449; }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: #f39c12; color: white; }
.btn-warning:hover { background: #d68910; }
.btn-info { background: #3498db; color: white; }
.btn-info:hover { background: #2980b9; }
.btn-sm { padding: 5px 10px; font-size: 0.72rem; }
.btn-ghost { background: transparent; color: inherit; border: 1px solid currentColor; }

/* --- BOTTOM BAR MOBILE (fijo, thumb zone) --- */
.bottom-bar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 99; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: white; border-top: 1px solid #ddd; box-shadow: 0 -2px 10px rgba(0,0,0,0.08); }
.bottom-bar.mobi { padding: 8px 12px; padding-bottom: calc(8px + constant(safe-area-inset-bottom, 0px)); padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
.bottom-bar .bottom-btn { flex: 1; text-align: center; padding: 10px; border-radius: 6px; font-weight: bold; font-size: 0.82rem; }
.bottom-bar .bottom-btn.primary { background: #0891b2; color: white; }
.bottom-bar .bottom-btn.success { background: #27ae60; color: white; }
.bottom-bar .bottom-btn.danger { background: #e74c3c; color: white; }

/* --- PANEL SYSTEM (17 archivos) --- */
.panel-cabecera, .panel-filtros, .panel-grid { background: white; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.panel-cabecera { padding: 15px 20px; margin-bottom: 15px; }
.panel-filtros { padding: 12px 16px; margin-bottom: 12px; }
.panel-grid { padding: 0; overflow: hidden; }
.panel-cabecera.mobi, .panel-filtros.mobi { border-radius: 6px; padding: 10px 12px; }

/* --- TARJETA TALLA (resumen móvil, 5 archivos) --- */
.tarjeta-talla { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 4px; border-radius: 4px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.1); transition: transform 0.2s; }
.tarjeta-talla:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.tarjeta-talla-label { font-size: 0.6rem; font-weight: bold; opacity: 0.9; margin-bottom: 1px; }
.tarjeta-talla-valor { font-size: 0.85rem; font-weight: bold; }
.tarjeta-talla.cero { background: #e0e0e0; color: #9e9e9e; }

/* --- BOTÓN BORRAR FILA (Tabulator, 5 archivos) --- */
.btn-borrar-fila { background: #e74c3c; color: white; border: none; padding: 4px 8px; border-radius: 3px; cursor: pointer; font-weight: bold; font-size: 0.75rem; transition: all 0.2s; }
.btn-borrar-fila:hover { background: #c0392b; transform: scale(1.1); }

/* --- TABULATOR CUSTOM (7 archivos) --- */
.tabulator input[type=number]::-webkit-inner-spin-button,.tabulator input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.tabulator input[type=number]{-moz-appearance:textfield}
.tabulator-col-title { font-size: 0.7rem !important; white-space: normal !important; text-align: center !important; }
.tabulator-header-column { min-width: 40px !important; }
.tabulator-row { border-bottom: 2px solid #ddd !important; }
.tabulator-row:nth-child(even) { background-color: #f8f9fa !important; }
.tabulator-row:nth-child(odd) { background-color: #ffffff !important; }
.tabulator-row:hover { background-color: #e3f2fd !important; }
.celda-total { font-weight: bold; background-color: #fff9c4 !important; color: #f57c00 !important; }
.tabulator-calcs-row { background-color: #d4edda !important; font-weight: bold; border-top: 3px solid #28a745 !important; }
.tabulator-calcs-row .tabulator-cell { font-size: 1.1em; }
.tabulator-row.tabulator-selectable.fila-activa { background-color: #fff3cd !important; border-left: 4px solid #ffc107 !important; }

/* --- FORM SYSTEM (13+ archivos) --- */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.72rem; font-weight: bold; color: #7f8c8d; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea { padding: 8px 10px; border: 1px solid #bdc3c7; border-radius: 5px; font-size: 0.85rem; font-family: inherit; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 2px rgba(52,152,219,0.2); }
.form-group.horizontal { flex-direction: row; align-items: center; gap: 8px; }
.form-group.horizontal label { margin-bottom: 0; white-space: nowrap; }
.grid-formulario { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.filtros-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; }

/* --- MODAL SYSTEM (7 archivos) --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200; display: none; align-items: flex-end; justify-content: center; }
.modal-overlay.activo { display: flex; }
.modal-overlay.center { align-items: center; }
.modal-content { background: white; border-radius: 12px 12px 0 0; width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto; }
.modal-content.center { border-radius: 12px; max-width: 420px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #eee; font-weight: bold; font-size: 0.95rem; }
.modal-body { padding: 12px 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid #eee; }
.modal-footer .btn { min-width: 80px; }

/* --- MOBILE BODY STATES (3 MOBI) --- */
body.modal-open { overflow: hidden; }
body.numpad-open { overflow: hidden; }
body.numpad-open .bottom-bar { z-index: 0; }

/* --- EMPTY STATE (6 archivos) --- */
.empty-state { text-align: center; padding: 20px; color: #7f8c8d; font-size: 0.8rem; }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 6px; }

/* --- CLEARABLE INPUT (input-clear-wrap) --- */
.input-clear-wrap { position: relative; display: inline-block; width: 100%; }
.input-clear-wrap input { padding-right: 28px !important; width: 100%; }
.input-clear-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1rem; color: #999; padding: 2px 6px; display: none; line-height: 1; border-radius: 50%; z-index: 1; }
.input-clear-btn:hover { color: #e74c3c; background: rgba(0,0,0,0.05); }
.input-clear-wrap.has-value .input-clear-btn { display: block; }

/* --- PDF OUTPUT (4 archivos) --- */
.pdf-output .pdf-enc { display: flex; align-items: center; gap: 20px; padding: 12px 20px 10px; border-bottom: 3px solid #2c3e50; }
.pdf-output .pdf-enc-logo { width: 90px; height: 90px; border: 2px solid #ddd; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: #f5f5f5; display: flex; align-items: center; justify-content: center; }
.pdf-output .pdf-enc-info { flex: 1; }
.pdf-output .pdf-enc-marca { font-size: 16px; font-weight: bold; color: #2c3e50; }
.pdf-output .pdf-enc-nit { font-size: 9px; color: #666; }
.pdf-output .pdf-enc-dir { font-size: 9px; color: #555; line-height: 1.4; }
.pdf-output .pdf-titulo { text-align: right; }
.pdf-output .pdf-titulo-doc { font-size: 14px; font-weight: bold; color: #2c3e50; }
.pdf-output .pdf-titulo-id { font-size: 11px; color: #666; margin-top: 2px; }
.pdf-output .pdf-div { height: 0; border-top: 1px dashed #ccc; margin: 0 20px; }
.pdf-output .pdf-info-grid { display: grid; grid-template-columns: 1fr 1fr; padding: 6px 20px; border-bottom: 1px solid #eee; }
.pdf-output .pdf-info-l, .pdf-output .pdf-info-r { font-size: 9px; line-height: 1.6; padding: 6px 10px; }
.pdf-output .pdf-info-l { border-right: 1px solid #eee; }
.pdf-output .pdf-info-tit { font-size: 8px; font-weight: bold; color: #fff; background: #2c3e50; display: inline-block; padding: 2px 8px; border-radius: 2px; margin-bottom: 4px; letter-spacing: 0.5px; }
.pdf-output .pdf-info-row { margin: 1px 0; }
.pdf-output .pdf-info-row strong { color: #2c3e50; display: inline-block; width: 80px; font-size: 9px; }
.pdf-output .pdf-obs { padding: 6px 20px; font-size: 9px; color: #555; border-bottom: 1px solid #eee; }
.pdf-output .pdf-tabla { width: 100%; border-collapse: collapse; font-size: 7.5px; }
.pdf-output .pdf-tabla thead th { background: #2c3e50; color: #fff; padding: 5px 2px; text-align: center; font-weight: bold; border: 1px solid #1a252f; white-space: nowrap; }
.pdf-output .pdf-tabla tbody td { padding: 3px 2px; text-align: center; border: 1px solid #ddd; }
.pdf-output .pdf-tabla tbody tr:nth-child(even) td { background: #f8f9fa; }
.pdf-output .pdf-tabla .col-pos { width: 30px; }
.pdf-output .pdf-tabla .col-sku { width: 80px; text-align: left; padding-left: 4px; }
.pdf-output .pdf-tabla .col-color { width: 70px; text-align: left; padding-left: 4px; }
.pdf-output .pdf-tabla .col-talla { width: 30px; }
.pdf-output .pdf-tabla .col-total { width: 40px; font-weight: bold; background: #fff9c4 !important; }
.pdf-output .pdf-tabla .celda-vacia { color: #ccc; }
.pdf-output .tabla-pagina-siguiente { page-break-before: always; page-break-inside: avoid; margin-top: 10px; }
.pdf-output .pdf-tabla tfoot td { background: #d4edda; font-weight: bold; border: 2px solid #28a745; padding: 5px 2px; text-align: center; }
.pdf-output .pdf-footer { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; padding: 20px 20px 10px; margin-top: 16px; }
.pdf-output .pdf-firma { text-align: center; }
.pdf-output .pdf-firma-linea { border-top: 1px solid #333; padding-top: 8px; font-size: 10px; font-weight: bold; }
.pdf-output .pdf-firma-sub { font-size: 8px; color: #777; margin-top: 2px; }
.pdf-output .pdf-disc { text-align: center; font-size: 7px; color: #999; padding: 8px 20px; border-top: 1px solid #eee; }

/* --- CELDA PRECIO / SUBTOTAL (Tabulator) --- */
.celda-precio { background: #f0fdf4 !important; color: #166534 !important; font-weight: bold; }
.celda-subtotal { background: #f0fdf4 !important; color: #166534 !important; font-weight: bold; }

/* --- BADGE (5 archivos) --- */
.badge { display: inline-block; background: #e8e8e8; color: #555; border-radius: 4px; padding: 2px 6px; font-size: 0.68rem; font-weight: bold; }

/* --- SEARCH RESULTS (TuksonSearcher) --- */
.search-results { display: none; position: fixed; z-index: 150; background: white; border: 1px solid #ddd; border-radius: 6px; max-height: 200px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.15); padding: 0; margin: 0; list-style: none; min-width: 200px; }
.search-results.active { display: block; }
.search-results li { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #f0f0f0; font-size: 0.8rem; }
.search-results li:last-child { border-bottom: none; }
.search-results li:hover { background: #f0f9ff; }
.search-results .search-header { background: #f0f2f5; color: #7f8c8d; font-size: 0.6rem; font-weight: bold; text-transform: uppercase; padding: 4px 10px; cursor: default; pointer-events: none; border-bottom: 1px solid #ddd; letter-spacing: 0.5px; }

/* --- LOADING STATE (11 archivos) --- */
.estado-carga { text-align: center; padding: 40px 20px; color: #7f8c8d; font-size: 0.9rem; }
.estado-carga .spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid #ddd; border-top-color: #3498db; border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- SCROLLBAR --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* --- TITLE / HEADER TEXT --- */
.titulo-panel { font-size: 0.95rem; font-weight: bold; color: #2c3e50; margin: 0; }
.titulo-seccion { font-size: 1rem; font-weight: bold; color: #2c3e50; margin-bottom: 10px; }
.subtitulo { font-size: 0.78rem; color: #95a5a6; }

/* --- TABLE / LIST UTILITIES --- */
.lista-vacia { text-align: center; padding: 30px 20px; color: #95a5a6; font-size: 0.85rem; }
.lista-vacia .emoji { font-size: 2rem; margin-bottom: 8px; display: block; }
