/* styles.css - ملف التنسيقات الرئيسي محسّن للهواتف المحمولة */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  direction: rtl;
  font-size: 14px;
}

/* صفحة تسجيل الدخول */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
}

.login-box h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
  font-size: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-weight: 500;
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  transition: border-color 0.3s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.btn,
.btn-primary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-export {
  padding: 12px 20px;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  min-height: 44px; /* الحد الأدنى للمس على الهواتف */
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-warning {
  background: #ffc107;
  color: #333;
}

.btn-export {
  background: #17a2b8;
  color: white;
}

.btn:hover,
.btn-primary:hover,
.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover,
.btn-export:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 36px;
}

.alert {
  padding: 12px;
  border-radius: 5px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-warning {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

/* الشريط العلوي */
.navbar {
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 15px 20px;
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 10px;
}

.navbar-brand {
  font-size: 18px;
  font-weight: bold;
  color: #667eea;
  flex: 1;
  min-width: 200px;
}

.navbar .logo {
  width: 100px;
  border-left: 1px solid #333;
}

.navbar .logo img {
  width: 100%;
}
.navbar-user {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.navbar-user span {
  font-size: 14px;
  white-space: nowrap;
}

.notification-badge {
  position: relative;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.notification-badge:hover {
  background-color: #f8f9fa;
}

.notification-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
}

.logout-btn {
  padding: 8px 16px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  min-height: 36px;
  display: flex;
  align-items: center;
}

/* الحاوية الرئيسية */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 15px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  min-height: calc(100vh - 120px);
}

/* البطاقات الإحصائية */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 100px;
}

.stat-card h3 {
  color: #666;
  font-size: 13px;
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-card .number {
  font-size: 28px;
  font-weight: bold;
}

.stat-card.new {
  border-right: 4px solid #007bff;
}
.stat-card.pending {
  border-right: 4px solid #ffc107;
}
.stat-card.approved {
  border-right: 4px solid #28a745;
}
.stat-card.rejected {
  border-right: 4px solid #dc3545;
}

/* أدوات التحكم */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 15px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 250px;
  max-width: 400px;
}

.search-box input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
}

.filter-box {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-box select,
.filter-box input {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  min-width: 120px;
}

/* الجداول */
.table-container {
  overflow-x: auto;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  min-width: 800px; /* الحد الأدنى لعرض الجدول */
}

table th {
  background: #f8f9fa;
  padding: 12px 8px;
  text-align: right;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #dee2e6;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 10;
}

table td {
  padding: 12px 8px;
  border-bottom: 1px solid #dee2e6;
  font-size: 13px;
  word-wrap: break-word;
  max-width: 150px;
}

table tr:hover {
  background: #f8f9fa;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  display: inline-block;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-width: 120px;
}

/* النوافذ المنبثقة */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  padding: 25px;
  border-radius: 10px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.modal-header h2 {
  color: #333;
  font-size: 18px;
  margin: 0;
}

.close-modal {
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 5px;
  line-height: 1;
}

.modal-body {
  margin-bottom: 20px;
}

/* الإشعارات */
.notifications-dropdown {
  position: absolute;
  top: 50px;
  left: 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  width: 320px;
  max-width: 90vw;
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}

.notifications-dropdown.active {
  display: block;
}

.notification-item {
  padding: 15px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background-color 0.2s;
}

.notification-item:hover {
  background: #f8f9fa;
}

.notification-item.unread {
  background: #e3f2fd;
  border-right: 3px solid #2196f3;
}

.notification-time {
  font-size: 11px;
  color: #999;
  margin-top: 5px;
}

/* الاستجابة للشاشات المختلفة */

/* الأجهزة اللوحية */
@media (max-width: 1024px) {
  .container {
    margin: 10px;
    padding: 15px;
  }

  .stats-container {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
  }

  .navbar-brand {
    font-size: 16px;
  }

  table th,
  table td {
    padding: 8px 6px;
  }
}

/* الهواتف الذكية */
@media (max-width: 768px) {
  body {
    font-size: 13px;
  }

  .navbar {
    padding: 10px 15px;
  }

  .navbar-container {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .navbar-brand {
    text-align: center;
    font-size: 16px;
    min-width: auto;
  }

  .navbar-user {
    justify-content: center;
    gap: 10px;
  }

  .navbar-user span {
    font-size: 12px;
  }

  .container {
    margin: 5px;
    padding: 10px;
    border-radius: 8px;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    min-width: auto;
    max-width: none;
  }

  .filter-box {
    justify-content: space-between;
  }

  .filter-box select,
  .filter-box input {
    flex: 1;
    min-width: auto;
  }

  .stats-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-card {
    padding: 15px;
    min-height: 80px;
  }

  .stat-card h3 {
    font-size: 11px;
  }

  .stat-card .number {
    font-size: 22px;
  }

  /* جدول متجاوب للهواتف */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }

  table th,
  table td {
    padding: 6px 4px;
    font-size: 12px;
  }

  .action-buttons {
    min-width: 100px;
  }

  .btn-sm {
    padding: 4px 6px;
    font-size: 10px;
    min-height: 28px;
  }

  /* النوافذ المنبثقة للهواتف */
  .modal {
    padding: 10px;
  }

  .modal-content {
    padding: 20px;
    max-height: 85vh;
  }

  .modal-header h2 {
    font-size: 16px;
  }

  /* الإشعارات للهواتف */
  .notifications-dropdown {
    width: 300px;
    right: 0;
    left: auto;
    top: 45px;
  }

  .notification-item {
    padding: 12px;
  }

  /* تحسين اللمس */
  .btn,
  .btn-primary,
  .btn-success,
  .btn-danger,
  .btn-warning {
    min-height: 40px;
    margin: 2px;
  }

  input,
  select,
  textarea {
    min-height: 40px;
  }
}

/* الهواتف الصغيرة جداً */
@media (max-width: 480px) {
  .login-box {
    padding: 20px;
    margin: 10px;
  }

  .login-box h2 {
    font-size: 20px;
  }

  .stats-container {
    grid-template-columns: 1fr;
  }

  .stat-card {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .filter-box {
    flex-direction: column;
    gap: 8px;
  }

  .modal-content {
    padding: 15px;
    margin: 10px;
  }

  .notifications-dropdown {
    width: calc(100vw - 20px);
    left: 10px;
    right: 10px;
  }

  table {
    font-size: 11px;
  }

  .action-buttons {
    flex-direction: column;
    gap: 2px;
  }
}

/* وضع الطباعة */
@media print {
  .navbar,
  .controls,
  .btn,
  .action-buttons,
  .notification-badge,
  .notifications-dropdown {
    display: none !important;
  }

  body {
    background: white;
    font-size: 12pt;
  }

  .container {
    box-shadow: none;
    padding: 0;
  }

  table {
    page-break-inside: auto;
  }

  table tr {
    page-break-inside: avoid;
  }
}

/* تحسين الأداء والحركة */
* {
  -webkit-tap-highlight-color: transparent;
}

.btn,
.notification-badge,
.close-modal {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

/* تمرير أفضل على الهواتف */
.table-container {
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  -webkit-overflow-scrolling: touch;
}

/* تحسين النصوص العربية */
body,
input,
select,
textarea {
  font-family: "Segoe UI", "Tahoma", "Arial", sans-serif;
}

/* تحسين الفوكس للهواتف */
input:focus,
select:focus,
textarea:focus {
  zoom: 1;
  -webkit-user-select: auto;
  user-select: auto;
}

/* منع التكبير عند الفوكس على iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  select,
  textarea,
  input[type="text"],
  input[type="password"],
  input[type="datetime"],
  input[type="datetime-local"],
  input[type="date"],
  input[type="month"],
  input[type="time"],
  input[type="week"],
  input[type="number"],
  input[type="email"],
  input[type="url"] {
    font-size: 16px;
  }
}

/* تحسين السحب والإفلات على الأجهزة اللمسية */
.table-container {
  touch-action: pan-x pan-y;
}

.modal {
  touch-action: none;
}

.modal-content {
  touch-action: auto;
}
