/* تحسينات التنسيق الكاملة — ألصقيه في آخر style.css */

/* رسالة خطأ تسجيل الدخول */
.login-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

/* عنوان الصفحة الفرعي */
.page-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin: 4px 0 0 0;
}

.page-head {
  margin-bottom: 18px;
}

/* أزرار كبيرة موحدة */
.btn-primary.btn-lg,
.btn-ghost.btn-lg {
  padding: 12px 22px;
  font-size: 15px;
  min-height: 44px;
  font-weight: bold;
}

/* أقسام النموذج (fieldset) */
.form-section {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 18px;
  background: #fafafa;
}

.form-section legend {
  padding: 0 12px;
  font-weight: bold;
  color: #1e3a8a;
  font-size: 15px;
  background: #fafafa;
}

/* الحقل المميز (highlight) */
.field-highlight {
  background: #fffbeb;
  border: 2px solid #fbbf24;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.field.field-highlight label {
  font-size: 15px;
  font-weight: bold;
  color: #92400e;
  margin-bottom: 8px;
}

.field.field-highlight select,
.field.field-highlight input {
  font-size: 15px;
  padding: 11px 14px;
  border: 1px solid #fbbf24;
  background: #fff;
}

.field.field-highlight select:focus,
.field.field-highlight input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  outline: none;
}

.required { color: #dc2626; font-weight: bold; }

.field-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: #92400e;
  background: #fef3c7;
  padding: 5px 10px;
  border-radius: 4px;
}

.hint-icon { font-size: 13px; }

/* اختيار نوع المعاملة (pills) */
.type-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 2px solid #d1d5db;
  border-radius: 999px;
  cursor: pointer;
  background: #fff;
  font-weight: bold;
  font-size: 14px;
  color: #374151;
  transition: all 0.15s;
}

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

.radio-pill:has(input:checked) {
  background: #1e3a8a;
  color: #fff;
  border-color: #1e3a8a;
}

.radio-pill:hover:not(:has(input:checked)) {
  border-color: #1e3a8a;
  background: #eff6ff;
}

/* قسم الفيكس (البارز) */
.form-section.levex-link-section {
  border: 2px solid #fbbf24;
  background: #fffbeb;
}

.form-section.levex-link-section legend {
  background: #fffbeb;
  color: #92400e;
  font-size: 16px;
}

/* صندوق اختيار المجلد */
.folder-choice-box {
  background: #fff;
  border: 2px solid #f59e0b;
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
}

.folder-choice-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #fde68a;
  margin-bottom: 14px;
}

.folder-choice-icon {
  font-size: 36px;
  width: 56px;
  height: 56px;
  background: #fef3c7;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.folder-choice-title {
  font-size: 15px;
  font-weight: bold;
  color: #92400e;
  margin-bottom: 2px;
}

.folder-choice-sub {
  font-size: 12px;
  color: #b45309;
}

/* تبويبات الخيارين (Tabs) */
.folder-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.folder-mode-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}

.folder-mode-tab input { display: none; }

.folder-mode-tab:has(input:checked) {
  border-color: #f59e0b;
  background: #fef3c7;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.folder-mode-tab:hover:not(:has(input:checked)) {
  border-color: #fbbf24;
  background: #fffbeb;
}

.mode-icon {
  font-size: 22px;
  width: 36px;
  height: 36px;
  background: #fef3c7;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.folder-mode-tab:has(input:checked) .mode-icon {
  background: #f59e0b;
}

.mode-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mode-title {
  font-size: 14px;
  font-weight: bold;
  color: #92400e;
}

.mode-desc {
  font-size: 11px;
  color: #b45309;
}

/* لوحات المجلد */
.folder-mode-panel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
}

.panel-label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  color: #374151;
  margin-bottom: 6px;
}

.panel-select,
.panel-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

.panel-select:focus,
.panel-input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.panel-select:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.folder-empty-msg {
  margin: 10px 0 0 0;
  font-size: 13px;
  color: #92400e;
  background: #fef3c7;
  padding: 10px 14px;
  border-radius: 6px;
  border-right: 3px solid #f59e0b;
}

/* الماسح الضوئي */
.scanner-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

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

.scanner-title {
  font-size: 16px;
  color: #1e3a8a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.scanner-icon {
  width: 32px;
  height: 32px;
  background: #1e3a8a;
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.scanner-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
}

.status-idle     { background: #9ca3af; }
.status-ready    { background: #10b981; }
.status-scanning { background: #3b82f6; animation: pulse 1s infinite; }
.status-done     { background: #10b981; }
.status-warn     { background: #f59e0b; }
.status-error    { background: #ef4444; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* شريط مجلد المسح */
.folder-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f9fafb;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid #e5e7eb;
}

.folder-label {
  font-size: 13px;
  color: #374151;
  font-weight: bold;
  white-space: nowrap;
}

.folder-bar code {
  flex: 1;
  background: #1f2937;
  color: #10b981;
  padding: 5px 10px;
  border-radius: 5px;
  font-family: "Courier New", monospace;
  font-size: 12px;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  white-space: nowrap;
}

/* شبكة الصفحات الممسوحة */
.scans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  min-height: 120px;
  margin-bottom: 16px;
}

.scan-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  color: #9ca3af;
  background: #fafafa;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
}

.scan-empty-icon { font-size: 40px; margin-bottom: 6px; opacity: 0.5; }
.scan-empty p { margin: 0; font-size: 13px; }

.scan-thumb {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}

.scan-thumb img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #f9fafb;
  border-radius: 5px;
  margin-bottom: 6px;
}

.scan-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #6b7280;
  padding: 2px 4px 6px;
}

.scan-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding-top: 6px;
  border-top: 1px solid #f3f4f6;
}

.scan-actions .btn-icon { font-size: 14px; padding: 2px 4px; }

/* أزرار الماسح */
.scanner-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.scanner-buttons button {
  flex: 1;
  min-width: 180px;
  padding: 11px 16px;
  font-size: 14px;
}

.scanner-tip {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-right: 3px solid #3b82f6;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  color: #1e40af;
  line-height: 1.7;
  margin: 0 0 12px 0;
}

.scanner-tip strong { color: #1e3a8a; }

/* خيار الرفع البديل */
.fallback-upload {
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
  margin-top: 8px;
}

.fallback-upload summary {
  cursor: pointer;
  font-size: 13px;
  color: #6b7280;
  padding: 6px 0;
  user-select: none;
}

.fallback-upload summary:hover { color: #374151; }

.fallback-upload input[type="file"] {
  margin-top: 8px;
  display: block;
  font-size: 12px;
}

/* أزرار أساسية مخصصة */
.btn-fetch {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-fetch:hover { background: #059669; }
.btn-fetch:disabled { background: #9ca3af; cursor: not-allowed; }

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

/* أزرار أسفل النموذج */
.form-actions-bottom {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #e5e7eb;
  justify-content: flex-start;
}

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

/* خلية الكود في الجدول */
.cell-code {
  background: #f3f4f6;
  color: #1f2937;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 12px;
  font-weight: bold;
  direction: ltr;
  display: inline-block;
}

.col-type { width: 80px; }
.data-table th.col-actions { width: 130px; text-align: center; }

/* شريط الفلترة الموحد */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.filter-bar .hashtags { margin: 0; }
.filter-bar .hashtags .tag { font-size: 13px; padding: 5px 12px; }

.hashtags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  background: #fff;
  border: 1px solid #d1d5db;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  font-family: inherit;
}

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

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

.search-bar-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 12px;
  flex: 1;
  min-width: 220px;
  max-width: 400px;
}

.search-icon { color: #6b7280; font-size: 14px; }

.search-bar-inline input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  padding: 4px 0;
}

/* شريط التبويبات */
.tabs-nav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 18px;
}

.tab-link {
  background: transparent;
  border: none;
  padding: 12px 18px;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-link:hover {
  color: #1e3a8a;
  background: #f9fafb;
  border-radius: 6px 6px 0 0;
}

.tab-link.is-active {
  color: #1e3a8a;
  border-bottom-color: #1e3a8a;
  background: #eff6ff;
  border-radius: 6px 6px 0 0;
}

.tab-icon { font-size: 16px; }

.tab-count {
  background: #1e3a8a;
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: bold;
  min-width: 22px;
  text-align: center;
}

.tab-link:not(.is-active) .tab-count { background: #9ca3af; }

.head-buttons { display: flex; gap: 10px; }

/* تفاصيل الفيكس */
.levex-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: #fff;
  padding: 20px 24px;
  border-radius: 12px;
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
}

.levex-detail-id { display: flex; align-items: center; gap: 16px; }

.levex-detail-icon {
  font-size: 40px;
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.levex-detail-no { font-size: 13px; opacity: 0.8; font-family: "Courier New", monospace; margin-bottom: 2px; }
.levex-detail-name { font-size: 22px; margin: 0; font-weight: bold; }

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

.levex-detail-actions .btn-primary { background: rgba(255,255,255,0.2); }
.levex-detail-actions .btn-primary:hover { background: rgba(255,255,255,0.3); }
.levex-detail-actions .btn-danger-text { color: #fde68a; }
.levex-detail-actions .btn-danger-text:hover { color: #fff; }

/* شبكة بطاقات الفيكسات */
.levexes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.levex-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.levex-card:hover {
  border-color: #1e3a8a;
  box-shadow: 0 6px 20px rgba(30, 58, 138, 0.12);
  transform: translateY(-3px);
}

.levex-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 18px 8px 18px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.levex-icon-lg {
  font-size: 36px;
  width: 56px;
  height: 56px;
  background: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.levex-card-badge {
  background: #1e3a8a;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: "Courier New", monospace;
}

.levex-card-body { padding: 8px 18px 12px 18px; flex: 1; }

.levex-no { font-size: 12px; color: #6b7280; font-family: "Courier New", monospace; margin-bottom: 2px; }
.levex-name { font-size: 15px; font-weight: bold; color: #1f2937; line-height: 1.4; }

.levex-card-foot {
  display: flex;
  gap: 14px;
  padding: 12px 18px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.levex-stat { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #6b7280; }

.levex-stat-num {
  background: #1e3a8a;
  color: #fff;
  font-weight: bold;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 24px;
  text-align: center;
}

/* شبكة المجلدات */
.folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.folder-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.15s;
}

.folder-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.folder-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.folder-icon { font-size: 28px; }

.folder-menu { display: flex; gap: 4px; }

.folder-menu .btn-icon {
  background: rgba(255,255,255,0.7);
  font-size: 13px;
  padding: 3px 5px;
}

.folder-card-body { padding: 12px 14px; }

.folder-name {
  font-size: 14px;
  font-weight: bold;
  color: #1f2937;
  margin-bottom: 4px;
  word-break: break-word;
}

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

.folder-card-foot {
  padding: 8px 14px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.folder-card-foot .btn-ghost {
  width: 100%;
  font-size: 13px;
  padding: 6px 10px;
}

.folder-card-add {
  background: #f9fafb;
  border: 2px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 14px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 140px;
}

.folder-card-add:hover {
  border-color: #1e3a8a;
  background: #eff6ff;
}

.folder-add-icon { font-size: 32px; color: #6b7280; margin-bottom: 6px; }
.folder-card-add:hover .folder-add-icon { color: #1e3a8a; }

.folder-add-text { font-size: 13px; color: #6b7280; font-weight: bold; }
.folder-card-add:hover .folder-add-text { color: #1e3a8a; }

/* شارة الحالة */
.levex-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}

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