/* ============================================================
   LawyerMate Design System
   Bootstrap 5.3 + AdminLTE 4 skin overrides
   ============================================================ */

:root {
  --lm-brand: #5b9bd5;          /* light sky blue */
  --lm-brand-rgb: 91, 155, 213;
  --lm-brand-soft: #a8d8ea;     /* very light sky blue */
  --lm-accent: #7fb77e;         /* light leaf green */
  --lm-accent-rgb: 127, 183, 126;
  --lm-grey: #f2f5f8;           /* light grey background */
  --lm-grey-rgb: 242, 245, 248;
  --lm-sidebar-width: 250px;
  --lm-radius: 0.5rem;
  --lm-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --lm-table-head-bg: rgba(var(--lm-brand-rgb), 0.06);
}

/* ---------- Base ---------- */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background-color: var(--lm-grey);
}

/* App content pages keep their own container; give it breathing room */
.app-content .container {
  padding-top: 0.25rem;
}

/* Page titles used across pages (h3/h4 headers) */
.app-content h3,
.app-content h4 {
  font-weight: 600;
  color: var(--lm-brand);
}

[data-bs-theme="dark"] .app-content h3,
[data-bs-theme="dark"] .app-content h4 {
  color: var(--bs-body-color);
}

/* ---------- Branding ---------- */
.sidebar-brand {
  background: linear-gradient(135deg, var(--lm-brand) 0%, var(--lm-brand-soft) 100%);
}

.sidebar-brand .brand-link {
  color: #fff;
}

.sidebar-brand .brand-image {
  color: var(--lm-accent);
}

/* ---------- Cards ---------- */
.card {
  border-radius: var(--lm-radius);
  border: 1px solid var(--bs-border-color-translucent);
  box-shadow: var(--lm-card-shadow);
}

.card-header {
  font-weight: 600;
  background-color: var(--lm-table-head-bg);
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

/* Stat cards (dashboard) */
.stat-card {
  border: none;
  overflow: hidden;
  position: relative;
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
}

.stat-icon.bg-skyblue {
  background: var(--lm-brand);
}

.stat-icon.bg-leafgreen {
  background: var(--lm-accent);
}

.stat-icon.bg-lightgrey {
  background: #9fb3c8;
}

.stat-card .stat-text {
  min-width: 0;
  flex: 1 1 auto;
}

.stat-card .stat-text h6 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--lm-brand);
}

[data-bs-theme="dark"] .stat-card .stat-value {
  color: var(--bs-body-color);
}

/* ---------- Tables ---------- */
.table thead th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  background-color: var(--lm-table-head-bg);
  border-bottom-width: 1px;
  white-space: nowrap;
}

.table tbody td {
  vertical-align: middle;
}

/* DataTables tweaks */
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: 0.375rem 0.75rem;
  margin-left: 0.5rem;
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: 0.25rem 0.5rem;
}

/* ---------- Badges ---------- */
.badge {
  font-weight: 500;
  padding: 0.4em 0.65em;
}

/* ---------- Forms ---------- */
.form-label {
  font-weight: 500;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

.form-select,
.form-control {
  border-radius: calc(var(--bs-border-radius) * 0.8);
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: calc(var(--bs-border-radius) * 0.8);
}

.btn-primary {
  --bs-btn-bg: var(--lm-brand);
  --bs-btn-border-color: var(--lm-brand);
  --bs-btn-hover-bg: #4a8bc4;
  --bs-btn-hover-border-color: #4a8bc4;
  --bs-btn-active-bg: #4a8bc4;
  --bs-btn-active-border-color: #4a8bc4;
}

.btn-outline-primary {
  --bs-btn-color: var(--lm-brand);
  --bs-btn-border-color: var(--lm-brand);
  --bs-btn-hover-bg: var(--lm-brand);
  --bs-btn-hover-border-color: var(--lm-brand);
  --bs-btn-active-bg: var(--lm-brand);
  --bs-btn-active-border-color: var(--lm-brand);
}

.btn-success {
  --bs-btn-bg: var(--lm-accent);
  --bs-btn-border-color: var(--lm-accent);
  --bs-btn-hover-bg: #6aa869;
  --bs-btn-hover-border-color: #6aa869;
}

/* ---------- Sidebar ---------- */
.app-sidebar .nav-link {
  border-radius: 0.4rem;
  margin: 0 0.5rem 0.15rem;
}

.app-sidebar .nav-link.active {
  background-color: var(--lm-brand-soft);
  color: var(--lm-brand);
  font-weight: 600;
}

.app-sidebar .nav-link.active i {
  color: var(--lm-accent);
}

/* Sidebar section headers */
.sidebar-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bs-secondary-color);
  padding: 0.75rem 1rem 0.25rem;
  margin-top: 0.5rem;
}

/* ---------- Dropdown menu ---------- */
.dropdown-menu {
  border-radius: var(--lm-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--bs-border-color-translucent);
}

.dropdown-item i {
  margin-right: 0.4rem;
  width: 1.1rem;
  text-align: center;
}

/* ---------- Auth pages (login / register) ---------- */
.auth-wrapper {
  /*min-height: calc(100vh - 4rem);*/
  min-height: calc(100vh - 0rem);
 /* display: flex;*/
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card-lg {
  max-width: 560px;
}

.auth-card .card {
  border: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.auth-brand {
  color: var(--lm-brand);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ---------- List-page card grids ---------- */
.entity-card .card-title a {
  color: var(--lm-brand);
  font-weight: 600;
}

.entity-card .card-title a:hover {
  color: var(--lm-accent);
}

/* ---------- Print (reports) ---------- */
@media print {
  .app-header,
  .app-sidebar,
  .app-footer,
  .btn,
  .no-print {
    display: none !important;
  }

  .app-main,
  .app-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  body {
    background: #fff !important;
  }

  .card {
    border: none;
    box-shadow: none;
  }

  a[href]::after {
    content: "";
  }
}

/* ---------- Misc polish ---------- */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.select2-container {
  width: 100% !important;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   App shell (mobile-first WebView)
   ============================================================ */
body {
  overflow-x: hidden;
}

.app-main::-webkit-scrollbar {
  width: 6px;
}

.app-main::-webkit-scrollbar-thumb {
  background: rgba(var(--lm-brand-rgb), 0.35);
  border-radius: 3px;
}

/* Auth pages use the viewport-safe unit */
.auth-wrapper {
  min-height: calc(100vh - 0rem);
  min-height: calc(100dvh - 0rem);
}

/* ---------- Mobile bottom navigation ---------- */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  display: flex;
  background-color: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

.mobile-bottom-nav a {
  flex: 1 1 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  font-size: 10.5px;
  text-decoration: none;
  color: var(--bs-secondary-color);
}

.mobile-bottom-nav a i {
  font-size: 1.3rem;
}

.mobile-bottom-nav a.active {
  color: var(--lm-brand);
  font-weight: 600;
}

.mobile-bottom-nav a .nav-badge {
  position: absolute;
  top: 4px;
  right: 18%;
  font-size: 9px;
  padding: 2px 5px;
}

/* Mobile: tighten content spacing + clear the fixed bottom nav */
@media (max-width: 991.98px) {
  .app-content {
    padding: 0.25rem 0.75rem 0;
  }

  .app-content > .container,
  .app-content > .container-fluid {
    padding-bottom: 4.25rem; /* clearance for the fixed bottom nav */
  }
}