/* MurphFin — backoffice-ui.css */

/* ═══════ 21. ACCESSIBILITY & FOCUS ═══════ */

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}
button:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.15);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; /* Already has custom focus ring */
}

/* Respect user motion preferences */

/* Fix placeholder contrast for WCAG AA */
::placeholder { color: var(--brand-muted); }
input::placeholder, textarea::placeholder, select::placeholder { color: var(--brand-muted); }


/* ═══════ 22. PASSWORD TOGGLE ═══════ */

.password-wrapper {
  position: relative;
}
.password-wrapper input {
  padding-right: 42px;
}
.password-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 38px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--brand-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: color 0.15s;
}
.password-toggle:hover { color: var(--brand-navy); }


/* ═══════ 23. PASSWORD STRENGTH METER ═══════ */

.pwd-strength {
  display: flex;
  gap: 3px;
  margin-top: 6px;
  height: 3px;
}
.pwd-strength-bar {
  flex: 1;
  border-radius: var(--radius-sm);
  background: var(--brand-border);
  transition: background 0.3s;
}
.pwd-strength[data-level="1"] .pwd-strength-bar:nth-child(-n+1) { background: var(--brand-danger); }
.pwd-strength[data-level="2"] .pwd-strength-bar:nth-child(-n+2) { background: var(--brand-warning); }
.pwd-strength[data-level="3"] .pwd-strength-bar:nth-child(-n+3) { background: var(--brand-warning); }
.pwd-strength[data-level="4"] .pwd-strength-bar:nth-child(-n+4) { background: var(--brand-success); }
.pwd-strength-text {
  font-size: 0.72rem;
  margin-top: 2px;
  color: var(--brand-muted);
}


/* ═══════ 24. TABLE SORTING ═══════ */

.sortable-th {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px !important;
}
.sortable-th::after {
  content: '\f0dc';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 6px;
  font-size: 0.65rem;
  opacity: 0.3;
}
.sortable-th.sort-asc::after { content: '\f0de'; opacity: 0.7; color: var(--brand-blue); }
.sortable-th.sort-desc::after { content: '\f0dd'; opacity: 0.7; color: var(--brand-blue); }


/* ═══════ 25. PAGINATION ═══════ */

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--brand-border-light);
  font-size: 0.8rem;
  color: var(--brand-muted);
}
.pagination-bar .pagination {
  margin: 0;
  gap: 2px;
}
.pagination-bar .page-link {
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--brand-muted);
  background: transparent;
}
.pagination-bar .page-link:hover {
  background: var(--brand-surface-alt);
  color: var(--brand-navy);
}
.pagination-bar .page-item.active .page-link {
  background: var(--brand-navy);
  color: #fff;
}


/* ═══════ 26. TICKET FILTERS ═══════ */

.ticket-filters {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}
.ticket-filter-btn {
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--brand-border);
  background: var(--brand-surface);
  color: var(--brand-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.ticket-filter-btn:hover {
  border-color: var(--brand-navy);
  color: var(--brand-navy);
}
.ticket-filter-btn.active {
  background: var(--brand-navy);
  color: #fff;
  border-color: var(--brand-navy);
}
.ticket-filter-btn .badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius);
  margin-left: 4px;
}


/* ═══════ 27. BACKOFFICE SEARCH & FILTERS ═══════ */

.bo-search-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--brand-surface-alt);
  border-radius: var(--radius);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.bo-search-bar input,
.bo-search-bar select {
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-border);
}
.bo-search-bar input:focus,
.bo-search-bar select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.08);
}


/* ═══════ 28. FUNNEL CHART ═══════ */

.funnel-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.funnel-bar-wrapper {
  flex: 1;
  height: 28px;
  background: var(--brand-surface-alt);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.funnel-bar {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s ease-out;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.funnel-label {
  font-size: 0.78rem;
  font-weight: 500;
  min-width: 120px;
  color: var(--brand-text);
}
.funnel-value {
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 50px;
  text-align: right;
  color: var(--brand-navy);
}
.funnel-pct {
  font-size: 0.7rem;
  color: var(--brand-muted);
  min-width: 45px;
}


/* ═══════ 28b. BACKOFFICE DASHBOARD v2 ═══════ */

/* Nav dropdowns */
.bo-nav .dropdown { display: inline-flex; flex-shrink: 0; }
.bo-nav .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--brand-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.bo-nav .dropdown-toggle:hover { color: var(--brand-navy); border-bottom-color: var(--brand-blue); }
.bo-nav .dropdown-toggle i { font-size: 0.78rem; opacity: 0.6; }
.bo-nav .dropdown-toggle:hover i { opacity: 1; }
.bo-nav .dropdown-toggle::after { font-size: 0.55rem; margin-left: 2px; vertical-align: middle; }
.bo-nav .dropdown-menu { font-size: 0.82rem; min-width: 160px; border-radius: 0; border: 1px solid var(--brand-border); }
.bo-nav .dropdown-item { padding: 6px 14px; font-size: 0.8rem; }
.bo-nav .dropdown-item i { width: 18px; text-align: center; opacity: 0.6; }
.bo-nav .dropdown-item:hover i { opacity: 1; }
.bo-nav > a.bo-nav-active { color: var(--brand-navy); border-bottom-color: var(--brand-blue); }
.bo-nav > a.bo-nav-active i { opacity: 1; }

/* KPI unified grid */
.bo-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.bo-kpi-card { text-align: center; padding: 14px 10px; background: var(--brand-surface-alt, var(--brand-bg)); border-radius: var(--radius-sm); }
.bo-kpi-val { font-size: 1.4rem; font-weight: 700; color: var(--brand-text); line-height: 1.2; }
.bo-kpi-val--green { color: var(--brand-success); }
.bo-kpi-val--red { color: var(--brand-danger); }
.bo-kpi-val--amber { color: var(--brand-warning); }
.bo-kpi-lbl { font-size: 0.72rem; color: var(--brand-muted); margin-top: 2px; }
.bo-kpi-sub { font-size: 0.66rem; color: var(--brand-muted); margin-top: 2px; }

/* Visits table – truncated cells with click-to-reveal popover */
.bo-visits-table { table-layout: fixed; }
.bo-cell-clip {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.bo-cell-clip:hover { color: var(--brand-blue); }
.bo-cell-popover {
  position: absolute;
  z-index: 1060;
  max-width: 360px;
  padding: 10px 14px;
  font-size: 0.78rem;
  line-height: 1.4;
  word-break: break-all;
  color: var(--brand-text);
  background: var(--brand-surface, #1a1a2e);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.bo-cell-popover.show { opacity: 1; pointer-events: auto; }

/* Table row highlight */
.bo-row-pending { background: var(--brand-warning-bg) !important; }
.bo-row-hidden { display: none; }

/* Bandi table columns */
.bo-col-ord { width: 40px; }
.bo-col-actions { width: 120px; }
.bo-icon-bando { color: var(--fisit-red); }

/* ═══════ 29. CHAT AI IMPROVEMENTS ═══════ */

.chat-msg--ai .chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1A2F5E, #3b82f6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
}
.chat-msg-wrapper {
  display: flex;
  gap: 10px;
  max-width: 85%;
}
.chat-msg-wrapper--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-msg-wrapper--ai {
  align-self: flex-start;
}
.chat-rating {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.chat-msg-wrapper:hover .chat-rating { opacity: 1; }
.chat-rating-btn {
  background: none;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.7rem;
  color: var(--brand-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.chat-rating-btn:hover { border-color: var(--brand-blue); color: var(--brand-blue); }
.chat-rating-btn.rated { border-color: var(--brand-success); color: var(--brand-success); background: var(--brand-success-bg); }
