/* ═══════════════════════════════════════════════════════
   Broker CRM — Custom Stylesheet
   Clean, professional, real-estate-grade look.
   Sections: Root · Navbar · Cards · Stat Cards · Tables
             Badges · Buttons · Forms · Docs · Modals
             Alerts · RTL · Responsive
   ═══════════════════════════════════════════════════════ */

/* ── Root & Global ────────────────────────────────────── */
:root {
  --bs-font-sans-serif: 'Segoe UI', Tahoma, Arial, sans-serif;
  --crm-primary:   #1a5276;
  --crm-focus-ring: rgba(26, 82, 118, 0.2);
  --crm-bg:        #f0f4f8;
  --crm-card-radius: 0.75rem;
}

body {
  background-color: var(--crm-bg);
  font-size: 0.9rem;
}

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  padding-block: 0.45rem;
}

.navbar .nav-link {
  padding: 0.38rem 0.7rem;
  border-radius: 0.375rem;
  transition: background 0.15s;
  font-size: 0.875rem;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
  background: rgba(255, 255, 255, 0.16);
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  border-radius: var(--crm-card-radius);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  transition: box-shadow 0.18s;
}

.card:hover {
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
  border-radius: var(--crm-card-radius) var(--crm-card-radius) 0 0 !important;
  font-size: 0.88rem;
  padding: 0.65rem 1rem;
}

.card-footer {
  border-radius: 0 0 var(--crm-card-radius) var(--crm-card-radius) !important;
}

/* ── Stat Cards ───────────────────────────────────────── */
.stat-card {
  border-radius: var(--crm-card-radius);
  transition: transform 0.18s, box-shadow 0.18s;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14) !important;
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.85;
}

.stat-number {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.78rem;
  opacity: 0.88;
  margin-top: 0.3rem;
  letter-spacing: 0.01em;
}

.stat-blue   { background: linear-gradient(135deg, #1a5276, #2e86c1); color: #fff; }
.stat-green  { background: linear-gradient(135deg, #1a7a3e, #28b463); color: #fff; }
.stat-gold   { background: linear-gradient(135deg, #9a7d0a, #d4ac0d); color: #fff; }
.stat-orange { background: linear-gradient(135deg, #b94329, #e74c3c); color: #fff; }

/* ── Tables ───────────────────────────────────────────── */
.table-responsive > .table {
  margin-bottom: 0;
}

.table th {
  font-size: 0.81rem;
  letter-spacing: 0.02em;
  font-weight: 600;
  white-space: nowrap;
}

.table tbody tr {
  transition: background-color 0.1s;
}

.table tbody tr:hover {
  background-color: #eef4ff;
}

/* Wrap the whole table card — slightly tighter inner padding */
.card > .table-responsive {
  border-radius: 0 0 var(--crm-card-radius) var(--crm-card-radius);
  overflow: hidden;
}

/* ── Badges ───────────────────────────────────────────── */
.badge {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.32em 0.62em;
  border-radius: 0.4rem;
  letter-spacing: 0.01em;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn-sm {
  font-size: 0.78rem;
}

/* Input-group "+" quick-add buttons */
.input-group .btn-outline-success {
  border-color: #198754;
  color: #198754;
}

.input-group .btn-outline-success:hover {
  background-color: #198754;
  color: #fff;
}

/* Back button — subtle */
.back-btn {
  color: #5d6d7e;
  border-color: #ced4da;
}

.back-btn:hover {
  background-color: #ecf0f1;
  border-color: #adb5bd;
  color: #2c3e50;
}

/* ── Forms ────────────────────────────────────────────── */
.form-label {
  font-size: 0.84rem;
  margin-bottom: 0.28rem;
  color: #2c3e50;
}

.form-control:focus,
.form-select:focus {
  border-color: #2e86c1;
  box-shadow: 0 0 0 0.2rem var(--crm-focus-ring);
}

/* ── Docs / File list ─────────────────────────────────── */
.list-group-item {
  transition: background-color 0.12s;
}

.list-group-item:hover {
  background-color: #f5f8fc;
}

/* Docs section footer upload */
.card-footer.bg-light {
  background-color: #f8f9fa !important;
  border-top: 1px solid #e9ecef;
}

/* ── Modals ───────────────────────────────────────────── */
.modal-content {
  border-radius: 0.75rem;
  border: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.modal-header {
  border-bottom: 1px solid #e9ecef;
  padding: 1rem 1.25rem 0.75rem;
}

.modal-footer {
  border-top: 1px solid #e9ecef;
  padding: 0.75rem 1.25rem;
}

/* ── Alerts ───────────────────────────────────────────── */
.alert {
  border-radius: 0.55rem;
  font-size: 0.87rem;
}

/* Docs notice — softer */
.docs-notice {
  background-color: #eaf4fb;
  border-color: #aed6f1;
  color: #1a5276;
}

/* Flash alerts */
.alert-success { border-inline-start: 4px solid #28b463; }
.alert-danger  { border-inline-start: 4px solid #e74c3c; }
.alert-info    { border-inline-start: 4px solid #2e86c1; }
.alert-warning { border-inline-start: 4px solid #f39c12; }

/* ── Overdue rows ─────────────────────────────────────── */
.table-danger td,
.table-warning td {
  font-weight: 500;
}

/* ── Scrollbar thin ───────────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: #f1f1f1; }
::-webkit-scrollbar-thumb  { background: #bbb; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #888; }

/* ── RTL-aware spacing ────────────────────────────────── */
[dir="rtl"] .ms-auto { margin-left: unset !important; margin-right: auto !important; }
[dir="rtl"] .me-1    { margin-right: unset !important; margin-left: 0.25rem !important; }
[dir="rtl"] .me-2    { margin-right: unset !important; margin-left: 0.5rem !important; }
[dir="rtl"] .ms-1    { margin-left: unset !important; margin-right: 0.25rem !important; }
[dir="rtl"] .ms-2    { margin-left: unset !important; margin-right: 0.5rem !important; }

/* Border inline start → correct side in both directions */
.alert-success,
.alert-danger,
.alert-info,
.alert-warning {
  border-inline-start-width: 4px;
  border-inline-start-style: solid;
}

/* ── Responsive: stat cards ───────────────────────────── */
@media (max-width: 575.98px) {
  .stat-number { font-size: 1.55rem; }
  .stat-icon   { font-size: 1.6rem; }
  .stat-label  { font-size: 0.72rem; }
  .navbar .nav-link { font-size: 0.82rem; padding: 0.3rem 0.5rem; }
}
