@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&display=swap');

:root {
  /* لون واحد أساسي - أخضر زيتوني هادئ */
  --p1: #18181b;   /* أسود */
  --p2: #27272a;   /* رمادي داكن */
  --p3: #f4f4f5;   /* رمادي فاتح */
  --p4: #e4e4e7;   /* رمادي */

  /* رمادي محايد */
  --g1: #1f2937;   /* رمادي داكن (نصوص) */
  --g2: #374151;   /* رمادي متوسط */
  --g3: #6b7280;   /* رمادي فاتح (muted) */
  --g4: #f9fafb;   /* رمادي فاتح جداً (bg) */
  --g5: #f3f4f6;   /* خلفية الكروت */
  --g6: #e5e7eb;   /* حدود */

  /* حالات فقط */
  --red:    #dc2626;
  --red-bg: #fef2f2;
  --yel:    #d97706;
  --yel-bg: #fffbeb;
  --blu:    #2563eb;
  --blu-bg: #eff6ff;
  --pnk:    #9d174d;
  --pnk-bg: #fdf2f8;

  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
}

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

body {
  font-family: 'Cairo', sans-serif;
  background: var(--g5);
  color: var(--g1);
  direction: rtl; text-align: right;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ======== SIDEBAR ======== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: #18181b;
  display: flex; flex-direction: column;
  position: fixed; height: 100vh; right: 0; z-index: 100;
}
.sidebar-logo {
  padding: 24px 18px 18px; text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo span { font-size: 2rem; display: block; margin-bottom: 6px; }
.sidebar-logo h2 { font-size: 1rem; font-weight: 800; color: #ffffff; letter-spacing: 0.3px; }

.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; color: #ffffff;
  text-decoration: none; font-size: 0.88rem; font-weight: 600;
  transition: all 0.15s; border-right: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.10); color: #ffffff; border-right-color: #ffffff; }
.sidebar-nav a.active { background: rgba(255,255,255,0.15); color: white; border-right-color: white; }
.sidebar-nav a .icon { font-size: 1rem; min-width: 20px; }
.sidebar-nav .divider { border-top: 1px solid rgba(255,255,255,0.1); margin: 8px 14px; }

.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.75rem; color: rgba(255,255,255,0.75); }

/* ======== TOPBAR ======== */
.main-content { margin-right: 250px; flex: 1; display: flex; flex-direction: column; }

.topbar {
  background: white; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--g6);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  position: sticky; top: 0; z-index: 99;
}
.topbar h1 { font-size: 1rem; font-weight: 700; color: var(--g1); }
.topbar .user-info { display: flex; align-items: center; gap: 10px; }
.topbar .user-info .avatar {
  width: 34px; height: 34px; background: #18181b; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.88rem;
}

.content-area { padding: 22px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ======== CARDS ======== */
.card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
  margin-bottom: 18px; border: 1px solid var(--g6);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: -20px -20px 18px; padding: 13px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--g6); background: #f3f4f6;
}
.card-header h2 { font-size: 0.95rem; font-weight: 700; color: var(--g1); display: flex; align-items: center; gap: 6px; }

/* ======== STATS ======== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: white; border-radius: var(--radius); padding: 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--g6); transition: transform 0.15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon { font-size: 1.7rem; width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-icon.green  { background: #f4f4f5; }
.stat-icon.blue   { background: var(--blu-bg); }
.stat-icon.orange { background: var(--yel-bg); }
.stat-icon.red    { background: var(--red-bg); }
.stat-info .num { font-size: 1.6rem; font-weight: 900; color: var(--g1); line-height: 1.2; }
.stat-info .lbl { font-size: 0.78rem; color: var(--g3); margin-top: 2px; }

/* ======== FORMS ======== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.83rem; font-weight: 700; color: var(--g2); margin-bottom: 5px; }
.form-group label .req { color: var(--red); }

.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid var(--g6);
  border-radius: var(--radius-sm); font-family: 'Cairo',sans-serif;
  font-size: 0.9rem; color: var(--g1); background: white;
  transition: border-color 0.15s, box-shadow 0.15s; direction: rtl;
}
.form-control:focus { outline: none; border-color: #27272a; box-shadow: 0 0 0 3px rgba(61,158,106,0.12); }
select.form-control { cursor: pointer; }
textarea.form-control { min-height: 85px; resize: vertical; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.radio-group, .checkbox-group { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.radio-option, .checkbox-option { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 0.88rem; color: var(--g2); }
.radio-option input, .checkbox-option input { width: 16px; height: 16px; accent-color: #18181b; cursor: pointer; }

/* ======== BUTTONS ======== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm);
  font-family: 'Cairo',sans-serif; font-size: 0.86rem; font-weight: 700;
  cursor: pointer; border: none; transition: all 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: #18181b; color: white; }
.btn-primary:hover { background: #256644; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(46,125,82,0.3); }
.btn-success { background: #047857; color: white; }
.btn-success:hover { background: #065f46; transform: translateY(-1px); }
.btn-danger  { background: var(--red); color: white; }
.btn-danger:hover  { background: #b91c1c; transform: translateY(-1px); }
.btn-warning { background: var(--yel); color: white; }
.btn-warning:hover { background: #b45309; }
.btn-info    { background: var(--blu); color: white; }
.btn-info:hover    { background: #1d4ed8; transform: translateY(-1px); }
.btn-outline { background: transparent; color: #18181b; border: 1px solid #18181b; }
.btn-outline:hover { background: #f4f4f5; }
.btn-sm   { padding: 5px 11px; font-size: 0.78rem; }
.btn-lg   { padding: 11px 26px; font-size: 0.96rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 6px 8px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ======== TABLES ======== */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.data-table thead th { background: #18181b; color: #f9fafb; padding: 10px 12px; font-weight: 700; text-align: right; }
table.data-table tbody tr { transition: background 0.1s; }
table.data-table tbody tr:nth-child(even) { background: #f9fafb; }
table.data-table tbody tr:hover { background: #f4f4f5; }
table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--g6); }

/* ======== BADGES ======== */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: 20px; font-size: 0.73rem; font-weight: 700; }
.badge-male    { background: var(--blu-bg); color: var(--blu); }
.badge-female  { background: var(--pnk-bg); color: var(--pnk); }
.badge-baby    { background: var(--yel-bg); color: var(--yel); }
.badge-success { background: #f4f4f5; color: #18181b; }
.badge-danger  { background: var(--red-bg); color: var(--red); }
.badge-info    { background: var(--blu-bg); color: var(--blu); }
.badge-warning { background: var(--yel-bg); color: var(--yel); }

/* ======== ALERTS ======== */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); margin-bottom: 15px; display: flex; align-items: flex-start; gap: 8px; font-size: 0.88rem; }
.alert-success { background: #f4f4f5; color: #18181b; border-right: 4px solid #18181b; }
.alert-danger  { background: var(--red-bg); color: #991b1b; border-right: 4px solid var(--red); }
.alert-warning { background: var(--yel-bg); color: #92400e; border-right: 4px solid var(--yel); }
.alert-info    { background: var(--blu-bg); color: #1e40af; border-right: 4px solid var(--blu); }

/* ======== AUTH ======== */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #18181b; padding: 20px;
}
.auth-box { background: white; border-radius: var(--radius-lg); padding: 44px 36px; width: 100%; max-width: 420px; box-shadow: var(--shadow-md); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .emoji { font-size: 2.8rem; display: block; margin-bottom: 8px; }
.auth-logo h1 { font-size: 1.3rem; color: #18181b; font-weight: 900; }
.auth-logo p { color: var(--g3); font-size: 0.86rem; margin-top: 4px; }

/* ======== SUB BANNER ======== */
.sub-banner { background: #18181b; color: white; padding: 12px 20px; border-radius: var(--radius); margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.sub-banner.expired { background: var(--red); }
.sub-banner .info { font-weight: 700; font-size: 0.9rem; }
.sub-banner .days { font-size: 0.8rem; opacity: 0.85; }

/* ======== ROOMS ======== */
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(230px,1fr)); gap: 14px; }
.room-card { background: white; border-radius: var(--radius); border: 1px solid var(--g6); overflow: hidden; transition: all 0.15s; }
.room-card:hover { box-shadow: var(--shadow-md); border-color: #d4d4d8; }
.room-card-header { background: #18181b; color: #f9fafb; padding: 9px 14px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 0.84rem; }
.room-card-header.female { background: var(--pnk); }
.room-card-header.mixed  { background: var(--blu); }
.room-card-body { padding: 10px 14px; }
.room-pilgrim { display: flex; align-items: center; gap: 7px; padding: 6px 0; border-bottom: 1px solid var(--g6); font-size: 0.84rem; }
.room-pilgrim:last-child { border-bottom: none; }
.gender-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blu); flex-shrink: 0; }
.gender-dot.female { background: var(--pnk); }
.empty-slot { text-align: center; padding: 5px; color: var(--g6); font-size: 0.76rem; border: 1px dashed var(--g6); border-radius: 5px; margin: 3px 0; }

/* ======== PROGRESS ======== */
.progress-bar { height: 6px; background: var(--g6); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.progress-fill { height: 100%; background: #18181b; border-radius: 3px; transition: width 0.4s; }
.progress-fill.warn   { background: var(--yel); }
.progress-fill.danger { background: var(--red); }

/* ======== MODAL ======== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 999; align-items: center; justify-content: center; padding: 18px; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: var(--radius-lg); padding: 26px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); animation: modalIn 0.2s ease; }
@keyframes modalIn { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--g6); }
.modal-header h3 { font-size: 1rem; color: var(--g1); font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--g3); }

/* ======== MISC ======== */
.hajj-btn { background: var(--yel); color: white; font-weight: 800; border-radius: var(--radius-sm); padding: 8px 15px; border: none; cursor: pointer; font-family: 'Cairo',sans-serif; display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; transition: all 0.15s; text-decoration: none; }
.hajj-btn:hover { background: #b45309; transform: translateY(-1px); }

#toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--g1); color: white; padding: 11px 22px; border-radius: 26px; font-family: 'Cairo',sans-serif; font-size: 0.86rem; font-weight: 700; z-index: 9999; transition: transform 0.28s; pointer-events: none; }
#toast.show  { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); }

.similar-warning { background: var(--yel-bg); border: 1px solid #fcd34d; border-radius: var(--radius-sm); padding: 12px; margin-top: 10px; }
.similar-item { display: flex; align-items: center; justify-content: space-between; padding: 5px 9px; background: white; border-radius: 5px; margin-bottom: 5px; font-size: 0.82rem; }
.similar-item .match-pct { font-weight: 700; color: var(--yel); }

.companion-card { background: #f9fafb; border: 1px dashed #d4d4d8; border-radius: var(--radius-sm); padding: 11px; margin-bottom: 8px; position: relative; }
.count-bar { margin-bottom: 14px; }
.count-text { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 3px; }
.count-text strong { color: #18181b; }
.phone-hint { background: white; border: 1px solid var(--g6); border-radius: 7px; padding: 5px 12px; font-family: 'Cairo',sans-serif; font-size: 0.8rem; font-weight: 700; cursor: pointer; color: #18181b; transition: all 0.15s; }
.phone-hint:hover { background: #f4f4f5; border-color: #27272a; }

/* ======== RESPONSIVE ======== */
@media (max-width: 900px) {
  .sidebar { width: 0; overflow: hidden; }
  .sidebar.open { width: 250px; }
  .main-content { margin-right: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .rooms-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content-area { padding: 14px; }
}
@media (max-width: 480px) {
  .auth-box { padding: 26px 16px; }
  .stats-grid { grid-template-columns: 1fr; }
}
