/* =====================================================
   تمكين الخبرة - ملف CSS الرئيسي
   ===================================================== */

:root {
  --gold: #C9A84C;
  --gold-light: #F0D98C;
  --gold-pale: #FBF5E6;
  --navy: #1B3A6B;
  --navy-light: #2E5DA0;
  --navy-pale: #EEF2FA;
  --green: #3B6D11;
  --green-pale: #EAF3DE;
  --red: #A32D2D;
  --red-pale: #FBEAEA;
  --orange: #854F0B;
  --orange-pale: #FAEEDA;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #ffffff;
  --bg2: #f8f9fa;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --transition: 0.18s ease;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', Tahoma, 'Arial', sans-serif;
  direction: rtl;
  color: var(--text);
  background: var(--bg2);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--navy); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold); }
img { max-width: 100%; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; font-size: inherit; }

/* ===== Container ===== */
.container { max-width: 1140px; margin: 0 auto; padding: 0 1rem; }

/* ===== Navbar ===== */
.navbar {
  background: var(--navy);
  position: sticky; top: 0; z-index: 1000;
  box-shadow: 0 2px 12px rgba(27,58,107,0.25);
}
.navbar-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 62px;
}
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0;
}
.brand-text { color: #fff; font-size: 16px; font-weight: 600; }
.brand-badge {
  background: var(--gold); color: var(--navy);
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
}
.nav-links {
  display: flex; gap: 2px; flex: 1;
}
.nav-links a {
  color: rgba(255,255,255,.78);
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; display: flex; align-items: center; gap: 5px;
  transition: background var(--transition), color var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,.12); color: #fff;
}
.nav-links a.active { background: var(--gold); color: var(--navy); font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.notif-btn {
  position: relative; background: rgba(255,255,255,.12);
  border: none; color: #fff; font-size: 16px;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.notif-btn:hover { background: rgba(255,255,255,.22); }
.badge-notif {
  position: absolute; top: -3px; right: -3px;
  background: var(--gold); color: var(--navy);
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.user-menu-wrap { position: relative; }
.user-menu-trigger {
  background: rgba(255,255,255,.12); border: none; color: #fff;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: 20px;
  font-size: 13px; transition: background var(--transition);
}
.user-menu-trigger:hover { background: rgba(255,255,255,.22); }
.user-avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.user-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); left: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 180px;
  box-shadow: var(--shadow-md); overflow: hidden; z-index: 200;
}
.user-menu-wrap:hover .user-dropdown,
.user-menu-wrap:focus-within .user-dropdown { display: block; }
.user-dropdown a {
  display: block; padding: 10px 14px; font-size: 13.5px; color: var(--text);
  transition: background var(--transition);
}
.user-dropdown a:hover { background: var(--bg2); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); }
.logout-link { color: var(--red) !important; }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 22px; padding: 5px; }

/* ===== Main Content ===== */
.main-content { flex: 1; padding: 1.75rem 0 2.5rem; }

/* ===== Page Header ===== */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 22px; font-weight: 600; color: var(--navy); }
.page-header p  { color: var(--muted); margin-top: 4px; font-size: 14px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ===== Cards ===== */
.card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--navy); margin-bottom: 1rem; }

/* ===== Stats Grid ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stat-card .s-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-card .s-num   { font-size: 28px; font-weight: 600; color: var(--navy); line-height: 1; }
.stat-card .s-sub   { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card.gold .s-num { color: var(--gold); }

/* ===== Expert Card ===== */
.expert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.expert-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; text-align: center;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.expert-card:hover { border-color: var(--gold); box-shadow: var(--shadow-md); }
.avatar-xl {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 10px; border: 2px solid var(--border);
}
.avatar-placeholder {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; color: #fff; margin: 0 auto 10px;
  background: var(--navy);
}
.expert-card h3  { font-size: 14.5px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.expert-card p   { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field-badge {
  display: inline-block; font-size: 11px;
  padding: 2px 10px; border-radius: 20px;
  background: var(--gold-pale); color: var(--orange);
  margin-bottom: 6px;
}
.avail-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.avail-badge.on  { background: var(--green-pale);  color: var(--green); }
.avail-badge.off { background: var(--orange-pale); color: var(--orange); }
.star-full  { color: var(--gold); font-style: normal; }
.star-empty { color: #d1d5db; font-style: normal; }
.stars-row  { margin: 6px 0 10px; font-size: 13px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; border: 1.5px solid transparent;
  transition: all var(--transition); white-space: nowrap;
}
.btn-primary   { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-light); border-color: var(--navy-light); color: #fff; }
.btn-gold      { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: 600; }
.btn-gold:hover { background: #b8922f; border-color: #b8922f; color: #fff; }
.btn-outline   { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-block { width: 100%; justify-content: center; padding: 11px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); background: var(--bg);
  direction: rtl; transition: border-color var(--transition);
}
.form-control:focus { outline: none; border-color: var(--navy); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-text { font-size: 12px; color: var(--muted); margin-top: 3px; }
.meeting-types { display: flex; gap: 8px; }
.mt-option {
  flex: 1; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 8px; text-align: center; cursor: pointer;
  font-size: 13px; color: var(--muted); transition: all var(--transition);
  background: var(--bg);
}
.mt-option input { display: none; }
.mt-option .mt-icon { font-size: 20px; display: block; margin-bottom: 3px; }
.mt-option:has(input:checked),
.mt-option.selected {
  border-color: var(--navy); background: var(--navy-pale); color: var(--navy); font-weight: 600;
}

/* ===== Badges ===== */
.badge { display: inline-block; font-size: 11.5px; padding: 2px 10px; border-radius: 20px; font-weight: 500; }
.badge-success   { background: var(--green-pale);  color: var(--green); }
.badge-warning   { background: var(--orange-pale); color: var(--orange); }
.badge-danger    { background: var(--red-pale);    color: var(--red); }
.badge-secondary { background: var(--navy-pale);   color: var(--navy); }
.badge-light     { background: #f3f4f6; color: var(--muted); }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg2); font-size: 12.5px; font-weight: 600;
  color: var(--muted); padding: 10px 14px; border-bottom: 1.5px solid var(--border);
  text-align: right; white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
tbody tr:hover { background: var(--bg2); }
tbody tr:last-child td { border-bottom: none; }

/* ===== Alerts ===== */
.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 1rem; font-size: 14px; }
.alert-success { background: var(--green-pale);  color: var(--green); border: 1px solid #b2d88a; }
.alert-danger  { background: var(--red-pale);    color: var(--red);   border: 1px solid #e8a8a8; }
.alert-warning { background: var(--orange-pale); color: var(--orange);border: 1px solid #e8c27a; }
.alert-info    { background: var(--navy-pale);   color: var(--navy);  border: 1px solid #a8bfe8; }

/* ===== Auth Pages ===== */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.auth-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 420px; box-shadow: var(--shadow-md); }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo img { width: 60px; margin-bottom: 8px; }
.auth-logo h1 { font-size: 20px; color: var(--navy); }
.auth-logo p  { font-size: 13px; color: var(--muted); }

/* ===== Consultation List ===== */
.consult-list { display: flex; flex-direction: column; gap: 1px; }
.consult-item {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; align-items: flex-start; gap: 12px;
  transition: border-color var(--transition);
  margin-bottom: 8px;
}
.consult-item:hover { border-color: var(--gold); }
.consult-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.consult-icon.zoom     { background: #E8F4FF; }
.consult-icon.inperson { background: var(--green-pale); }
.consult-icon.phone    { background: var(--gold-pale); }
.consult-meta { flex: 1; }
.consult-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.consult-sub   { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.consult-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* ===== Library ===== */
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.lib-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow var(--transition); }
.lib-card:hover { box-shadow: var(--shadow-md); }
.lib-thumb { height: 90px; display: flex; align-items: center; justify-content: center; font-size: 36px; background: var(--navy); }
.lib-body { padding: 10px 12px; }
.lib-tag { font-size: 11px; background: var(--gold-pale); color: var(--orange); padding: 2px 8px; border-radius: 20px; }
.lib-title  { font-size: 13px; font-weight: 600; color: var(--text); margin: 5px 0 3px; line-height: 1.5; }
.lib-expert { font-size: 12px; color: var(--muted); }
.lib-meta   { font-size: 11px; color: var(--muted); margin-top: 5px; }

/* ===== Notifications ===== */
.notif-list { display: flex; flex-direction: column; }
.notif-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.notif-row:last-child { border-bottom: none; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); margin-top: 5px; flex-shrink: 0; }
.notif-dot.read { background: var(--border); }
.notif-body { flex: 1; }
.notif-text { font-size: 13.5px; color: var(--text); line-height: 1.6; }
.notif-time { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ===== Rating Stars Input ===== */
.rating-input { display: flex; gap: 6px; flex-direction: row-reverse; justify-content: flex-end; }
.rating-input input { display: none; }
.rating-input label { font-size: 30px; color: #d1d5db; cursor: pointer; transition: color var(--transition); }
.rating-input input:checked ~ label,
.rating-input label:hover,
.rating-input label:hover ~ label { color: var(--gold); }

/* ===== Search Bar ===== */
.search-row { display: flex; gap: 8px; margin-bottom: 1.25rem; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 180px; }

/* ===== Profile ===== */
.profile-avatar-wrap { position: relative; display: inline-block; margin-bottom: 1rem; }
.profile-avatar-wrap img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 3px solid var(--border); }
.avatar-change-btn {
  position: absolute; bottom: 0; right: 0;
  background: var(--navy); color: #fff; border: none;
  border-radius: 50%; width: 28px; height: 28px; font-size: 14px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* ===== Footer ===== */
.site-footer { background: var(--navy); color: rgba(255,255,255,.7); margin-top: auto; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 1.25rem 1rem; }
.footer-brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.footer-brand strong { display: block; font-size: 14px; }
.footer-brand small  { font-size: 11px; opacity: .7; }
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-links a { color: rgba(255,255,255,.7); font-size: 13px; }
.footer-links a:hover { color: var(--gold); }
.footer-copy { font-size: 12px; }

/* ===== Bar Chart ===== */
.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.bar-label { width: 100px; text-align: right; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; background: var(--bg2); border-radius: 4px; height: 10px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 4px; background: var(--navy); transition: width .5s ease; }
.bar-fill.gold { background: var(--gold); }
.bar-val   { width: 30px; font-weight: 600; color: var(--text); }

/* ===== Admin Tabs ===== */
.tab-bar { display: flex; gap: 2px; border-bottom: 1.5px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tab-item { background: none; border: none; border-bottom: 2.5px solid transparent; color: var(--muted); padding: 9px 16px; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: all var(--transition); margin-bottom: -1.5px; }
.tab-item.active { color: var(--navy); border-bottom-color: var(--gold); font-weight: 600; }
.tab-item:hover:not(.active) { color: var(--text); }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  font-size: 13.5px; border: 1px solid var(--border);
  color: var(--text); background: var(--bg);
}
.pagination a:hover { background: var(--navy-pale); border-color: var(--navy); }
.pagination .current { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 62px; right: 0; left: 0; background: var(--navy); padding: 1rem; z-index: 999; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .expert-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .meeting-types { flex-direction: column; }
  .page-header-row { flex-direction: column; align-items: flex-start; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.25rem; }
}
