/* ================================================= */
/* Deboura ERP Mobile - E-Commerce Stylesheet        */
/* Matches docs/ecommerce.html 100%                  */
/* ================================================= */

:root {
  /* ألوان حالات التجارة الإلكترونية */
  --st-ready: #059669;        /* جاهز للترحيل */
  --st-ready-bg: #ecfdf5;
  --st-ready-bdr: #a7f3d0;

  --st-review: #d97706;       /* يحتاج مراجعة */
  --st-review-bg: #fffbeb;
  --st-review-bdr: #fde68a;

  --st-rejected: #dc2626;     /* مرفوض / أخطاء */
  --st-rejected-bg: #fef2f2;
  --st-rejected-bdr: #fecdd3;

  --st-posted: #0284c7;       /* تم الترحيل */
  --st-posted-bg: #f0f9ff;
  --st-posted-bdr: #bae6fd;
}

/* ================================================= */
/* 1. رأس الصفحة، زر المنصات، والبحث                 */
/* ================================================= */
.ecommerce-app-header {
  background: #ffffff;
  padding: 10px 14px 10px 14px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  position: sticky;
  top: 80px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.search-box {
  flex: 1;
  position: relative;
  min-width: 0;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  outline: none;
  transition: all 0.15s;
}

.search-box input:focus {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

.search-box .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.btn-sync-icon {
  width: 38px;
  height: 38px;
  background: #f8fafc;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.btn-sync-icon:active {
  transform: scale(0.95);
  background: #f1f5f9;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

/* مصفوفة أزرار الفلاتر الستة - مقسمة بالتساوي 100% عبر عرض الصفحة (3 أعمدة متساوية) */
.filter-matrix-card {
  background: #edf2f7;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
}

.filter-matrix-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.matrix-btn {
  height: 34px;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 2px;
  white-space: nowrap;
  transition: all 0.18s ease;
  user-select: none;
  box-sizing: border-box;
}

/* الزر النشط بنمط الكارت الأبيض البارز والمرفوع */
.matrix-btn.active {
  background: #ffffff;
  color: #0f172a;
  font-weight: 900;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.09), 0 1px 2px rgba(0, 0, 0, 0.04);
  transform: translateY(-0.5px);
}

/* ================================================= */
/* 2. قائمة كروت الطلبات (2-Line Tiles وبدون Shadow) */
/* ================================================= */
.orders-list-body {
  padding: 10px 12px 100px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compact-order-tile {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  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: background-color 0.15s, transform 0.1s;
}

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

.st-ready-tile    { --tile-status-color: var(--st-ready); }
.st-review-tile   { --tile-status-color: var(--st-review); }
.st-rejected-tile { --tile-status-color: var(--st-rejected); }
.st-posted-tile   { --tile-status-color: var(--st-posted); }

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

.channel-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.channel-pill.whatsapp {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.channel-pill.web {
  background: #f0fdfa;
  color: #0d9488;
  border: 1px solid #99f6e4;
}

.order-status-pill {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.order-status-pill.ready { background: var(--st-ready-bg); color: var(--st-ready); border: 1px solid var(--st-ready-bdr); }
.order-status-pill.review { background: var(--st-review-bg); color: var(--st-review); border: 1px solid var(--st-review-bdr); }
.order-status-pill.rejected { background: var(--st-rejected-bg); color: var(--st-rejected); border: 1px solid var(--st-rejected-bdr); }
.order-status-pill.posted { background: var(--st-posted-bg); color: var(--st-posted); border: 1px solid var(--st-posted-bdr); }

.meta-order-info {
  display: flex;
  align-items: center;
  gap: 5px;
}

.order-code {
  font-family: monospace;
  font-size: 12px;
  font-weight: 800;
  color: #1e293b;
}

.order-amount-tag {
  font-size: 13.5px;
  font-weight: 900;
  color: #059669;
}

.order-amount-tag.rejected {
  color: #dc2626;
}

/* ================================================= */
/* 3. نافذة مراجعة وتأكيد الطلب المنبثقة (Order Modal) */
/* ================================================= */
.order-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  display: none;
  justify-content: center;
  align-items: flex-end;
  backdrop-filter: blur(2px);
}

.order-modal-backdrop.open { display: flex; }

.order-sheet {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: orderSlideUp 0.25s ease-out;
  overflow: hidden;
  position: relative;
}

@keyframes orderSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* كرت العميل */
.order-client-card {
  background: #f8fafc;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
}

.order-client-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-client-header strong {
  font-size: 13.5px;
  color: var(--text-main, #0f172a);
}

/* بنر التنبيه إذا كان الطلب به مشكلة */
.desktop-warning-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.desktop-warning-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #c2410c;
  display: flex;
  align-items: center;
  gap: 6px;
}

.desktop-warning-msg {
  font-size: 11.5px;
  color: #9a3412;
  line-height: 1.4;
  font-weight: 600;
}

/* قائمة التحقق والتطابق */
.check-list-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 11.5px;
}

.check-item {
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}

.check-item.valid { color: #059669; }
.check-item.invalid { color: #dc2626; background: #fff5f5; border-color: #fed7d7; }

/* تفاصيل الأصناف */
.order-items-box {
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
}

.order-item-row {
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}

.order-item-row:last-child { border-bottom: none; }

.order-item-name h4 {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main, #0f172a);
}

.order-item-name span {
  font-size: 11px;
  color: var(--text-muted, #64748b);
}

.order-item-val {
  text-align: left;
  font-weight: 800;
  color: var(--text-main, #0f172a);
}

/* ملخص الحساب الصغير */
.order-fin-summary {
  background: #1e293b;
  color: #ffffff;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
}

.order-fin-summary strong {
  font-size: 16px;
  color: #34d399;
}

.btn-approve-order {
  flex: 1.5;
  height: 44px;
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-approve-order:active { background: #047857; }

.btn-reject-order {
  flex: 1;
  height: 44px;
  background: #fef2f2;
  border: 1px solid #fecdd3;
  color: #dc2626;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

/* الزر المعطل عند وجود مشكلة */
.btn-disabled-desktop-req {
  flex: 1;
  height: 44px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #94a3b8;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: not-allowed;
}

/* ================================================= */
/* 4. نافذة المنصات المتصلة المنبثقة (Platforms Modal)*/
/* ================================================= */
.platforms-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 120;
  display: none;
  justify-content: center;
  align-items: flex-end;
}

.platforms-modal-backdrop.open { display: flex; }

.platforms-sheet {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: sheetSlideUp 0.25s ease-out;
  max-height: 80vh;
  overflow-y: auto;
}

.platforms-sheet-title {
  font-size: 15px;
  font-weight: 900;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  padding-bottom: 10px;
}

.platform-card-item {
  background: #f8fafc;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.platform-info-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.platform-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.platform-icon-circle.wa { background: #f0fdf4; color: #16a34a; }
.platform-icon-circle.web { background: #f0fdfa; color: #0d9488; }

.platform-text h4 {
  font-size: 13.5px;
  font-weight: 800;
}

.platform-text span {
  font-size: 11px;
  color: var(--text-muted, #64748b);
}

.platform-status-badge {
  font-size: 11px;
  font-weight: 800;
  color: #16a34a;
  background: #dcfce7;
  padding: 3px 8px;
  border-radius: 12px;
}

.desktop-note-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px;
  font-size: 11px;
  color: #1e40af;
  line-height: 1.4;
  font-weight: 600;
}
