/* نظام أرشيف المعاملات — ملف التنسيق الرئيسي */

/* الإعدادات العامة */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: "Tahoma", "Segoe UI", system-ui, sans-serif;
  background: #f3f5f9;
  color: #1f2937;
  font-size: 15px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* صفحة تسجيل الدخول */
.page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.login-box {
  background: #fff;
  width: 100%;
  max-width: 380px;
  padding: 36px 30px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.login-title {
  font-size: 22px;
  text-align: center;
  color: #1e3a8a;
  margin-bottom: 6px;
}

.login-subtitle {
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 24px;
}

.login-form label {
  display: block;
  margin: 14px 0 6px;
  font-size: 14px;
  color: #374151;
}

.login-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
}

.login-form input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.login-hint {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: #6b7280;
}

/* الشريط العلوي */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e3a8a;
  color: #fff;
  padding: 12px 24px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.brand {
  font-size: 18px;
  font-weight: bold;
}

.user-name {
  margin-inline-end: 8px;
  font-size: 14px;
}

.user-role {
  background: rgba(255,255,255,0.15);
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  margin-inline-end: 10px;
}

.link-admin {
  color: #fde68a;
  font-size: 13px;
  margin-inline-end: 12px;
}

.link-admin:hover { color: #fff; }

.link-logout, .link-back {
  color: #fde68a;
  font-size: 14px;
}

.link-logout:hover, .link-back:hover {
  color: #fff;
}

/* الحاوية الرئيسية */
.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 20px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.page-head h2 {
  font-size: 22px;
  color: #1f2937;
}

/* الأزرار */
.btn-primary {
  background: #1e3a8a;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  transition: background 0.15s;
}

.btn-primary:hover { background: #1d4ed8; }

.btn-ghost {
  background: transparent;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
}

.btn-ghost:hover { background: #f3f4f6; }

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

.btn-icon:hover { background: #e5e7eb; }

.btn-danger:hover { background: #fee2e2; }

.btn-danger-text {
  background: transparent;
  border: none;
  color: #dc2626;
  font-size: 14px;
  padding: 10px 18px;
  cursor: pointer;
}

.btn-danger-text:hover {
  color: #991b1b;
  text-decoration: underline;
}

.btn-danger-solid {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.btn-danger-solid:hover { background: #b91c1c; }

/* تنبيه القارئ */
.notice-box {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* الهاشتاكات */
.hashtags {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tag {
  background: #fff;
  border: 1px solid #d1d5db;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: #374151;
  transition: all 0.15s;
}

.tag:hover { border-color: #3b82f6; color: #1e3a8a; }

.tag.is-active {
  background: #1e3a8a;
  color: #fff;
  border-color: #1e3a8a;
}

/* البحث */
.search-bar { margin-bottom: 16px; }

.search-bar input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.search-bar input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* الجدول */
.table-wrap {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th, .data-table td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid #e5e7eb;
}

.data-table thead {
  background: #f9fafb;
  color: #374151;
  font-weight: bold;
}

.data-table tbody tr:hover { background: #f9fafb; }

.data-table tbody tr.is-hidden { display: none; }

.actions-cell { white-space: nowrap; }

.table-empty {
  text-align: center;
  color: #9ca3af;
  padding: 24px 12px;
  font-size: 14px;
}

/* الشارات */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}

.badge-in  { background: #dbeafe; color: #1e3a8a; }
.badge-out { background: #fef3c7; color: #92400e; }

.badge-role {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}

.role-super  { background: #fee2e2; color: #991b1b; }
.role-viewer { background: #e5e7eb; color: #374151; }

.status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}

.status-on  { background: #d1fae5; color: #065f46; }
.status-off { background: #fee2e2; color: #991b1b; }

.link-att {
  color: #1d4ed8;
  font-size: 13px;
}

.link-att:hover { text-decoration: underline; }

/* النموذج */
.form-card {
  background: #fff;
  padding: 24px;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.form-row {
  border: none;
  padding: 0;
  margin-bottom: 18px;
}

.form-row legend {
  font-weight: bold;
  margin-bottom: 8px;
  color: #374151;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  margin-inline-end: 8px;
  cursor: pointer;
}

.radio-pill input { accent-color: #1e3a8a; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
}

.field-full { grid-column: 1 / -1; }

.field label {
  font-size: 13px;
  color: #374151;
  margin-bottom: 6px;
}

.field input, .field select {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.field-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 18px;
}

.field-check input { accent-color: #1e3a8a; }
.field-check label { font-size: 14px; color: #374151; margin: 0; }

.form-attachments {
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}

.form-attachments legend {
  padding: 0 6px;
  font-weight: bold;
  color: #374151;
}

.form-attachments input[type="file"] { font-size: 14px; }

.form-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
}

.file-list {
  list-style: none;
  margin-top: 10px;
  padding: 0;
}

.file-list li {
  background: #f3f4f6;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 4px;
  color: #374151;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* تفاصيل المعاملة */
.archive-code {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: #6b7280;
  font-family: "Courier New", monospace;
  background: #f3f4f6;
  padding: 2px 10px;
  border-radius: 6px;
}

.details-card {
  background: #fff;
  padding: 22px 24px;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  margin-bottom: 18px;
}

.details-title {
  font-size: 16px;
  color: #1e3a8a;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.details-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.details-head .details-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.att-count {
  font-size: 13px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 3px 10px;
  border-radius: 999px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 20px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-full { grid-column: 1 / -1; }

.detail-label {
  font-size: 12px;
  color: #6b7280;
}

.detail-value {
  font-size: 15px;
  color: #1f2937;
  font-weight: bold;
}

.attachments-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

.attachment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 8px;
}

.att-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.att-icon { font-size: 24px; }

.att-name {
  font-size: 14px;
  font-weight: bold;
  color: #1f2937;
}

.att-meta {
  font-size: 12px;
  color: #6b7280;
}

.att-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.upload-box {
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  background: #fafafa;
}

.upload-box input[type="file"] { display: none; }

.upload-label {
  display: inline-block;
  background: #1e3a8a;
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.upload-label:hover { background: #1d4ed8; }

/* المودال */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.modal-box {
  position: relative;
  background: #fff;
  width: 90%;
  max-width: 460px;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-small { max-width: 360px; }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #1e3a8a;
  color: #fff;
}

.modal-head h3 { font-size: 16px; margin: 0; }

.modal-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover { opacity: 0.8; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-body .field { margin-bottom: 14px; }

/* استجابة الشاشات */
@media (max-width: 720px) {
  .form-grid, .details-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .data-table { font-size: 13px; }
  .attachment-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}
