/* ERP System (fweb) — نماذج الإدخال: شكل موحّد ومنظم لكل الشاشات */

/* الشبكة: أعمدة بتتظبط على عرض الشاشة، والحقول متساوية ومتراصة */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 1rem 1.25rem;
  align-items: start;
}
.form-grid > .form-group { margin-bottom: 0; min-width: 0; }
.form-grid > .form-group.full,
.form-grid > .section-title,
.form-grid > h4 { grid-column: 1 / -1; }
.form-grid > .form-group.wide { grid-column: span 2; }

/* العنوان فوق كل حقل: نفس الارتفاع علشان الخانات تيجي على خط واحد */
.form-group > label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.35rem;
  margin-bottom: 0.4rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: #334155;
}
.form-group > label .req { color: #dc2626; font-weight: 800; }

/* الخانات */
.form-control {
  height: 44px;
  padding: 0.55rem 0.85rem;
  border: 1.5px solid #dbe3ee;
  border-radius: 10px;
  font-size: 0.92rem;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.form-control:hover { border-color: #c3cfdd; }
.form-control:focus { border-color: var(--c1); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15); outline: none; }
.form-control[readonly], .form-control:disabled { background: #f1f5f9; color: #475569; cursor: default; }
textarea.form-control { height: auto; min-height: 90px; }
input[type="file"].form-control { height: auto; padding: 0.5rem 0.6rem; background: #f8fafc; }
select.form-control { cursor: pointer; }
/* الأرقام والأكواد: بتتكتب شمال ليمين ومحاذية يمين زي باقي الشاشة */
input[type="number"].form-control,
input[dir="ltr"].form-control { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }

/* الشرح تحت الحقل */
.form-hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.76rem;
  line-height: 1.55;
  color: #64748b;
  font-weight: 500;
}
.form-group > .form-hint::before {
  content: "\f05a";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-inline-end: 0.3rem;
  color: #94a3b8;
  font-size: 0.72rem;
}

/* اختيار (checkbox): كارت بيتلون لما يتعلّم */
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--c1); cursor: pointer; flex-shrink: 0; }
.form-grid > .form-group:has(> label > input[type="checkbox"]) { align-self: end; }
.form-group > label:has(> input[type="checkbox"]) {
  min-height: 44px;
  margin: 0;
  padding: 0.5rem 0.85rem;
  border: 1.5px solid #dbe3ee;
  border-radius: 10px;
  background: #f8fafc;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.form-group > label:has(> input[type="checkbox"]:checked) { border-color: var(--c1); background: #f0f9ff; color: #0369a1; }
.check-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.check-row label {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.75rem; border: 1.5px solid #dbe3ee;
  border-radius: 999px; background: #f8fafc; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all .15s;
}
.check-row label:has(input:checked) { border-color: var(--c1); background: #f0f9ff; color: #0369a1; }

/* أقسام النموذج */
.form-section {
  background: #fff;
  border: 1px solid #e5eaf1;
  border-radius: 14px;
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 1rem;
}
.form-section-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.95rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 0.93rem;
  font-weight: 800;
  color: #0f172a;
}
.form-section-title > i {
  width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e0f2fe, #ede9fe); color: var(--c1); font-size: 0.85rem;
}
.form-section-title small { margin-inline-start: auto; color: #64748b; font-weight: 600; font-size: 0.76rem; }
.form-grid > .section-title { margin: 0.5rem 0 0; padding-bottom: 0.45rem; border-bottom: 1px dashed #e2e8f0; font-size: 0.93rem; }

/* أزرار الحفظ: شريط ثابت تحت النموذج */
.form-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  position: sticky; bottom: 0; z-index: 5;
  margin-top: 0.75rem; padding: 0.85rem 0 0.25rem;
  background: linear-gradient(to top, #fff 70%, rgba(255, 255, 255, 0));
}
.panel-body form > .btn, .panel-body form > a.btn { margin-top: 1.1rem; }

/* شريط البحث والفلاتر بنفس ارتفاع الحقول */
.search-bar .form-control, .search-bar .btn { height: 44px; }
.search-bar .btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; }

/* صورة/لوجو */
.img-pick { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.img-pick img { max-height: 96px; border-radius: 10px; border: 1px solid #e2e8f0; padding: 3px; background: #fff; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid > .form-group.wide { grid-column: auto; }
  .form-section { padding: 0.85rem; }
}
