/* ===== قسم البحث — Gemini dark ===== */
body.logged-in.search-page-active {
  background-color: #050508;
  background-image:
    radial-gradient(ellipse 90% 70% at 50% 38%, rgba(30, 64, 175, 0.38) 0%, rgba(15, 23, 42, 0.22) 42%, transparent 72%),
    radial-gradient(ellipse 60% 40% at 50% 55%, rgba(59, 130, 246, 0.12) 0%, transparent 68%);
}
body.logged-in.search-page-active .app-shell,
body.logged-in.search-page-active .wrap { background: transparent; }
body.logged-in.search-page-active #pg {
  --bg: transparent;
  --surface: rgba(255, 255, 255, 0.06);
  --surface2: rgba(255, 255, 255, 0.04);
  --surface-3: rgba(255, 255, 255, 0.08);
  --text: #f8fafc;
  --muted: rgba(255, 255, 255, 0.58);
  --faint: rgba(255, 255, 255, 0.38);
  --border-c: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.1);
  --border2: rgba(255, 255, 255, 0.14);
  --accent: #93c5fd;
  --accent2: #60a5fa;
  --accentWeak: rgba(96, 165, 250, 0.14);
}
body.logged-in.search-page-active .page-head .t h2,
body.logged-in.search-page-active .page-head .t h2::before { color: #f8fafc; }
body.logged-in.search-page-active .page-head .t p { color: rgba(255, 255, 255, 0.55); }

.search-page-layout.search-gemini { gap: 0; min-height: min(78vh, 720px); }
.search-gemini-center > .search-gemini-form {
  width: min(100%, 720px);
  margin: 0 auto 18px;
}
.search-gemini-center {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; width: 100%; max-width: 780px; margin: 0 auto;
  padding: 32px 16px 40px; gap: 22px;
  min-height: min(68vh, 620px);
  transition: min-height 0.25s ease, padding 0.25s ease;
}
.search-gemini-center--results {
  justify-content: flex-start; min-height: auto; padding-top: 20px; padding-bottom: 28px;
}
.search-gemini-center--database {
  align-items: stretch;
  justify-content: flex-start; min-height: auto;
  width: 100%; max-width: none;
  margin-inline: auto;
  padding-top: 16px; padding-bottom: 32px; padding-inline: 0;
  gap: 18px;
}
body.search-page-active:has(.search-gemini-center--database) .wrap {
  max-width: min(98vw, 1789px);
  margin-inline: auto;
  padding: 28px 32px 110px;
  box-sizing: border-box;
}
body.nav-sidebar.search-page-active:has(.search-gemini-center--database) .wrap {
  max-width: min(calc(100vw - var(--sidebar-w) - 96px), 1789px);
}
body.search-page-active:has(.search-gemini-center--database) .search-page-layout.search-gemini {
  width: min(104%, 1747px);
  max-width: 1747px;
  margin-inline: auto;
  align-items: stretch;
}
body.search-page-active:has(.search-gemini-center--database) .search-gemini-tabs-wrap {
  width: 100%;
  max-width: none;
  margin-inline: auto;
}
.search-gemini-greeting {
  margin: 0; font-size: clamp(22px, 4.2vw, 34px); font-weight: 400; line-height: 1.45;
  color: #fff; letter-spacing: -0.01em;
}

.search-gemini .visit-board-tabs {
  width: min(100%, 420px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px -16px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
}
.search-gemini .visit-board-tabs .visit-board-tab { color: rgba(255, 255, 255, 0.68); }
.search-gemini .visit-board-tabs .visit-board-tab:hover {
  background: rgba(255, 255, 255, 0.08); color: #fff;
}
.search-gemini .visit-board-tabs .visit-board-tab.active {
  background: rgba(255, 255, 255, 0.14); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.search-hub-panel { width: min(100%, 720px); margin: 0 auto; }
.search-gemini-form { width: 100%; }
.search-gemini-bar {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 58px;
  padding: 8px 10px 8px 14px;
  background: rgba(28, 28, 32, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  box-shadow: 0 12px 40px -18px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-gemini-bar:focus-within {
  border-color: rgba(147, 197, 253, 0.35);
  box-shadow: 0 16px 48px -16px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.search-gemini-bar-side { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.search-gemini-badge {
  font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, 0.72);
  padding: 6px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.search-gemini-input {
  flex: 1; min-width: 0; border: none; background: transparent;
  font-family: inherit; font-size: 16px; color: #fff;
  padding: 10px 8px; text-align: start;
}
.search-gemini-input:focus { outline: none; }
.search-gemini-input::placeholder { color: rgba(255, 255, 255, 0.42); }
.search-gemini-iconbtn {
  flex-shrink: 0; width: 36px; height: 36px; border: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: rgba(255, 255, 255, 0.78);
  cursor: pointer; transition: background 0.15s, color 0.15s;
  font-size: 20px; line-height: 1;
}
.search-gemini-iconbtn svg { width: 18px; height: 18px; }
.search-gemini-iconbtn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.search-gemini-go { background: rgba(255, 255, 255, 0.08); }
.search-gemini-db.is-active {
  background: rgba(167, 139, 250, 0.2);
  color: #e9d5ff;
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.28);
}
.search-gemini-db:hover { color: #e9d5ff; }

.search-suggestions {
  margin-top: 4px; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.search-suggestions-label { font-size: 12px; color: rgba(255, 255, 255, 0.45); font-weight: 500; }
.search-suggestion-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 720px; }
.search-suggestion-chip {
  border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.82); font-family: inherit; font-size: 12.5px; font-weight: 500;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: all 0.15s;
  backdrop-filter: blur(8px);
}
.search-suggestion-chip:hover {
  background: rgba(255, 255, 255, 0.1); border-color: rgba(147, 197, 253, 0.35); color: #fff;
}

.search-hub-results-wrap { width: 100%; margin-top: 8px; padding: 16px 4px 0; background: transparent; }
.search-results-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 14px; font-size: 13px; color: rgba(255, 255, 255, 0.55);
  border-bottom: none; padding-bottom: 0;
}
.search-results-count strong { color: #93c5fd; font-size: 15px; font-weight: 600; }
.search-results-query { color: rgba(255, 255, 255, 0.45); }
.search-hub-cards { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.search-result-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: 16px; text-align: right;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  transition: border-color 0.15s, background 0.15s;
}
.search-result-card:hover {
  border-color: rgba(147, 197, 253, 0.28);
  background: rgba(255, 255, 255, 0.09);
}
.search-result-card--clickable { cursor: pointer; }
.search-result-card--clickable:focus-visible {
  outline: 2px solid rgba(147, 197, 253, 0.55); outline-offset: 2px;
}
.search-result-hint {
  display: block; margin-top: 8px; font-size: 11px; color: rgba(255, 255, 255, 0.35);
}
.search-result-ico {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(96, 165, 250, 0.16); color: #93c5fd;
}
.search-result-ico svg { width: 18px; height: 18px; }
.search-result-body { flex: 1; min-width: 0; text-align: right; }
.search-result-body h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: #fff; }
.search-result-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
.search-result-phone {
  font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px; border-radius: 999px;
}
.search-result-notes { margin: 8px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, 0.52); line-height: 1.55; }
.search-empty-inline .empty {
  padding: 28px 16px; background: rgba(255, 255, 255, 0.04); border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.search-empty-inline .empty p { color: rgba(255, 255, 255, 0.55); }
.search-result-card .iconbtn {
  background: rgba(255, 255, 255, 0.06) !important; border-color: rgba(255, 255, 255, 0.1) !important;
  color: rgba(255, 255, 255, 0.72) !important;
}
.search-result-card .iconbtn:hover { color: #93c5fd !important; border-color: rgba(147, 197, 253, 0.35) !important; }

.search-gemini-db-panel {
  width: 100%;
  margin-inline: auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 48px -24px rgba(0, 0, 0, 0.55);
}
.search-gemini-db-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.search-gemini-db-head-main {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.search-gemini-db-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.search-gemini-db-tools .head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-db-import-btn { border-color: rgba(147, 197, 253, 0.28) !important; }
.search-gemini-db-tools .btn-danger {
  background: rgba(239, 68, 68, 0.14); border-color: rgba(248, 113, 113, 0.35); color: #fecaca;
}
.search-gemini-db-tools .btn-danger:hover { background: rgba(239, 68, 68, 0.24); color: #fff; }
.search-result-exam {
  font-size: 12.5px; color: rgba(255, 255, 255, 0.72);
  background: rgba(96, 165, 250, 0.12); border: 1px solid rgba(147, 197, 253, 0.2);
  padding: 4px 10px; border-radius: 999px;
}
.search-form-link {
  color: #93c5fd; text-decoration: none; font-weight: 600; word-break: break-all;
}
.search-form-link:hover { color: #bfdbfe; text-decoration: underline; }
.search-form-cell .search-form-link { display: inline-block; max-width: 100%; }
.search-db-table .notecell,
.search-db-table td.strong,
.search-db-table tbody td {
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  text-overflow: unset;
  max-width: none;
  line-height: 1.55;
  vertical-align: top;
}
.search-db-table .search-code-cell {
  min-width: 280px;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.65;
}
.search-gemini-db-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.search-gemini-db-scroll::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none;
}
.search-db-table { width: 100%; min-width: 100%; table-layout: auto; border-collapse: collapse; }
.search-db-table th:first-child,
.search-db-table td.strong { min-width: 170px; text-align: right; }
.search-db-table th:nth-child(2),
.search-db-table td:nth-child(2) { min-width: 150px; }
.search-db-table th:nth-child(3),
.search-db-table td:nth-child(3) { min-width: 110px; }
.search-db-table th:nth-child(4),
.search-db-table td:nth-child(4) { min-width: 220px; }
.search-db-table th:nth-child(5),
.search-db-table td:nth-child(5) { min-width: 320px; }
.search-gemini-db-tools .search {
  background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12);
}
.search-gemini-db-tools .search input { color: #fff; }
.search-gemini-db-tools .search svg { color: rgba(255, 255, 255, 0.55); }
.search-gemini-db-tools .btn { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.12); color: #fff; }
.search-gemini-db-tools .btn:hover { background: rgba(255, 255, 255, 0.14); }
.search-gemini-db-tools .search-meta { color: rgba(255, 255, 255, 0.45); font-size: 12px; }
.search-gemini-db-title { font-size: 15px; font-weight: 700; color: #fff; }
.search-gemini-db-count { font-size: 13px; color: rgba(255, 255, 255, 0.55); }
.search-gemini-db-count b { color: #93c5fd; }
.search-db-table th:last-child,
.search-db-table td:last-child { width: 88px; text-align: center; white-space: nowrap; }
.search-db-table thead th {
  background: rgba(255, 255, 255, 0.04) !important; color: rgba(255, 255, 255, 0.72) !important;
  font-size: 12px; font-weight: 600; padding: 11px 12px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.search-db-table tbody td {
  background: transparent !important; color: rgba(255, 255, 255, 0.88) !important;
  padding: 12px 14px !important; border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  vertical-align: top;
}
.search-db-table tbody td.strong { color: #fff !important; font-weight: 600; }
.search-db-table tbody td.num { color: rgba(255, 255, 255, 0.72) !important; }
.search-db-table tbody td.notecell { color: rgba(255, 255, 255, 0.72) !important; }
body.search-page-active .search-db-table tbody tr:hover { background: transparent !important; }
body.search-page-active .search-db-table tbody tr:hover td {
  background: rgba(96, 165, 250, 0.12) !important;
  color: rgba(255, 255, 255, 0.92) !important;
}
body.search-page-active .search-db-table tbody tr:hover td.strong { color: #fff !important; }
body.search-page-active .search-db-table tbody tr:hover td.num,
body.search-page-active .search-db-table tbody tr:hover td.notecell { color: rgba(255, 255, 255, 0.88) !important; }
.search-db-table .iconbtn {
  background: rgba(255, 255, 255, 0.06) !important; border-color: rgba(255, 255, 255, 0.1) !important;
  color: rgba(255, 255, 255, 0.72) !important;
}
.search-db-table .iconbtn:hover { color: #93c5fd !important; border-color: rgba(147, 197, 253, 0.3) !important; }

body.logged-in.search-page-active .head-tools .btn,
body.logged-in.search-page-active .head-tools .search input {
  background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); color: #fff;
}
body.logged-in.search-page-active .head-tools .search svg { color: rgba(255, 255, 255, 0.55); }

/* إلغاء التنسيق الفاتح القديم عند تفعيل وضع Gemini */
body.logged-in.search-page-active:has(.search-page-layout) {
  background-color: #050508 !important;
  background-image:
    radial-gradient(ellipse 90% 70% at 50% 38%, rgba(30, 64, 175, 0.38) 0%, rgba(15, 23, 42, 0.22) 42%, transparent 72%),
    radial-gradient(ellipse 60% 40% at 50% 55%, rgba(59, 130, 246, 0.12) 0%, transparent 68%) !important;
}

@media (max-width: 720px) {
  .search-gemini-greeting { font-size: 22px; }
  .search-gemini-bar { flex-wrap: wrap; border-radius: 22px; padding: 12px; }
  .search-gemini-input { text-align: right; order: 1; width: 100%; flex: 1 1 100%; }
  .search-gemini-bar-start { order: 2; }
  .search-gemini-bar-end { order: 3; margin-right: auto; }
  .search-tab-sub { display: block; width: 100%; margin-top: 2px; }
}

body.search-page-active .modal-body.search-contracted-detail-body,
body.search-page-active .modal-body.modal-body--view {
  display: flex; flex-direction: column; gap: 0; grid-template-columns: 1fr;
  width: 100%; max-height: min(62vh, 520px); padding: 18px 20px;
}
body.search-page-active .overlay--view .modal {
  max-width: min(96vw, 680px);
  background: #16181f;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 64px -20px rgba(0, 0, 0, 0.75);
}
body.search-page-active .overlay--view .modal-head {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
body.search-page-active .overlay--view .modal-head h3 {
  color: #f8fafc; line-height: 1.45; word-break: break-word;
}
body.search-page-active .overlay--view .modal-foot {
  border-top-color: rgba(255, 255, 255, 0.08);
  justify-content: flex-start; gap: 10px;
}
body.search-page-active .overlay--view .modal .x {
  background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.72);
}
body.search-page-active .overlay--view .modal .x:hover { color: #fca5a5; }
body.search-page-active .overlay--view .modal-foot .btn.ghost {
  background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.14); color: #e2e8f0;
}
body.search-page-active .overlay--view .modal-foot .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.12); color: #fff;
}
body.search-page-active .overlay--view #modalCancel {
  background: rgba(96, 165, 250, 0.18); border: 1px solid rgba(147, 197, 253, 0.35); color: #dbeafe;
}
body.search-page-active .overlay--view #modalCancel:hover {
  background: rgba(96, 165, 250, 0.28); color: #fff;
}
.search-contracted-detail { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.search-detail-row {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08);
}
.search-detail-label { font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, 0.48); }
.search-detail-value {
  font-size: 13.5px; color: rgba(255, 255, 255, 0.92); line-height: 1.6;
  white-space: normal; word-break: break-word;
}
.search-detail-exam {
  display: inline-block; font-size: 12.5px; color: #dbeafe;
  background: rgba(96, 165, 250, 0.18); border: 1px solid rgba(147, 197, 253, 0.32);
  padding: 5px 11px; border-radius: 999px;
}
.search-detail-phone {
  display: inline-block; font-size: 13px; color: #f1f5f9;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px; border-radius: 999px;
}
.search-detail-code {
  white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.75;
  color: #f1f5f9;
}
.search-detail-notes { white-space: pre-wrap; word-break: break-word; line-height: 1.65; color: rgba(255, 255, 255, 0.78); }
body.search-page-active .overlay--view .search-form-link { color: #93c5fd; }
body.search-page-active .overlay--view .search-form-link:hover { color: #bfdbfe; }
body.search-page-active .overlay--view .pill.blue { color: #dbeafe; background: rgba(96, 165, 250, 0.16); border-color: rgba(147, 197, 253, 0.3); }
body.search-page-active .overlay--view .pill.gray { color: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.1); }
