/* =====================================================================
   Rawan-CRM — Professional theme polish
   Layered on top of Perfex CRM's default styling + Tailwind's stock
   "blue" primary palette (tailwind.config.js: primary = colors.blue),
   already used for buttons/active-states everywhere. This file adds
   the same blue to hardcoded core-CSS spots (focus rings, checkboxes,
   active tabs, scrollbar, settings flyout) so the whole UI reads as
   one consistent color, plus a light orange accent for secondary
   highlights (avatars, minor emphasis) — mirroring the reference
   dashboard design. Typography, spacing, shape and micro-interactions
   round it out so the whole platform (admin + customer portal, every
   module) reads as one clean, professional, simple product.
   ===================================================================== */

:root {
  --brand-blue: #2a78d6;
  --brand-blue-dark: #1c5cab;
  --brand-orange: #eb6834;
}

/* ---------- Typography ---------- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

body,
.btn,
.form-control,
input,
select,
textarea,
.dropdown-menu,
table {
  font-family: 'Cairo', 'Inter', -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif !important;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6,
.panel-title, .modal-title {
  font-weight: 700 !important;
  letter-spacing: -0.01em;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: rgba(42, 120, 214, 0.22);
  border-radius: 100px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(42, 120, 214, 0.4);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(42, 120, 214, 0.25) transparent;
}

/* ---------- Sidebar polish ---------- */
#menu.sidebar #side-menu > li > a {
  border-radius: 8px;
  margin: 1px 10px;
  width: calc(100% - 20px);
  transition: background-color .15s ease, color .15s ease;
}
#menu.sidebar #side-menu > li.active > a,
#menu.sidebar #side-menu > li:hover > a {
  border-radius: 8px;
}
#menu.sidebar .menu-icon {
  opacity: .85;
}
#menu.sidebar #side-menu .nav-second-level {
  padding-inline-start: 8px;
}
#menu.sidebar .sidebar-user-profile .dropdown-toggle {
  transition: background-color .15s ease;
}

/* ---------- Top header polish ---------- */
#header {
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  border-bottom: 1px solid rgba(16, 24, 40, .06);
}
#top_search input#search_input {
  border-radius: 10px !important;
}

/* ---------- Cards / panels ---------- */
.panel,
.panel_s {
  border-radius: 12px !important;
  border-color: rgba(11, 11, 11, .10) !important;
  box-shadow: none !important;
}
.panel-heading {
  border-top-left-radius: 12px !important;
  border-top-right-radius: 12px !important;
}
.panel-footer {
  border-bottom-left-radius: 12px !important;
  border-bottom-right-radius: 12px !important;
}

/* Recurring KPI / summary tile pattern used across list pages
   (clients, leads, invoices, projects, ...) */
.tw-rounded-lg.tw-shadow-sm.tw-border.tw-border-solid.tw-bg-white,
[class*="tw-border-neutral-300"][class*="tw-shadow-sm"][class*="tw-rounded-lg"] {
  transition: box-shadow .15s ease, transform .15s ease;
}
.tw-rounded-lg.tw-shadow-sm.tw-border.tw-border-solid.tw-bg-white:hover {
  box-shadow: 0 4px 10px rgba(16, 24, 40, .08) !important;
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: 9px;
  font-weight: 600;
  letter-spacing: 0;
  transition: filter .12s ease, box-shadow .12s ease, transform .05s ease;
}
.btn:active {
  transform: translateY(0.5px);
}
.btn-primary {
  box-shadow: 0 1px 2px rgba(23, 48, 79, .18);
}
.btn-primary:hover {
  filter: brightness(1.08);
}
.btn-default {
  border-color: #dde1e7;
}

/* ---------- Forms ---------- */
.form-control,
.selectpicker + .dropdown-toggle,
.bootstrap-tagsinput {
  border-radius: 9px !important;
  border-color: #dde1e7;
}
.form-control:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(42, 120, 214, .14) !important;
}
.form-group label:not(.control-label-checkbox) {
  font-weight: 600;
  color: #33404f;
}
.checkbox-primary input[type="checkbox"]:checked + label::before,
.checkbox input[type="checkbox"]:checked + label::before {
  background-color: var(--brand-blue);
  border-color: var(--brand-blue);
}

/* ---------- Tables ---------- */
table.dataTable thead > tr > th,
.table > thead > tr > th {
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom-width: 1px !important;
}
.table-hover > tbody > tr:hover > td,
table.dataTable tbody tr:hover td {
  background-color: #f6f7f9 !important;
}
.table > tbody > tr > td {
  vertical-align: middle;
}

/* ---------- Badges / labels / status pills ---------- */
.label,
.badge {
  border-radius: 100px !important;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 3px 10px;
}
.label {
  border: none !important;
}

/* ---------- Tabs ---------- */
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:focus,
.nav-tabs > li.active > a:hover {
  border-bottom: 2px solid var(--brand-blue);
  font-weight: 700;
  color: var(--brand-blue);
}
.customer-tabs a.tw-bg-neutral-50 {
  font-weight: 600;
}

/* ---------- Dropdowns / modals ---------- */
.dropdown-menu {
  border-radius: 12px;
  border: 1px solid rgba(16, 24, 40, .08);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .12);
  padding: 6px;
}
.dropdown-menu > li > a {
  border-radius: 8px;
}
.modal-content {
  border-radius: 16px;
  overflow: hidden;
  border: none;
  box-shadow: 0 20px 50px rgba(16, 24, 40, .25);
}

/* ---------- Avatars ---------- */
.staff-profile-image-small,
.profile-image-small {
  border-radius: 50% !important;
}

/* ---------- Setup / customizer flyout panel (gear icon at bottom of sidebar) ----------
   It shares the .sidebar class with the main sidebar so it correctly inherits the navy
   background, but its text needs an explicit light color for contrast. */
#setup-menu-wrapper.sidebar {
  background-color: var(--brand-blue-dark) !important;
}
#setup-menu-wrapper .customizer-heading,
#setup-menu-wrapper .close-customizer,
#setup-menu > li > a,
#setup-menu > li > a .menu-text,
#setup-menu > li > a i.menu-icon,
#setup-menu > li:first-child {
  color: #e7ecf3 !important;
}
#setup-menu > li > a:hover,
#setup-menu > li > a:focus,
#setup-menu > li.active > a {
  background-color: var(--brand-blue) !important;
  color: #ffffff !important;
  border-radius: 8px;
}
#setup-menu li .nav-second-level {
  background-color: rgba(255, 255, 255, .04);
}
#setup-menu li .nav-second-level li > a,
#setup-menu li .nav-second-level li > a .sub-menu-text {
  color: #c7d1e0 !important;
}
#setup-menu li .nav-second-level li > a:hover,
#setup-menu li .nav-second-level li > a:focus {
  color: #ffffff !important;
}

/* ---------- Login screen ---------- */
body.login_admin .panel,
body.login_admin .panel_s {
  border-radius: 18px !important;
}

/* =====================================================================
   Rawan-CRM — Simplified dashboard (scoped under .rd-*)
   Mirrors the reference wireframe: stat tiles, chart+tasks, tables,
   team workload, contract reminders, meetings, reports grid.
   Reuses the brand tokens above; only new, dashboard-specific pieces
   (that Perfex's core CSS has no equivalent for) are defined here.
   ===================================================================== */
.rd-note {
  background: rgba(42, 120, 214, .08);
  border: 1px solid rgba(11, 11, 11, .10);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 12.5px;
  color: #52514e;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.rd-note b { color: #0b0b0b; }

.rd-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.rd-stat-card {
  background: #fff;
  border: 1px solid rgba(11, 11, 11, .10);
  border-radius: 12px;
  padding: 16px 18px;
}
.rd-stat-label { font-size: 12.5px; color: #898781; margin-bottom: 8px; }
.rd-stat-value { font-size: 26px; font-weight: 700; color: #0b0b0b; }
.rd-stat-delta { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.rd-stat-delta.up { color: #0ca30c; }
.rd-stat-delta.down { color: #d03b3b; }

.rd-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.rd-row.rd-row-even { grid-template-columns: 1fr 1fr; }

.rd-card {
  background: #fff;
  border: 1px solid rgba(11, 11, 11, .10);
  border-radius: 12px;
  padding: 16px 18px;
}
.rd-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.rd-card-title { font-size: 14.5px; font-weight: 700; color: #0b0b0b; }
.rd-card-link { font-size: 12px; color: var(--brand-blue); cursor: pointer; text-decoration: none; }
.rd-card-link:hover { color: var(--brand-blue-dark); text-decoration: none; }
.rd-table .rd-cell-main a { color: inherit; text-decoration: none; }
.rd-table .rd-cell-main a:hover { color: var(--brand-blue); }

.rd-chart-wrap { position: relative; }
.rd-chart { width: 100%; height: 190px; display: block; overflow: visible; }
.rd-bar { fill: var(--brand-blue); cursor: pointer; }
.rd-bar:hover { fill: var(--brand-blue-dark); }
.rd-chart-axis-label { font-size: 10.5px; fill: #898781; }
.rd-tooltip {
  position: absolute; pointer-events: none;
  background: #0b0b0b; color: #fff;
  font-size: 11.5px; padding: 5px 9px; border-radius: 6px;
  transform: translate(-50%, -120%); opacity: 0; transition: opacity .1s;
  white-space: nowrap;
}

.rd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rd-table th {
  text-align: right; color: #898781; font-weight: 600; font-size: 11.5px;
  padding: 6px 8px; border-bottom: 1px solid #e1e0d9;
}
.rd-table td { padding: 9px 8px; border-bottom: 1px solid #e1e0d9; color: #52514e; }
.rd-table tr:last-child td { border-bottom: none; }
.rd-table tr:hover td { background: #f9f9f7; }
.rd-table .rd-cell-main { color: #0b0b0b; font-weight: 600; }

.rd-badge {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 3px 9px; border-radius: 100px; font-size: 11px; font-weight: 600;
}
.rd-badge .rd-dot { width: 6px; height: 6px; border-radius: 50%; }
.rd-badge.rd-good { background: rgba(12, 163, 12, .1); color: #0a7a0a; }
.rd-badge.rd-good .rd-dot { background: #0ca30c; }
.rd-badge.rd-warning { background: rgba(250, 178, 25, .14); color: #8a5c00; }
.rd-badge.rd-warning .rd-dot { background: #b5790a; }
.rd-badge.rd-critical { background: rgba(208, 59, 59, .1); color: #d03b3b; }
.rd-badge.rd-critical .rd-dot { background: #d03b3b; }
.rd-badge.rd-neutral { background: #f9f9f7; color: #898781; }
.rd-badge.rd-neutral .rd-dot { background: #898781; }

.rd-task { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #e1e0d9; }
.rd-task:last-child { border-bottom: none; }
.rd-task input { width: 16px; height: 16px; accent-color: var(--brand-blue); }
.rd-task-name { flex: 1; font-size: 13px; color: #0b0b0b; }
.rd-task-name.rd-done { text-decoration: line-through; color: #898781; }
.rd-task-meta { font-size: 11.5px; color: #898781; white-space: nowrap; }

.rd-team-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #e1e0d9; }
.rd-team-row:last-child { border-bottom: none; }
.rd-team-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12.5px; font-weight: 700;
}
.rd-team-info { flex: 1; min-width: 0; }
.rd-team-name { font-size: 13px; font-weight: 600; color: #0b0b0b; }
.rd-team-role { font-size: 11.5px; color: #898781; }
.rd-team-load { width: 120px; flex-shrink: 0; }
.rd-team-load-label { font-size: 11px; color: #898781; margin-bottom: 4px; text-align: left; }
.rd-workload-bar { width: 100%; height: 6px; border-radius: 4px; background: #e1e0d9; overflow: hidden; }
.rd-workload-fill { height: 100%; border-radius: 4px; }

.rd-reminder-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #e1e0d9; }
.rd-reminder-row:last-child { border-bottom: none; }
.rd-reminder-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rd-reminder-info { flex: 1; min-width: 0; }
.rd-reminder-client { font-size: 13px; font-weight: 600; color: #0b0b0b; }
.rd-reminder-date { font-size: 11.5px; color: #898781; }
.rd-reminder-days { font-size: 12px; font-weight: 700; white-space: nowrap; }

.rd-meeting-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid #e1e0d9; }
.rd-meeting-row:last-child { border-bottom: none; }
.rd-meeting-time {
  width: 54px; flex-shrink: 0; text-align: center;
  font-size: 12.5px; font-weight: 700; color: var(--brand-blue);
  background: rgba(42, 120, 214, .1); border-radius: 8px; padding: 6px 4px;
}
.rd-meeting-info { flex: 1; min-width: 0; }
.rd-meeting-title { font-size: 13px; font-weight: 600; color: #0b0b0b; }
.rd-meeting-meta { font-size: 11.5px; color: #898781; }

.rd-reports-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.rd-report-tile {
  border: 1px solid rgba(11, 11, 11, .10); border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  text-decoration: none; color: inherit; transition: border-color .15s ease, box-shadow .15s ease;
}
.rd-report-tile:hover { border-color: var(--brand-blue); box-shadow: 0 2px 8px rgba(42, 120, 214, .12); text-decoration: none; }
.rd-report-tile-icon { width: 32px; height: 32px; border-radius: 8px; background: #f9f9f7; display: flex; align-items: center; justify-content: center; }
.rd-report-tile-icon svg { width: 17px; height: 17px; stroke: var(--brand-blue); fill: none; stroke-width: 1.7; }
.rd-report-tile-title { font-size: 13px; font-weight: 700; color: #0b0b0b; }
.rd-report-tile-desc { font-size: 11.5px; color: #898781; }
.rd-report-tile-link { font-size: 11.5px; color: var(--brand-blue); font-weight: 600; }
.rd-report-tile-link:hover { color: var(--brand-blue-dark); }

.rd-empty { font-size: 12.5px; color: #898781; padding: 12px 4px; text-align: center; }

@media (max-width: 900px) {
  .rd-row, .rd-row.rd-row-even { grid-template-columns: 1fr; }
  .rd-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .rd-reports-grid { grid-template-columns: repeat(2, 1fr); }
}
