/* ============================================================
   نظام الصيانة — تصميم احترافي أنيق (النسخة الكاملة 5-6-7)
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, 'Noto Kufi Arabic', Arial, sans-serif; }

:root {
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --primary-light: #e3f2fd;
  --accent: #00acc1;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #16283c;
  --muted: #64748b;
  --danger: #dc3545;
  --success: #16a34a;
  --warning: #f59e0b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(22,40,60,.08);
  --shadow-md: 0 4px 16px rgba(22,40,60,.10);
  --shadow-lg: 0 12px 32px rgba(13,71,161,.16);
  --radius: 16px;
}

body { background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }

/* ===== الشاشات ===== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

#loading-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0d47a1 0%, #1565c0 50%, #00acc1 100%);
  color: #fff;
}
#loading-screen p { margin-top: 14px; font-size: 15px; opacity: .9; letter-spacing: .5px; }
.loader {
  width: 52px; height: 52px; border: 4px solid rgba(255,255,255,.25);
  border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== بطاقات الدخول والتسجيل ===== */
.auth-card {
  max-width: 420px; margin: 7vh auto; background: var(--card);
  border-radius: 24px; padding: 36px 30px; box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,.6);
  animation: fadeUp .5s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-card.center { text-align: center; }
.logo-area { text-align: center; margin-bottom: 26px; }
.logo-icon {
  font-size: 48px; margin-bottom: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  width: 84px; height: 84px; line-height: 84px; border-radius: 26px;
  display: inline-block; box-shadow: var(--shadow-md);
}
.logo-area h1 { font-size: 23px; color: var(--text); font-weight: 700; }
.subtitle { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* ===== الحقول ===== */
.input-group { margin-bottom: 18px; }
.input-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--muted); margin-bottom: 7px;
}
.input-group input, .input-group select, .input-group textarea {
  width: 100%; padding: 13px 16px; border: 1.8px solid var(--border);
  border-radius: 14px; font-size: 16px; background: #f8fafc;
  transition: all .25s ease; color: var(--text);
}
.input-group textarea { resize: vertical; min-height: 100px; }
.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px rgba(21,101,192,.10);
}
.hint-text { color: var(--muted); font-size: 12.5px; margin-top: 6px; display: block; }

.error-msg {
  background: #fef2f2; color: var(--danger); border-radius: 12px;
  padding: 11px 14px; font-size: 13.5px; margin-top: 12px;
  border: 1px solid #fecaca; animation: fadeUp .3s ease;
}
.success-icon { font-size: 56px; margin-bottom: 12px; }

/* ===== الأزرار ===== */
.btn {
  width: 100%; padding: 14px; border: none; border-radius: 14px;
  font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 10px;
  transition: all .25s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #1976d2);
  color: #fff; box-shadow: 0 6px 18px rgba(21,101,192,.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(21,101,192,.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: #a5c4e8; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-outline { background: #fff; color: var(--primary); border: 1.8px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-link { background: none; color: var(--primary); font-size: 14px; font-weight: 600; margin-top: 6px; }
.divider { text-align: center; margin: 18px 0 6px; color: var(--muted); font-size: 13px; }

/* ===== الشريط العلوي ===== */
.top-bar {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #1976d2 100%);
  color: #fff; padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-md);
}
.top-bar-title { display: flex; align-items: center; gap: 12px; }
.logo-small {
  font-size: 26px; background: rgba(255,255,255,.18); width: 46px; height: 46px;
  border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
}
.top-bar-title strong { display: block; font-size: 15.5px; letter-spacing: .3px; }
.top-bar-title small { font-size: 11.5px; opacity: .88; }
.btn-logout {
  background: rgba(255,255,255,.15); border: none; color: #fff; font-size: 19px;
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer; transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.28); }

/* ===== المحتوى ===== */
#main-content { padding: 20px 16px 90px; max-width: 940px; margin: 0 auto; }
.page-container { max-width: 640px; margin: 0 auto; padding-bottom: 40px; }
.page-header {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 4px; font-size: 18px; font-weight: 700;
}
.btn-back {
  background: #fff; border: 1.5px solid var(--border); width: 42px; height: 42px;
  border-radius: 13px; font-size: 19px; cursor: pointer; color: var(--text);
  box-shadow: var(--shadow-sm); transition: all .2s;
}
.btn-back:hover { background: var(--primary-light); border-color: var(--primary); }

.card {
  background: var(--card); border-radius: var(--radius); padding: 22px;
  margin-bottom: 16px; box-shadow: var(--shadow-sm); border: 1px solid #f1f5f9;
}

.section-title {
  font-size: 16.5px; font-weight: 700; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

/* ===== الإحصائيات ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 14px; margin-bottom: 20px; }
.stat-box {
  background: var(--card); border-radius: 18px; padding: 20px; text-align: center;
  box-shadow: var(--shadow-sm); border: 1px solid #f1f5f9;
  transition: transform .2s, box-shadow .2s; position: relative; overflow: hidden;
}
.stat-box::before {
  content: ''; position: absolute; top: 0; right: 0; left: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.stat-box:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-num { font-size: 34px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 5px; font-weight: 600; }

/* ===== صفوف المستخدمين والطلبات ===== */
.user-row, .request-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px; border: 1px solid var(--border); border-radius: 14px;
  margin-bottom: 11px; background: #fff; transition: all .2s;
}
.user-row:hover, .request-row:hover { border-color: #bfdbfe; box-shadow: var(--shadow-sm); }
.u-info { flex: 1; min-width: 0; }
.u-name { font-weight: 700; font-size: 14.5px; }
.u-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.7; }

/* ===== الشارات ===== */
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge.pending  { background: #fef9c3; color: #854d0e; }
.badge.active   { background: #dcfce7; color: #166534; }
.badge.disabled { background: #fee2e2; color: #991b1b; }
.badge.admin    { background: #dbeafe; color: #1e40af; }
.badge.tech     { background: #ede9fe; color: #6d28d9; }
.badge.new      { background: #fef9c3; color: #854d0e; }
.badge.seen     { background: #dcfce7; color: #166534; }
.badge.working  { background: #dbeafe; color: #1e40af; }
.badge.done     { background: #dcfce7; color: #166534; }
.badge.parts    { background: #e0f2fe; color: #075985; }
.badge.referred { background: #ede9fe; color: #6d28d9; }
.badge.failed   { background: #fee2e2; color: #991b1b; }
.badge.critical { background: #fee2e2; color: #991b1b; }
.badge.high     { background: #ffedd5; color: #9a3412; }
.badge.normal   { background: #dcfce7; color: #166534; }

select.role-select {
  padding: 7px 10px; border-radius: 10px; border: 1.5px solid var(--border);
  font-size: 12.5px; background: #f8fafc; color: var(--text);
}

/* ===== أزرار صغيرة ===== */
.btn-sm {
  padding: 8px 15px; border: none; border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: all .2s;
}
.btn-green { background: var(--success); color: #fff; }
.btn-green:hover { filter: brightness(1.08); }
.btn-red { background: var(--danger); color: #fff; }
.btn-red:hover { filter: brightness(1.08); }
.btn-gray { background: #64748b; color: #fff; }
.btn-blue { background: var(--primary); color: #fff; }

/* ===== مجموعة الأولويات ===== */
.priority-group { display: flex; gap: 10px; }
.priority-option {
  flex: 1; padding: 12px 8px; text-align: center; border: 1.8px solid var(--border);
  border-radius: 13px; cursor: pointer; font-size: 14px; font-weight: 600;
  background: #f8fafc; transition: all .2s; user-select: none;
}
.priority-option:hover { border-color: var(--primary); }
.priority-option.selected {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary-dark); box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}

/* ===== رفع الصور ومعاينتها ===== */
.file-input {
  width: 100%; padding: 12px; border: 2px dashed var(--border); border-radius: 14px;
  background: #f8fafc; cursor: pointer; font-size: 14px; color: var(--muted);
}
.file-input:hover { border-color: var(--primary); color: var(--primary); }
.image-preview { position: relative; margin-top: 12px; }
.image-preview img {
  width: 100%; max-height: 240px; object-fit: cover;
  border-radius: 14px; border: 1px solid var(--border);
}
.image-preview .btn-x {
  position: absolute; top: 10px; left: 10px; background: rgba(220,38,38,.92);
  color: #fff; border: none; width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; font-size: 15px;
}

/* ===== زر عائم ===== */
.fab {
  position: fixed; bottom: 88px; left: 20px; width: 62px; height: 62px;
  border-radius: 22px; background: linear-gradient(135deg, var(--primary), #1976d2);
  color: #fff; font-size: 30px; border: none; cursor: pointer;
  box-shadow: 0 8px 24px rgba(21,101,192,.45); z-index: 60;
  transition: transform .2s; display: flex; align-items: center; justify-content: center;
}
.fab:hover { transform: scale(1.08) rotate(90deg); }

/* ===== التنبيهات ===== */
.notif-btn {
  position: fixed; top: 74px; left: 16px; width: 44px; height: 44px;
  border-radius: 50%; background: #fff; border: 1px solid var(--border);
  font-size: 19px; cursor: pointer; z-index: 55; box-shadow: var(--shadow-sm);
}
.notif-count {
  position: absolute; top: -4px; right: -4px; background: var(--danger);
  color: #fff; font-size: 11px; min-width: 20px; height: 20px; line-height: 20px;
  border-radius: 10px; font-weight: 800; box-shadow: 0 2px 6px rgba(220,38,38,.4);
}
.notif-panel { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100; backdrop-filter: blur(2px); }
.notif-header {
  background: #fff; padding: 16px 20px; display: flex; justify-content: space-between;
  align-items: center; border-radius: 18px 18px 0 0; max-width: 440px; margin: 9vh auto 0;
}
.notif-list {
  background: #fff; max-width: 440px; margin: 0 auto; max-height: 66vh;
  overflow-y: auto; padding: 4px 20px 20px; border-radius: 0 0 18px 18px;
}
.notif-item { padding: 13px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.notif-item small { display: block; color: var(--muted); margin-top: 4px; font-size: 11.5px; }
.notif-item.unread { background: #f0f7ff; }
.btn-x { background: none; border: none; font-size: 17px; cursor: pointer; }

/* ===== توست ===== */
.toast {
  position: fixed; bottom: 96px; right: 50%; transform: translateX(50%);
  background: #16283c; color: #fff; padding: 13px 24px; border-radius: 14px;
  font-size: 14px; font-weight: 600; z-index: 200;
  box-shadow: var(--shadow-lg); animation: fadeUp .3s ease;
}

/* ===== شريط سفلي ===== */
.bottom-nav {
  position: fixed; bottom: 0; right: 0; left: 0; background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 9px 0 11px; z-index: 50;
}
.nav-btn {
  background: none; border: none; font-size: 11.5px; color: var(--muted);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-weight: 600; padding: 4px 14px; border-radius: 12px; transition: all .2s;
}
.nav-btn .ico { font-size: 21px; }
.nav-btn.active { color: var(--primary); background: var(--primary-light); }

/* ===== مسار مراحل الطلب ===== */
.timeline { position: relative; padding-right: 26px; }
.timeline::before {
  content: ''; position: absolute; right: 8px; top: 6px; bottom: 6px;
  width: 2.5px; background: var(--border); border-radius: 2px;
}
.timeline-item { position: relative; padding: 10px 0; }
.timeline-item::before {
  content: ''; position: absolute; right: -24px; top: 14px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--border); border: 2.5px solid #fff; box-shadow: 0 0 0 1.5px var(--border);
}
.timeline-item.active::before { background: var(--success); box-shadow: 0 0 0 1.5px var(--success); }
.timeline-item .t-label { font-weight: 700; font-size: 13.5px; }
.timeline-item .t-time { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===== التنبيه العاجل (المشرف) ===== */
.urgent-card { animation: urgentPulse 2s infinite; }
@keyframes urgentPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.35); } 50% { box-shadow: 0 0 0 8px rgba(220,38,38,0); } }

/* ===== معرض صور الفني (المرحلة 4) ===== */
.tech-images-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tech-thumb { position: relative; width: 90px; height: 90px; border-radius: 12px; overflow: hidden; border: 1.5px solid var(--border); }
.tech-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tech-thumb .btn-x {
  position: absolute; top: 4px; left: 4px; background: rgba(220,38,38,.92);
  color: #fff; border: none; width: 22px; height: 22px; border-radius: 50%;
  cursor: pointer; font-size: 11px; line-height: 1;
}
.tech-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.tech-thumb.big { width: 100%; height: 150px; }

/* ===== التقارير (المرحلة 6) ===== */
.rep-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; background: #f8fafc; font-size: 14px;
}
.rep-row .r-val { font-weight: 800; color: var(--primary); }
.rep-bar-wrap { flex: 1; margin: 0 12px; height: 8px; background: #eef2f7; border-radius: 4px; overflow: hidden; }
.rep-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 4px; }
.rep-big { font-size: 26px; font-weight: 800; color: var(--primary-dark); }

/* ===== كمبيوتر ===== */
@media (min-width: 700px) {
  .auth-card { margin-top: 10vh; }
  #main-content { padding: 28px 24px 100px; }
}