/* Custom styles that complement Tailwind */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300..900;1,14..32,300..900&display=swap');

* { font-family: 'Inter', system-ui, sans-serif; }

/* Scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Smooth transitions for nav items */
.nav-link { transition: all 0.15s ease; }
.nav-link:hover { background: rgba(255,255,255,0.05); }
.nav-link.active { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.25); }

/* Chart.js dark theme fix */
canvas { display: block; }

/* POS search highlight */
.pos-product-card:hover { border-color: #7c3aed; transform: translateY(-1px); }

/* Table row hover */
.data-row:hover { background: rgba(255,255,255,0.03); }

/* Custom checkbox */
input[type="checkbox"] { accent-color: #8b5cf6; }

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glow effect on focus */
.glow-focus:focus { box-shadow: 0 0 0 3px rgba(139,92,246,0.2); }

/* Sidebar transition — supports both mobile slide and desktop collapse */
.sidebar-transition { transition: transform 0.3s ease, width 0.3s ease; }

/* Desktop collapse */
.sidebar-collapsed { width: 4.75rem !important; }
.sidebar-collapsed .sidebar-label,
.sidebar-collapsed .nav-text,
.sidebar-collapsed nav p { display: none; }
.sidebar-collapsed .nav-link { justify-content: center; padding-left: 0.75rem; padding-right: 0.75rem; }
.sidebar-collapsed #sidebarToggle { margin-left: 0; }
.sidebar-collapsed #sidebarToggle svg { transform: rotate(180deg); }
.sidebar-collapsed #sidebarSearchContainer { display: none !important; }

/* Responsive tables — horizontal scroll on small screens */
main .overflow-x-auto,
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
main table,
.erp-table { table-layout: auto; width: 100%; min-width: 480px; }
main th,
main td,
.erp-table th,
.erp-table td {
    min-width: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}
/* Allow wrapping only in name/description columns */
main td.wrap-cell { white-space: normal; overflow-wrap: anywhere; }
.actions-cell { width: 4.25rem; white-space: nowrap; }

/* Responsive grid helpers */
@media (max-width: 1280px) { .optional-lg { display: none !important; } }
@media (max-width: 1024px) { .optional-md { display: none !important; } }
@media (max-width: 640px)  { .optional-sm { display: none !important; } }

/* Mobile-friendly tap targets */
@media (max-width: 1024px) {
    .nav-link { min-height: 44px; }
    button, a { -webkit-tap-highlight-color: transparent; }
}

/* Responsive card grids */
@media (max-width: 640px) {
    .responsive-grid-2 { grid-template-columns: 1fr !important; }
    .responsive-grid-3 { grid-template-columns: 1fr !important; }
    .responsive-grid-4 { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Scrollbar — thinner on mobile */
@media (max-width: 1024px) {
    ::-webkit-scrollbar { width: 3px; height: 3px; }
}

/* Badge pulse */
.badge-pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }

/* Fade in animation */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Entity catalog (proveedores, clientes, etc.) */
.entity-stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.entity-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    border-color: rgba(139,92,246,0.35);
}
.entity-row {
    animation: entityRowIn 0.35s ease backwards;
}
@keyframes entityRowIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}
.entity-avatar {
    background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(16,185,129,0.2));
}
.step-active {
    color: #a78bfa !important;
    border-color: rgba(139,92,246,0.5) !important;
    background: rgba(139,92,246,0.12) !important;
}
.fiscal-option-active {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.field-autofill-flash {
    animation: autofillFlash 1s ease;
    border-color: rgba(16,185,129,0.6) !important;
}
@keyframes autofillFlash {
    0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.45); }
    70% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
    100% { box-shadow: none; }
}
#taxLookupPanel.lookup-pulse {
    animation: lookupPulse 1.5s ease infinite;
}
@keyframes lookupPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,0); }
    50% { box-shadow: 0 0 0 4px rgba(139,92,246,0.15); }
}

/* Card hover glow */
.card-glow:hover { box-shadow: 0 0 0 1px rgba(139,92,246,0.3), 0 8px 32px rgba(0,0,0,0.4); }

/* POS quantity input */
.qty-input { -moz-appearance: textfield; }
.qty-input::-webkit-inner-spin-button, .qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }
   THEME SYSTEM - CSS VARIABLES FOR TAILWIND BRAND
   ═══════════════════════════════════════════════════════════════ */

:root, [data-theme="dark-violet"] {
    --color-brand-50: #f5f3ff;
    --color-brand-100: #ede9fe;
    --color-brand-200: #ddd6fe;
    --color-brand-300: #c4b5fd;
    --color-brand-400: #a78bfa;
    --color-brand-500: #8b5cf6;
    --color-brand-600: #7c3aed;
    --color-brand-700: #6d28d9;
    --color-brand-800: #5b21b6;
    --color-brand-900: #4c1d95;
}

[data-theme="dark-blue"] {
    --color-brand-50: #eff6ff;
    --color-brand-100: #dbeafe;
    --color-brand-200: #bfdbfe;
    --color-brand-300: #93c5fd;
    --color-brand-400: #60a5fa;
    --color-brand-500: #3b82f6;
    --color-brand-600: #2563eb;
    --color-brand-700: #1d4ed8;
    --color-brand-800: #1e40af;
    --color-brand-900: #1e3a8a;
}

[data-theme="dark-green"] {
    --color-brand-50: #f0fdf4;
    --color-brand-100: #dcfce7;
    --color-brand-200: #bbf7d0;
    --color-brand-300: #86efac;
    --color-brand-400: #4ade80;
    --color-brand-500: #22c55e;
    --color-brand-600: #16a34a;
    --color-brand-700: #15803d;
    --color-brand-800: #166534;
    --color-brand-900: #14532d;
}

[data-theme="dark-rose"] {
    --color-brand-50: #fff1f2;
    --color-brand-100: #ffe4e6;
    --color-brand-200: #fecdd3;
    --color-brand-300: #fda4af;
    --color-brand-400: #fb7185;
    --color-brand-500: #f43f5e;
    --color-brand-600: #e11d48;
    --color-brand-700: #be123c;
    --color-brand-800: #9f1239;
    --color-brand-900: #881337;
}

[data-theme="light-clean"] {
    color-scheme: light;
    --color-brand-50: #eef2ff;
    --color-brand-100: #e0e7ff;
    --color-brand-200: #c7d2fe;
    --color-brand-300: #a5b4fc;
    --color-brand-400: #818cf8;
    --color-brand-500: #6366f1;
    --color-brand-600: #4f46e5;
    --color-brand-700: #4338ca;
    --color-brand-800: #3730a3;
    --color-brand-900: #312e81;
}
[data-theme="light-clean"] body {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}
[data-theme="light-clean"] aside {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
}
[data-theme="light-clean"] header {
    background-color: rgba(255,255,255,0.9) !important;
    border-color: #e2e8f0 !important;
}
[data-theme="light-clean"] main {
    background-color: #f1f5f9 !important;
}
[data-theme="light-clean"] .bg-slate-900 {
    background-color: #ffffff !important;
}
[data-theme="light-clean"] .bg-slate-950 {
    background-color: #f8fafc !important;
}
[data-theme="light-clean"] .bg-slate-800 {
    background-color: #f1f5f9 !important;
}
[data-theme="light-clean"] .border-slate-800,
[data-theme="light-clean"] .border-slate-700 {
    border-color: #e2e8f0 !important;
}
[data-theme="light-clean"] .text-slate-100 { color: #0f172a !important; }
[data-theme="light-clean"] .text-slate-200 { color: #1e293b !important; }
[data-theme="light-clean"] .text-slate-300 { color: #334155 !important; }
[data-theme="light-clean"] .text-slate-400 { color: #475569 !important; }
[data-theme="light-clean"] .text-slate-500 { color: #64748b !important; }
[data-theme="light-clean"] .text-slate-600 { color: #94a3b8 !important; }

[data-theme="light-warm"] {
    color-scheme: light;
    --color-brand-50: #fdf8f6;
    --color-brand-100: #fbeee9;
    --color-brand-200: #f7dcd0;
    --color-brand-300: #f1bfab;
    --color-brand-400: #e4997a;
    --color-brand-500: #f59e0b;
    --color-brand-600: #d97706;
    --color-brand-700: #b45309;
    --color-brand-800: #92400e;
    --color-brand-900: #78350f;
}
[data-theme="light-warm"] body {
    background-color: #faf7f2 !important;
    color: #1c1917 !important;
}
[data-theme="light-warm"] aside {
    background-color: #fffbf5 !important;
    border-color: #e7e0d8 !important;
}
[data-theme="light-warm"] header {
    background-color: rgba(255,251,245,0.9) !important;
    border-color: #e7e0d8 !important;
}
[data-theme="light-warm"] main { background-color: #faf7f2 !important; }
[data-theme="light-warm"] .bg-slate-900 { background-color: #fffbf5 !important; }
[data-theme="light-warm"] .bg-slate-950 { background-color: #faf7f2 !important; }
[data-theme="light-warm"] .bg-slate-800 { background-color: #f5ede0 !important; }
[data-theme="light-warm"] .border-slate-800,
[data-theme="light-warm"] .border-slate-700 { border-color: #e7e0d8 !important; }
[data-theme="light-warm"] .text-slate-100 { color: #1c1917 !important; }
[data-theme="light-warm"] .text-slate-200 { color: #292524 !important; }
[data-theme="light-warm"] .text-slate-300 { color: #44403c !important; }
[data-theme="light-warm"] .text-slate-400 { color: #57534e !important; }
[data-theme="light-warm"] .text-slate-500 { color: #78716c !important; }
[data-theme="light-warm"] .text-slate-600 { color: #a8a29e !important; }
[data-theme="light-warm"] .nav-link { color: #57534e; }
[data-theme="light-warm"] .nav-link:hover { background: rgba(217,119,6,0.08); color: #b45309; }
[data-theme="light-warm"] .nav-link.active { background: rgba(217,119,6,0.12); color: #b45309; border-color: rgba(217,119,6,0.3); }
[data-theme="light-warm"] .bg-violet-600 { background-color: #b45309 !important; }
[data-theme="light-warm"] .hover\:bg-violet-500:hover { background-color: #d97706 !important; }
[data-theme="light-warm"] .text-violet-400 { color: #d97706 !important; }
[data-theme="light-warm"] .border-violet-500 { border-color: #d97706 !important; }
[data-theme="light-warm"] ::-webkit-scrollbar-thumb { background: #d6cfc7; }
