/* ============================================================
   INVENTRA - assets/css/app.css
   ============================================================ */

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;
}

/* ---- SIDEBAR ---- */
.sidebar { min-height: 100vh; }
.sidebar.collapsed { width: 0; overflow: hidden; }

/* ---- CARDS ---- */
.card {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  padding: 1.5rem;
}

/* ---- STAT CARDS ---- */
.stat-card {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 3rem; height: 3rem;
  border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}

/* ---- TABLES ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #f9fafb;
  padding: 0.75rem 1rem;
  text-align: left; font-size: 0.75rem;
  font-weight: 600; text-transform: uppercase;
  color: #6b7280; letter-spacing: 0.05em;
  border-bottom: 1px solid #e5e7eb;
}
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem; color: #374151;
}
.data-table tr:hover td { background: #fafafa; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.375rem; padding: 0.5rem 1rem;
  border-radius: 0.5rem; font-size: 0.875rem;
  font-weight: 500; cursor: pointer;
  border: none; transition: all 0.15s ease;
  text-decoration: none;
}
.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: #4338ca; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-success:hover  { background: #059669; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover   { background: #dc2626; }
.btn-warning  { background: var(--warning);  color: #fff; }
.btn-warning:hover  { background: #d97706; }
.btn-secondary{ background: #f3f4f6; color: #374151; }
.btn-secondary:hover{ background: #e5e7eb; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ---- FORMS ---- */
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #374151;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-label {
  display: block; margin-bottom: 0.25rem;
  font-size: 0.875rem; font-weight: 500; color: #374151;
}
.form-group { margin-bottom: 1rem; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px; font-size: 0.75rem; font-weight: 500;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: #f3f4f6; color: #374151; }

/* ---- POS ---- */
.pos-layout { display: grid; grid-template-columns: 1fr 380px; height: calc(100vh - 120px); gap: 1rem; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; overflow-y: auto; }
.product-card {
  background: #fff; border-radius: 0.75rem;
  border: 2px solid transparent;
  padding: 0.75rem; cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.product-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(79,70,229,0.15); }
.cart-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 0; border-bottom: 1px solid #f3f4f6;
}

/* ---- THERMAL RECEIPT ---- */
@media print {
  body * { visibility: hidden; }
  #receipt, #receipt * { visibility: visible; }
  #receipt { position: fixed; left: 0; top: 0; width: 80mm; margin: 0; padding: 0; }
  .no-print { display: none !important; }
}
#receipt {
  width: 80mm; font-family: 'Courier New', monospace;
  font-size: 12px; line-height: 1.4;
}
#receipt hr { border: none; border-top: 1px dashed #000; margin: 6px 0; }
#receipt .receipt-header { text-align: center; margin-bottom: 8px; }
#receipt table { width: 100%; border-collapse: collapse; }
#receipt th, #receipt td { font-size: 11px; }

/* ---- LOW STOCK ---- */
.low-stock-row td { background: #fff8f8 !important; }
.out-of-stock-row td { background: #fff0f0 !important; opacity: 0.7; }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 0.25rem; list-style: none; padding: 0; margin: 1rem 0; }
.pagination li a, .pagination li.active {
  display: block; padding: 0.375rem 0.75rem;
  border-radius: 0.375rem; font-size: 0.875rem;
  text-decoration: none; color: #374151;
  background: #fff; border: 1px solid #e5e7eb;
}
.pagination li.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination li a:hover { background: #f3f4f6; }

/* ---- ALERTS ---- */
.alert {
  padding: 0.875rem 1rem;
  border-radius: 0.5rem; margin-bottom: 1rem;
  font-size: 0.875rem; border-left: 4px solid;
}
.alert-danger  { background: #fef2f2; border-color: var(--danger);  color: #991b1b; }
.alert-success { background: #f0fdf4; border-color: var(--success); color: #065f46; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
  background: #fff; border-radius: 1rem; padding: 2rem;
  width: 90%; max-width: 540px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  max-height: 90vh; overflow-y: auto;
}

/* ---- OFFLINE BANNER ---- */
#offlineBanner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #dc2626; color: #fff; text-align: center;
  padding: 0.5rem; font-size: 0.875rem; z-index: 9999;
  display: none;
}

/* ---- RTL support ---- */
[dir="rtl"] .sidebar { order: 1; }
[dir="rtl"] .data-table th, [dir="rtl"] .data-table td { text-align: right; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .pos-layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 100; transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
}
