@font-face {
  font-family: 'Tajawal';
  src: url('../fonts/Tajawal-Regular.ttf') format('truetype');
  font-weight: 400;
}
@font-face {
  font-family: 'Tajawal';
  src: url('../fonts/Tajawal-Bold.ttf') format('truetype');
  font-weight: 700;
}

/* Reset أساسي */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Tajawal', system-ui, sans-serif;
  background: #f5f5f7;
}

/* جسم النظام الداخلي */
body.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* الهيدر العام */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid #e3e3ea;
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.company-logo {
  height: 44px;
  width: auto;
}

.header-titles .sys-title {
  font-weight: 700;
  font-size: 16px;
  color: #2f265f;
}

.header-titles .sys-subtitle {
  font-size: 12px;
  color: #888;
}

/* منتصف الهيدر: رسالة الترحيب */
.header-center {
  flex: 1 1 auto;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #2f265f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* يسار الهيدر: أزرار */
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

/* ألوان الكلمات "منصة" و "ميدان" */
.word-platform {
  color: #2f265f;
  font-weight: 700;
}

.word-midan {
  color: #f27f2b;
  font-weight: 700;
}

/* المحتوى الرئيسي */
.app-main {
  flex: 1 1 auto;
  padding: 16px 24px 24px;
  overflow-y: auto;
}

/* الفوتر العام */
.app-footer {
  position: sticky;
  bottom: 0;
  z-index: 90;
  background: #ffffff;
  border-top: 1px solid #e3e3ea;
  padding: 8px 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* في صفحات الدخول/التسجيل يكون الفوتر مثبت أسفل */
body.login-page .app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
}

/* محتوى الفوتر */
.footer-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 4px;
}

.footer-text {
  font-size: 12px;
  color: #555;
  text-align: center;
  font-weight: 700;
}

.footer-text .author-name {
  color: #d32f2f;
}

/* أزرار الفوتر 3D */
.footer-icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #333;
  text-decoration: none;
}

.footer-icon-btn:hover {
  transform: translateY(-1px);
}

/* الشكل الخارجي للأيقونة */
.circle-icon {
  width: 30px;
  height: 30px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  font-size: 16px;
}

/* تدرجات 3D للفوتر */
.whatsapp-icon {
  background: linear-gradient(135deg, #1b5e20, #4caf50);
}

.cloud-icon {
  background: linear-gradient(135deg, #283593, #5c6bc0);
}

/* أزرار الهيدر 3D */
.btn-header {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  background: transparent;
}

.btn-header-3d {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-header-3d:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.btn-header-3d:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ألوان الأزرار حسب الوظيفة */
.btn-header-back {
  background: linear-gradient(135deg, #607d8b, #90a4ae);
}

.btn-header-home {
  background: linear-gradient(135deg, #2e7d32, #66bb6a);
}

.btn-header-logout {
  background: linear-gradient(135deg, #c62828, #ef5350);
}

.header-icon-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 30%, #ffffff, #f27f2b);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  font-size: 14px;
}

/* عنوان الصفحة */
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: #2f265f;
  margin-bottom: 12px;
}

/* شبكة الكروت */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  background: #ffffff;
  border-radius: 18px;
  padding: 14px 14px 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: cardIn 0.35s ease-out;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #333;
}

.card-icon {
  width: 22px;
  height: 22px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f27f2b, #ff9b3c);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.card-body {
  font-size: 13px;
}

/* كارت فورم عام */
.form-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 16px 16px 14px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
}

/* أزرار عامة */
.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Variants */
.btn-primary {
  background: linear-gradient(135deg, #f27f2b, #ff9b3c);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #e53935, #ff5252);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, #2e7d32, #66bb6a);
  color: #fff;
}

.btn-secondary {
  background: #ffffff;
  color: #2f265f;
  border: 1px solid #e3e3ea;
  box-shadow: none;
}

/* شبكة أزرار الإجراءات */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.btn-action {
  padding: 6px 10px;
  font-size: 12px;
  justify-content: center;
}

/* أيقونات 3D دائرية للأزرار */
.icon-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

/* ألوان مختلفة للأزرار */
.icon-badge-users {
  background: linear-gradient(135deg, #2196f3, #64b5f6);
}

.icon-badge-project {
  background: linear-gradient(135deg, #ff9800, #ffc107);
}

.icon-badge-print {
  background: linear-gradient(135deg, #8e24aa, #ba68c8);
}

.icon-badge-report {
  background: linear-gradient(135deg, #009688, #4db6ac);
}

.icon-badge-warning {
  background: linear-gradient(135deg, #f44336, #ff7961);
}

/* أزرار صفحة الدخول */
.icon-badge-login {
  background: linear-gradient(135deg, #4caf50, #81c784);
}

.icon-badge-register {
  background: linear-gradient(135deg, #2196f3, #64b5f6);
}

/* الجداول العامة */
.table-wrapper {
  max-height: 230px; /* تقريباً 5 صفوف */
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid #e3e3ea;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f5;
  text-align: center;
}

.table thead th {
  background: #f4f4fb;
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 700;
}

/* Badges للحالات */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: #fff;
}

.badge-approved {
  background: #2e7d32;
}

.badge-rejected {
  background: #c62828;
}

.badge-pending {
  background: #f9a825;
}

.badge-draft {
  background: #546e7a;
}

/* فلاتر أعلى الجداول */
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.filters-row input,
.filters-row select {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #d1d1e0;
  font-size: 12px;
}

/* الإشعارات اللحظية */
.notifications-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notification-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  font-size: 12px;
  color: #333;
  line-height: 1.4;
  border-bottom: 1px solid #e3e3ea;
}

.notification-label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.notification-pill {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
}

/* زر إغلاق الإشعار */
.notification-close {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: #999;
  padding: 0 4px;
}

.notification-close:hover {
  color: #c62828;
}

/* ألوان حالات الإشعارات */
.notification-status-approved {
  background: #2e7d32;
}

.notification-status-rejected {
  background: #c62828;
}

.notification-status-pending {
  background: #f9a825;
}

.notification-status-warning {
  background: #ff9800;
}

/* مجموعات الفورم */
.form-group {
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: #444;
}

/* حقول الإدخال */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #d1d1e0;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  border-color: #f27f2b;
  box-shadow: 0 0 0 2px rgba(242, 127, 43, 0.15);
}

/* صفحة تسجيل الدخول / تسجيل جديد */
body.login-page {
  height: 100vh;
  margin: 0;
  font-family: 'Tajawal', system-ui, sans-serif;
  background: url('../img/login-bg.jpg') center/cover no-repeat fixed;
  position: relative;
}

/* الـ overlay بين الهيدر والفوتر */
.login-overlay {
  position: fixed;
  top: 72px;
  bottom: 72px;
  left: 0;
  right: 0;
  background: rgba(5, 10, 30, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(420px, 92vw);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  padding: 28px 26px 22px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  animation: cardIn 0.5s ease-out;
}

.login-title {
  font-weight: 700;
  font-size: 20px;
  color: #2f265f;
  margin-bottom: 4px;
  text-align: center;
}

.login-subtitle {
  font-size: 13px;
  color: #666;
  margin-bottom: 18px;
  text-align: center;
}

.login-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.login-footer {
  margin-top: 12px;
  font-size: 11px;
  text-align: center;
  color: #777;
}

/* لوجو الحلواني في صفحات الدخول/التسجيل */
.halawani-logo-login {
  position: fixed;
  left: 16px;
  bottom: 100px;
  height: 105px;
  width: auto;
  z-index: 95;
}

/* مكوّن اختيار المدينة */
.city-select-container {
  position: relative;
  width: 100%;
}

.city-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid #d1d1e0;
  font-size: 13px;
}

.city-dropdown {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  max-height: 180px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: none;
  z-index: 9999;
}

.city-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f2f2f2;
}

.city-option:hover {
  background: #f7f7ff;
}

.city-option.no-results {
  text-align: center;
  color: #999;
}

/* رسائل فلاش في منتصف الشاشة */
.flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.flash-box {
  min-width: 260px;
  max-width: 420px;
  background: #ffffff;
  border-radius: 18px;
  padding: 16px 20px;
  text-align: center;
  font-size: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.flash-success {
  border: 2px solid #2e7d32;
  color: #1b5e20;
}

.flash-error {
  border: 2px solid #c62828;
  color: #b71c1c;
}

.flash-info {
  border: 2px solid #1976d2;
  color: #0d47a1;
}

/* تنسيقات بسيطة لعناصر inline-forms في إدارة المستخدمين / التقارير / الإنذارات */
.inline-form {
  display: inline-block;
}

/* فورم إضافة مستخدم جديد على صفين */
.add-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 16px;
}

/* طباعة: إخفاء الأزرار والهيدر والفوتر وإظهار الجداول كاملة */
@media print {
  .app-header,
  .app-footer,
  .btn,
  .btn-header,
  .filters-row,
  .footer-actions {
    display: none !important;
  }
  .app-main {
    padding: 0;
  }
  .table-wrapper {
    max-height: none !important;
    overflow: visible !important;
    border: none;
  }
}

/* Animation للكروت */
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
