/* ========================================
   AL ROWAD ERP - Components & Utilities
   Shared across dashboard and public layouts.
   Load AFTER bootstrap + dashboard.css / landing.css.
   Uses var() fallbacks so it works with both variable sets.
   ======================================== */

/* === Text Colors (aligned with dashboard palette) === */
.text-gold { color: var(--gold, #c7a15a); }
.text-gold-dark { color: var(--gold-dark, #a67c37); }
.text-muted { color: var(--text-secondary, #6b7280); }
.text-danger { color: var(--danger, #ef4444); }
.text-success { color: var(--success, #22c55e); }
.text-info { color: var(--info, #3b82f6); }
.text-warning { color: var(--warning, #f59e0b); }
.text-primary-navy { color: var(--primary, #0d1b2a); }
.text-white-50 { color: rgba(255, 255, 255, 0.5); }
.text-white-60 { color: rgba(255, 255, 255, 0.6); }

/* === Font Sizes === */
.fs-8 { font-size: 8px; }
.fs-10 { font-size: 10px; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-22 { font-size: 22px; }
.fs-26 { font-size: 26px; }
.fs-36 { font-size: 36px; }
.fs-48 { font-size: 48px; }

/* === Font Weights === */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* === Line Heights === */
.lh-13 { line-height: 1.3; }
.lh-17 { line-height: 1.7; }
.lh-18 { line-height: 1.8; }
.lh-19 { line-height: 1.9; }
.lh-2 { line-height: 2; }

/* === Widths === */
.w-130 { width: 130px; }
.w-140 { width: 140px; }
.w-150 { width: 150px; }
.w-170 { width: 170px; }
.w-180 { width: 180px; }
.w-200 { width: 200px; }
.w-220 { width: 220px; }
.mw-520 { max-width: 520px; }
.mw-420 { max-width: 420px; }
.mw-600 { max-width: 600px; }
.mw-800 { max-width: 800px; }
.mw-820 { max-width: 820px; }
.wp-15 { width: 15%; }
.wp-20 { width: 20%; }
.wp-30 { width: 30%; }
.wp-8 { width: 8%; }
.wp-12 { width: 12%; }
.wp-40 { width: 40%; }

/* === Buttons === */
.btn-gold-solid { background: var(--gold, #c7a15a); color: #fff; }
.btn-gold-solid:hover { background: var(--gold-dark, #a67c37); color: #fff; }
.btn-primary-solid { background: var(--primary, #0d1b2a); color: #fff; }
.btn-primary-solid:hover { background: var(--primary-light, #1b2838); color: #fff; }
.btn-danger-solid { background: var(--danger, #ef4444); color: #fff; }
.btn-danger-solid:hover { opacity: 0.9; color: #fff; }

/* === Table & Cell Helpers === */
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--text-secondary, #6b7280); }
.table-scroll { overflow-x: auto; }
.table-scroll::-webkit-scrollbar { height: 6px; }
.empty-state { text-align: center; color: var(--text-secondary, #6b7280); padding: 40px; }
.empty-state-sm { text-align: center; color: var(--text-secondary, #6b7280); padding: 24px 0; }
.empty-cell { text-align: center; color: var(--text-secondary, #6b7280); padding: 32px; }

/* === Cards === */
.modal-round { border-radius: 20px; border: none; }
.card-pad { padding: 24px; }
.card-pad-md { padding: 24px 24px 16px; }

/* === Progress Bars === */
.progress-h6 { height: 6px; }
.progress-h8 { height: 8px; }
.progress-bar-fill.w-25 { width: 25%; }
.progress-bar-fill.w-30 { width: 30%; }
.progress-bar-fill.w-55 { width: 55%; }
.progress-bar-fill.w-60 { width: 60%; }
.progress-bar-fill.w-75 { width: 75%; }
.progress-bar-fill.w-85 { width: 85%; }

/* === Rank / Number Badge === */
.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(199, 161, 90, 0.1);
  color: var(--gold, #c7a15a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* === Quick Actions === */
.quick-action-icon.sm { width: 48px; height: 48px; margin-bottom: 10px; }
.quick-actions-grid.cols-2 { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 0; }

/* === Header Actions === */
.welcome-actions { display: flex; align-items: center; gap: 10px; }

/* === Stat Value Variants === */
.stat-value.sm { font-size: 22px; }

/* === Text Utilities === */
.text-monospace { font-family: monospace; }
.dir-ltr { direction: ltr; }

/* === Notifications === */
.notification-box {
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  transition: background 0.2s;
}
.notification-box.unread { background: var(--gold-10); }
.notification-title { font-size: 14px; font-weight: 600; color: var(--text); }
.notification-date { color: var(--text-secondary); }
.notification-body { font-size: 13px; color: var(--text-secondary); margin: 8px 0 0; line-height: 1.7; }
.empty-icon { font-size: 48px; color: var(--border); }

/* === Sack Stat Card === */
.sack-stat-card { background: var(--bg); border-radius: 12px; padding: 16px; text-align: center; }

/* === Sticky & Borders === */
.sticky-panel { position: sticky; top: 90px; }
.border-line { border-bottom: 1px solid var(--border); }

/* === Ellipsis === */
.ellipsis-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === Pagination === */
.pagination-btn.disabled { opacity: .4; cursor: default; }

/* === Landing layout helpers === */
.logo-img { height: 40px; }
.text-on-surface-variant { color: var(--on-surface-variant); }

/* === Customer Avatar === */
.customer-avatar.sm {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

/* === Profile Avatar === */
.avatar-96 {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold, #c7a15a), var(--gold-dark, #a67c37));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  margin: 0 auto 16px;
}

/* === Pulse Dot (landing) === */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold, #c7a15a);
  display: inline-block;
  flex-shrink: 0;
}

/* === Landing Badges on cards === */
.badge-live {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}
.badge-live-dark {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

/* === Landing dark glass === */
.glass-card-dark {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}
.sack-stat-dark {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
}
.sack-stat-dark .stat-value { color: var(--gold, #c7a15a); }
.sack-stat-dark small { color: rgba(255, 255, 255, 0.6); }

/* === Landing CTA / misc === */
.cta-card-text { max-width: 520px; font-size: 16px; }
.section-divider-inline { margin: 0 0 32px; }
.hero-title { color: var(--navy, #0d1b2a); line-height: 1.3; }

/* === Dark progress (landing tracking card) === */
.progress-dark { height: 8px; background: rgba(255, 255, 255, 0.1); }

/* === Invoice item picker === */
.inv-item-picker { position: relative; min-width: 220px; }
.inv-item-search.inv-item-selected { border-color: var(--gold, #c7a15a); background: rgba(199, 161, 90, 0.06); }
.inv-item-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1080;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(13, 27, 42, 0.12);
  margin-top: 2px;
  display: none;
}
.inv-item-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
  text-align: right;
  cursor: pointer;
}
.inv-item-result:last-child { border-bottom: none; }
.inv-item-result:hover,
.inv-item-result.active { background: rgba(199, 161, 90, 0.1); }
.inv-item-result-name { font-size: 13px; font-weight: 600; color: var(--navy, #0d1b2a); }
.inv-item-result-meta {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}
.inv-item-empty { padding: 10px 12px; font-size: 13px; color: var(--text-secondary, #6b7280); text-align: center; }

/* === Invoice barcode scanner === */
.inv-item-picker .inv-barcode-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding-inline: 10px;
  z-index: 2;
}
.inv-item-picker .input-group-sm .form-control {
  min-width: 120px;
}
.barcode-scan-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--navy, #0d1b2a);
  min-height: 260px;
}
.barcode-video {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}
.barcode-scan-line {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 5%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold, #c7a15a), transparent);
  box-shadow: 0 0 8px rgba(199, 161, 90, 0.8);
  animation: barcode-scan 2.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes barcode-scan {
  0% { top: 5%; }
  50% { top: 92%; }
  100% { top: 5%; }
}
.barcode-status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 12px;
  background: rgba(13, 27, 42, 0.75);
  color: #fff;
  font-size: 13px;
  text-align: center;
}
.barcode-manual-hint { font-size: 13px; color: var(--text-secondary, #6b7280); }

/* === Detail grid (model show page) === */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 24px;
  padding: 4px 2px;
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.detail-item-full {
  grid-column: 1 / -1;
}
.detail-label {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  font-weight: 600;
}

.link-gold {
  color: var(--gold, #c7a15a);
}
.link-gold:hover {
  color: var(--gold-dark, #b18d4b);
  text-decoration: underline;
}

/* === Toast Notifications (custom-toast used by dashboard.js showToast) === */
.custom-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 440px;
  width: max-content;
  padding: 12px 16px;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e5e7eb);
  border-right-width: 4px;
  border-right-style: solid;
  border-radius: var(--radius-xs, 12px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.custom-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.custom-toast-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.custom-toast-msg {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #111827);
  line-height: 1.5;
}
