/* MVC layer — aligns Razor markup with original HTML demo (style.css) without Bootstrap */

.d-none { display: none !important; }

/* Demo uses .table-wrapper; Razor historically used Bootstrap .table-responsive */
.table-responsive {
  overflow-x: auto;
}

/* Page title row: match demo .page-header while keeping Razor .page-head + h2.page-title */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-head h2.page-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.3px;
  color: var(--text);
}
.page-head h2.page-title > i:first-of-type {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 19px;
  box-shadow: 0 4px 10px rgba(13, 59, 102, 0.25);
  flex-shrink: 0;
}

/* --- Minimal layout utilities (replacing Bootstrap-only classes in views) --- */
.d-flex { display: flex; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }
.d-block { display: block; }
.flex-wrap { flex-wrap: wrap; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-end { text-align: end; }
.text-primary { color: var(--primary); }
.small { font-size: 12.5px; }
.fw-semibold { font-weight: 600; }
.img-fluid { max-width: 100%; height: auto; }
.rounded { border-radius: var(--radius-sm); }
.border { border: 1px solid var(--border); }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.border-0 { border: none !important; }
.shadow-none { box-shadow: none !important; }
.p-4 { padding: 18px; }
.px-0 { padding-inline: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.pb-0 { padding-bottom: 0 !important; }
.py-2 { padding-block: 8px; }
.p-2 { padding: 8px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 18px !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 18px !important; }
.m-0 { margin: 0 !important; }
.ps-3 { padding-inline-start: 1rem; }
.w-100 { width: 100%; }
.h6 { font-size: 14px; font-weight: 700; margin: 0; }

/* display:none below md, visible md+ (Bootstrap d-none d-md-flex) */
.d-md-flex { display: none !important; }
.d-md-inline-flex { display: none !important; }
@media (min-width: 768px) {
  .d-md-flex { display: flex !important; }
  .d-md-inline-flex { display: inline-flex !important; }
}

/* Bootstrap-like grid for legacy scaffold forms */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-inline: -10px;
}
.row > [class*="col-"] {
  padding-inline: 10px;
  margin-bottom: 12px;
}
.g-3 { gap: 0; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-md-6 { flex: 0 0 100%; max-width: 100%; }
@media (min-width: 768px) {
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
}
.col-md-3 { flex: 0 0 100%; max-width: 100%; }
@media (min-width: 768px) {
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
}

/* Form controls used outside .form-group (scaffold views / login) */
label.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

/* Stronger labels on main app forms (demo uses ~600; product requirement: bold captions) */
.page-content .form-group > label:first-child {
  font-weight: 700;
}
.form-control,
.form-select {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

/* Alerts (no Bootstrap JS): dismiss control */
.alert-dismissible {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.alert-dismiss-btn {
  position: static;
  flex-shrink: 0;
  margin-top: 2px;
}

/* User dropdown logout — match demo anchor rows */
.user-dropdown form {
  margin: 0;
}
.user-dropdown button.user-dropdown-submit {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: right;
}
.user-dropdown button.user-dropdown-submit:hover {
  background: var(--primary-50);
  color: var(--primary);
}
.user-dropdown button.user-dropdown-submit i {
  width: 16px;
  color: var(--text-muted);
}
.user-dropdown button.user-dropdown-submit:hover i {
  color: var(--primary);
}

/* Bootstrap badge fallback (avoid purple Bootstrap badge) */
.badge.bg-secondary {
  background: var(--neutral-bg);
  color: var(--text-muted);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
}

/* ========= Validation (ASP.NET Core MVC + jQuery unobtrusive) ========= */
.validation-summary-errors {
  color: #dc3545;
  background: #f8d7da;
  border: 1px solid #f5c2c7;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 15px;
  text-align: start;
}
.validation-summary-errors:has(ul)::before {
  content: "يرجى تصحيح الأخطاء التالية:";
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.validation-summary-errors ul {
  margin: 0;
  padding-inline-start: 1.25rem;
  list-style: disc;
}
.validation-summary-errors li {
  margin-bottom: 4px;
  font-size: 0.9rem;
}
.validation-summary-errors li:last-child {
  margin-bottom: 0;
}
.validation-summary-valid {
  display: none !important;
}

.field-validation-error {
  color: #dc3545 !important;
  font-size: 0.9rem;
  margin-top: 6px;
  margin-bottom: 2px;
  display: block;
  font-weight: 600;
  line-height: 1.35;
}
.field-validation-error::before {
  content: "\f071";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-inline-end: 6px;
  font-size: 0.85em;
  opacity: 0.9;
}
.field-validation-valid {
  display: none !important;
}

.input-validation-error,
.input-validation-error:focus {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}
select.input-validation-error,
textarea.input-validation-error {
  border-color: #dc3545 !important;
}

.form-group .field-validation-error + .form-text,
.form-group .field-validation-error {
  max-width: 100%;
}

/* Required marker when browser / tag helpers emit [required] */
.form-group:has(> input[required]) > label:first-of-type::after,
.form-group:has(> select[required]) > label:first-of-type::after,
.form-group:has(> textarea[required]) > label:first-of-type::after {
  content: " *";
  color: #dc3545;
  font-weight: 800;
}
