/* ================================================= */
/* Invoices List View Styles                         */
/* ================================================= */

/* ألوان حالات الشحن السبع */
:root {
  --st-pickup: #64748b;       
  --st-pickup-bg: #f1f5f9;
  --st-preparing: #d97706;    
  --st-preparing-bg: #fffbeb;
  --st-ready: #6366f1;        
  --st-ready-bg: #eef2ff;
  --st-ontheway: #0284c7;     
  --st-ontheway-bg: #f0f9ff;
  --st-delivered: #0d9488;    
  --st-delivered-bg: #f0fdfa;
  --st-settled: #059669;      
  --st-settled-bg: #ecfdf5;
  --st-failed: #dc2626;       
  --st-failed-bg: #fef2f2;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --blue: #2563eb;
  --radius-sm: 8px;
  --radius-md: 12px;
}

.inv-app-header {
  background: #ffffff;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 80px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inv-header-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inv-search-input-wrap {
  flex: 1;
  position: relative;
}

.inv-search-input-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 34px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #f8fafc;
  outline: none;
  transition: all 0.2s;
}

.inv-search-input-wrap input:focus {
  border-color: var(--primary);
  background-color: #ffffff;
}

.inv-search-input-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.btn-filter-icon {
  width: 40px;
  height: 40px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.btn-filter-icon:active {
  background: #e2e8f0;
}

.btn-new-invoice {
  height: 40px;
  padding: 0 12px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.inv-filter-chips-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.inv-filter-chips-scroll::-webkit-scrollbar {
  display: none;
}

.inv-filter-chip {
  padding: 4px 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.inv-filter-chip.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.invoices-list-body {
  padding: 10px 12px 30px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compact-invoice-tile {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  border-right: 5px solid var(--tile-status-color);
  box-shadow: none !important;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s;
}

.compact-invoice-tile:active {
  transform: scale(0.99);
  background-color: #f1f5f9;
}

.st-pickup-tile { --tile-status-color: var(--st-pickup); }
.st-preparing-tile { --tile-status-color: var(--st-preparing); }
.st-ready-tile { --tile-status-color: var(--st-ready); }
.st-ontheway-tile { --tile-status-color: var(--st-ontheway); }
.st-delivered-tile { --tile-status-color: var(--st-delivered); }
.st-settled-tile { --tile-status-color: var(--st-settled); }
.st-failed-tile { --tile-status-color: var(--st-failed); }
.st-default-tile { --tile-status-color: #94a3b8; } /* default fallback */

.tile-line-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.client-identity-group {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}

.client-name-text {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-type-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.client-type-tag.wholesale {
  background: #eff6ff;
  color: var(--blue);
  border-color: #bfdbfe;
}

.shipping-status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.shipping-status-pill.st-pickup { background: var(--st-pickup-bg); color: var(--st-pickup); border: 1px solid #cbd5e1; }
.shipping-status-pill.st-preparing { background: var(--st-preparing-bg); color: var(--st-preparing); border: 1px solid #fde68a; }
.shipping-status-pill.st-ready { background: var(--st-ready-bg); color: var(--st-ready); border: 1px solid #c7d2fe; }
.shipping-status-pill.st-ontheway { background: var(--st-ontheway-bg); color: var(--st-ontheway); border: 1px solid #bae6fd; }
.shipping-status-pill.st-delivered { background: var(--st-delivered-bg); color: var(--st-delivered); border: 1px solid #99f6e4; }
.shipping-status-pill.st-settled { background: var(--st-settled-bg); color: var(--st-settled); border: 1px solid #a7f3d0; }
.shipping-status-pill.st-failed { background: var(--st-failed-bg); color: var(--st-failed); border: 1px solid #fecdd3; }
.shipping-status-pill.st-default { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }

.tile-line-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
}

.invoice-meta-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-weight: 600;
}

.invoice-id-code {
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.meta-separator {
  color: #cbd5e1;
}

.financials-summary-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.net-amount-val {
  font-size: 14px;
  font-weight: 900;
  color: var(--primary);
}

.debt-badge-pill {
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fecdd3;
}

.paid-badge-pill {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
}

/* ================================================= */
/* Smart Detail View Styles                          */
/* ================================================= */
#invoiceSmartDetailView {
  display: none;
  flex-direction: column;
  width: 100%;
  background: #f8fafc;
  padding-bottom: 95px;
}

.smart-header {
  background: #ffffff;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.smart-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-back-smart {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  cursor: pointer;
}

.smart-header-titles h1 {
  font-size: 15px;
  font-weight: 800;
}

.smart-header-titles span {
  font-size: 11px;
  color: var(--text-muted);
}

.smart-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.smart-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 14px;
}

.client-details-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.client-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.client-data-label {
  color: var(--text-muted);
  font-weight: 600;
}

.client-data-val {
  font-weight: 800;
  color: var(--text-main);
}

.customer-type-badge {
  background: #eff6ff;
  color: var(--blue);
  border: 1px solid #bfdbfe;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.actions-six-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 6px 2px 6px;
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
}

.btn-six-action {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-six-action:active {
  transform: scale(0.92);
}

.btn-six-action.whatsapp { background: #f0fdf4; border-color: #dcfce7; color: #16a34a; }
.btn-six-action.print { background: #f0f9ff; border-color: #e0f2fe; color: #0284c7; }
.btn-six-action.shipping { background: #fffbeb; border-color: #fef3c7; color: #d97706; }
.btn-six-action.edit { background: #eff6ff; border-color: #dbeafe; color: #2563eb; }
.btn-six-action.return { background: #f5f3ff; border-color: #ede9fe; color: #7c3aed; }
.btn-six-action.delete { background: #fef2f2; border-color: #fee2e2; color: #dc2626; }

.smart-item-row {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 6px;
}

.smart-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  font-weight: 700;
}

.smart-item-math-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: 6px;
}

.smart-finance-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.smart-fin-row {
  display: flex;
  justify-content: space-between;
}

.smart-total-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
  font-size: 15px;
  font-weight: 800;
}

.smart-total-val {
  font-size: 20px;
  font-weight: 900;
  color: var(--primary);
}

.smart-sticky-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 10px 14px 20px 14px;
  z-index: 50;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.btn-smart-primary {
  width: 100%;
  height: 46px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
