/* ========================================================
   لوحة التحكم بالسير الذاتية وإدارة الأسعار — مكتب النجاح للاستقدام
   admin.css
======================================================== */

/* --- شاشة تسجيل الدخول --- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top right, var(--navy-800), var(--navy-950));
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: 0 25px 50px -12px rgba(7, 24, 48, 0.4);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: fadeIn 0.4s ease-out;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  margin: 0 auto 16px;
  display: block;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--gold-color);
}

.login-card h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.login-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* --- الهيكل العام للوحة التحكم --- */
.admin-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 30px 20px 80px;
}

.dashboard-header {
  background: linear-gradient(135deg, var(--navy-950), var(--navy-900));
  border-radius: var(--radius-lg);
  padding: 24px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  margin-bottom: 30px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(201, 162, 39, 0.3);
}

.dashboard-header img {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gold-color);
}

.btn-logout {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: #ef4444;
  color: #ffffff;
}

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

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary-color);
  line-height: 1;
}

/* --- شريط الإجراءات --- */
.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 25px;
}

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

.btn-action {
  background: linear-gradient(135deg, var(--gold-color), var(--gold-600));
  color: var(--navy-950);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(201, 162, 39, 0.25);
}

.btn-action:hover {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(201, 162, 39, 0.35);
}

.btn-action.btn-secondary {
  background: #ffffff;
  color: var(--primary-color);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-action.btn-secondary:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-action.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: none;
}

.btn-action.btn-danger:hover {
  background: #dc2626;
  color: #ffffff;
}

/* --- جداول البيانات --- */
.data-table-container {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  margin-bottom: 30px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.92rem;
}

.data-table thead th {
  background: var(--bg-light);
  color: var(--primary-color);
  font-weight: 800;
  padding: 16px 18px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-dark);
}

.data-table tbody tr:hover {
  background: rgba(238, 244, 251, 0.4);
}

.table-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  display: block;
}

/* شارات الحالة داخل الجدول */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.status-pill.status-available {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.status-reserved {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-table-icon {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-table-icon.edit {
  color: var(--primary-color);
  background: rgba(11, 37, 69, 0.05);
}

.btn-table-icon.edit:hover {
  background: var(--primary-color);
  color: #ffffff;
}

.btn-table-icon.toggle {
  color: #d97706;
  background: rgba(217, 119, 6, 0.08);
}

.btn-table-icon.toggle:hover {
  background: #d97706;
  color: #ffffff;
}

.btn-table-icon.delete {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.06);
}

.btn-table-icon.delete:hover {
  background: #dc2626;
  color: #ffffff;
}

/* --- المودالات والنوافذ المنبثقة المحسنة --- */
.admin-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  padding: 16px;
  box-sizing: border-box;
}

.admin-modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 24, 48, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
}

.admin-modal-container {
  position: relative;
  background: #ffffff;
  border-radius: 18px;
  width: 100%;
  max-width: 880px;
  max-height: 92vh;
  box-shadow: 0 25px 60px -15px rgba(7, 24, 48, 0.45);
  z-index: 1001;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* النموذج الداخلي يملأ كامل المساحة المتاحة كعمود مرن لمنع انقطاع الأسفل */
.admin-modal-container form,
#cvForm {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0% !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
  margin: 0 !important;
}

.admin-modal-header {
  flex-shrink: 0;
  padding: 18px 26px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--navy-950, #071830);
  margin: 0;
}

.admin-modal-close {
  background: #f1f5f9;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted, #64748b);
  transition: all 0.2s ease;
}

.admin-modal-close:hover {
  color: #ef4444;
  background: #fee2e2;
  transform: rotate(90deg);
}

.admin-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px 26px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #f8fafc;
  -webkit-overflow-scrolling: touch;
}

/* شريط تمرير أنيق واحترافي داخل المودال */
.admin-modal-body::-webkit-scrollbar {
  width: 8px;
}
.admin-modal-body::-webkit-scrollbar-track {
  background: #edf2f7;
  border-radius: 8px;
}
.admin-modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
}
.admin-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--gold-500, #c59b27);
}

.admin-modal-footer {
  flex-shrink: 0;
  padding: 16px 26px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.03);
}

/* شبكة الحقول في النموذج */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-input,
.form-select {
  padding: 11px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif, system-ui;
  font-size: 0.95rem;
  font-weight: 600;
  background-color: #ffffff;
  color: #0f172a;
  transition: all 0.2s ease;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--gold-color, #c59b27);
  background-color: #ffffff;
  box-shadow: 0 0 0 3.5px rgba(197, 155, 39, 0.18);
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-unit .form-input {
  padding-left: 60px;
}

.input-unit-badge {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  pointer-events: none;
  user-select: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-group.full-width {
    grid-column: span 1;
  }
  .actions-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .action-buttons {
    flex-direction: column;
  }
  .btn-action {
    justify-content: center;
  }
}

/* --- إدارة وتعديل الصورة الشخصية --- */
.photo-manager-card {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-block: 6px;
}

.photo-manager-layout {
  display: flex;
  gap: 20px;
  align-items: center;
}

.photo-preview-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--gold-color);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  background: #ffffff;
}

.photo-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-preview-badge {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  background: rgba(7, 24, 48, 0.85);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  padding: 3px 0;
  backdrop-filter: blur(2px);
}

.photo-manager-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: right;
}

.btn-upload-photo {
  background: #ffffff;
  color: var(--primary-color);
  border: 1.5px dashed var(--gold-color);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: none;
}

.btn-upload-photo:hover {
  background: rgba(201, 162, 39, 0.12);
  border-color: var(--gold-600);
  transform: translateY(-1px);
}

.photo-upload-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

.btn-table-icon.photo {
  color: var(--gold-600);
  background: rgba(201, 162, 39, 0.1);
  border-color: rgba(201, 162, 39, 0.3);
}

.btn-table-icon.photo:hover {
  background: var(--gold-color);
  color: var(--navy-950);
}

.table-thumb {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.table-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(201, 162, 39, 0.35);
  border-color: var(--gold-color);
}

@media (max-width: 640px) {
  .photo-manager-layout {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .photo-manager-controls {
    text-align: center;
    width: 100%;
  }
  .btn-upload-photo {
    width: 100%;
    justify-content: center;
  }
}

/* --- تحسينات وتنسيقات نافذة تعديل السيرة الذاتية الاحترافية --- */
.modal-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-section:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.modal-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-950, #071830);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.modal-sec-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(197, 155, 39, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.avatar-gallery-box {
  margin-top: 14px;
}

.avatar-gallery-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 10px;
  display: block;
}

.avatar-gallery {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 2px 10px;
}

.avatar-gallery::-webkit-scrollbar {
  height: 5px;
}
.avatar-gallery::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.avatar-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  padding: 6px 10px;
  border-radius: 12px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.avatar-choice img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.avatar-choice:hover,
.avatar-choice.active {
  border-color: var(--gold-color, #c59b27);
  background: rgba(197, 155, 39, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(197, 155, 39, 0.2);
}

.avatar-choice.active img {
  border-color: var(--gold-color, #c59b27);
}

.avatar-choice span {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e293b;
}

.quick-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.quick-tag-chip {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.quick-tag-chip:hover {
  background: var(--gold-color, #c59b27);
  color: #ffffff;
  border-color: var(--gold-color, #c59b27);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(197, 155, 39, 0.3);
}

.status-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.status-radio-card {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
  background: #ffffff;
  user-select: none;
}

.status-radio-card:hover {
  border-color: #cbd5e1;
}

.status-radio-card.active-available {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.06);
  box-shadow: 0 0 0 1px #10b981;
}

.status-radio-card.active-reserved {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
  box-shadow: 0 0 0 1px #ef4444;
}

/* بطاقة المعاينة المباشرة أثناء التعديل */
.cv-live-preview-box {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-top: 10px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.cv-live-preview-photo {
  width: 78px;
  height: 78px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--gold-color, #c59b27);
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.cv-live-preview-details {
  flex: 1;
  text-align: right;
}

.cv-live-preview-details h4 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary-color);
}

.cv-live-preview-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* إشعار الحفظ العائم */
.admin-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: #0f766e;
  color: #ffffff;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 9999;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-toast.show {
  transform: translateY(0);
  opacity: 1;
}
