/* ============================================================
   IMS — Custom CSS (animations, print, utilities)
   Tailwind handles the heavy lifting; this file adds extras.
   ============================================================ */

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

*, *::before, *::after { box-sizing: border-box; }
html { font-family: 'Inter', system-ui, sans-serif; scroll-behavior: smooth; }
body { background: #f1f5f9; color: #1e293b; }

/* ── Sidebar ── */
#sidebar { transition: transform 0.3s ease; }
.nav-item { transition: all 0.2s ease; border-radius: 8px; margin: 2px 8px; }
.nav-item:hover { background: #e0f2fe; color: #0369a1; }
.nav-item.active { background: #0ea5e9; color: #fff; box-shadow: 0 4px 12px rgba(14,165,233,0.3); }
.nav-item.active svg { opacity: 1; }

/* ── Cards ── */
.stat-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }

/* ── Skeleton Loader ── */
.skeleton { background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Toast ── */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: 10px; font-size: 14px; font-weight: 500; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,0.15); animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards; min-width: 280px; }
.toast.success { background: linear-gradient(135deg, #10b981, #059669); }
.toast.error { background: linear-gradient(135deg, #ef4444, #dc2626); }
.toast.warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.toast.info { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
@keyframes slideIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: translateX(60px); } }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.6); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeOverlay 0.2s ease; }
.modal-box { background: #fff; border-radius: 16px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 60px rgba(0,0,0,0.2); animation: scaleIn 0.2s ease; }
@keyframes fadeOverlay { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th { position: sticky; top: 0; background: #f8fafc; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; padding: 12px 16px; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: #f0f9ff; }
.data-table tbody td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; font-size: 14px; color: #334155; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.03em; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-yellow { background: #fef9c3; color: #b45309; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-sky { background: #e0f2fe; color: #0369a1; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-purple { background: #ede9fe; color: #7c3aed; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s ease; border: none; outline: none; white-space: nowrap; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #fff; box-shadow: 0 4px 12px rgba(14,165,233,0.3); }
.btn-primary:hover { background: linear-gradient(135deg, #38bdf8, #0ea5e9); box-shadow: 0 6px 16px rgba(14,165,233,0.4); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 4px 12px rgba(239,68,68,0.25); }
.btn-danger:hover { box-shadow: 0 6px 16px rgba(239,68,68,0.35); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 4px 12px rgba(16,185,129,0.25); }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: 8px; background: transparent; border: 1px solid #e2e8f0; color: #64748b; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: #f1f5f9; color: #0ea5e9; border-color: #0ea5e9; }

/* ── Form Controls ── */
.form-input { width: 100%; padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 14px; color: #1e293b; transition: border-color 0.2s, box-shadow 0.2s; background: #fff; font-family: inherit; }
.form-input:focus { outline: none; border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,0.15); }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ── POS ── */
.pos-product-card { cursor: pointer; border-radius: 12px; border: 2px solid transparent; transition: all 0.2s ease; }
.pos-product-card:hover { border-color: #0ea5e9; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(14,165,233,0.15); }
.pos-product-card.out-of-stock { opacity: 0.5; cursor: not-allowed; }
.cart-item { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 60px 20px; color: #94a3b8; }
.empty-state svg { opacity: 0.4; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: #64748b; margin-bottom: 8px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Chart container ── */
.chart-container { position: relative; height: 220px; }

/* ── Low stock highlight ── */
.row-low-stock { background: #fffbeb !important; }
.row-out-stock { background: #fef2f2 !important; }

/* ── Invoice Print Styles ── */
@media print {
  body * { visibility: hidden; }
  #invoice-print-area, #invoice-print-area * { visibility: visible; }
  #invoice-print-area { position: fixed; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
}
.invoice-a4 { width: 210mm; min-height: 297mm; margin: auto; padding: 20mm; background: #fff; font-size: 14px; }
.invoice-80mm { width: 80mm; margin: auto; padding: 8mm; background: #fff; font-size: 12px; }
.invoice-58mm { width: 58mm; margin: auto; padding: 4mm; background: #fff; font-size: 10px; }

/* ── Login page ── */
.login-bg { min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #0c4a6e 50%, #0f172a 100%); }
.login-card { background: rgba(255,255,255,0.05); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; }

/* ── Page transitions ── */
#main-content { animation: pageIn 0.2s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Topbar ── */
#topbar { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }

/* ── Split Payment ── */
.payment-tab { cursor: pointer; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; transition: all 0.2s; border: 2px solid #e2e8f0; }
.payment-tab.active { border-color: #0ea5e9; background: #e0f2fe; color: #0369a1; }

/* ── Tooltip ── */
[data-tip] { position: relative; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 100; }
