/* ============================================================
   JR CLIENT MANAGER — style.css
   ============================================================ */

:root {
  --sidebar-w: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-border: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-active-bg: #2563eb;
  --sidebar-active-text: #fff;
  --topnav-h: 60px;
  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--body-bg);
  color: var(--text-primary);
  margin: 0;
  font-size: 14px;
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 0 20px;
  height: var(--topnav-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.sidebar-logo i {
  font-size: 20px;
  color: var(--primary);
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 12px 0;
  flex: 1;
}

.sidebar-menu .menu-label {
  color: #475569;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 16px 20px 6px;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0;
  transition: all .15s;
  font-size: 13.5px;
}

.sidebar-menu li a i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-menu li a:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.sidebar-menu li.active > a,
.sidebar-menu li.active > a:hover {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  font-size: 12px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}

/* ---- MAIN WRAPPER ---- */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s ease;
}

.main-wrapper.expanded {
  margin-left: 0;
}

/* ---- TOP NAVBAR ---- */
.topnav {
  height: var(--topnav-h);
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.sidebar-toggle {
  color: var(--text-muted);
  font-size: 18px;
  padding: 4px 8px;
}

.topnav-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
  flex: 1;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- PAGE CONTENT ---- */
.page-content {
  padding: 24px;
  flex: 1;
}

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #eff6ff; color: var(--primary); }
.stat-icon.green  { background: #f0fdf4; color: var(--success); }
.stat-icon.orange { background: #fffbeb; color: var(--warning); }
.stat-icon.red    { background: #fef2f2; color: var(--danger); }
.stat-icon.teal   { background: #f0fdfa; color: var(--info); }

.stat-info { flex: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- CARDS ---- */
.crm-card {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.crm-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
}

.crm-card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-card-body { padding: 0; }

/* ---- TABLES ---- */
.table-crm {
  margin: 0 !important;
  font-size: 13.5px;
}

.table-crm th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--border-color) !important;
  padding: 12px 16px !important;
  white-space: nowrap;
}

.table-crm td {
  padding: 12px 16px !important;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9 !important;
}

.table-crm tbody tr:hover { background: #f8fafc; }
.table-crm tbody tr:last-child td { border-bottom: none !important; }

/* ---- AVATAR ---- */
.client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

/* ---- CLIENT INFO ---- */
.client-info { display: flex; align-items: center; gap: 10px; }
.client-name { font-weight: 600; color: var(--text-primary); }
.client-email { font-size: 12px; color: var(--text-muted); }

/* ---- EXPIRY URGENCY ROW COLORS ---- */
tr.urgency-danger { background: #fff5f5 !important; }
tr.urgency-warning { background: #fffbeb !important; }

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.page-header .breadcrumb {
  font-size: 12px;
  margin: 0;
}

/* ---- FORM CARD ---- */
.form-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.form-control, .form-select {
  border-color: var(--border-color);
  border-radius: 8px;
  font-size: 13.5px;
  padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ---- BUTTONS ---- */
.btn { border-radius: 8px; font-size: 13px; font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* ---- BADGES ---- */
.badge { font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }

/* ---- SEARCH BAR ---- */
.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-bar .form-control,
.search-bar .form-select {
  max-width: 220px;
}

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo i { font-size: 48px; color: var(--primary); }
.login-logo h2 { font-size: 20px; font-weight: 700; margin: 8px 0 0; }
.login-logo p  { color: var(--text-muted); font-size: 13px; margin: 4px 0 0; }

/* ---- DETAIL PROFILE ---- */
.profile-card {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  padding: 28px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin: 0 auto 16px;
}

.info-row { display: flex; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.info-row:last-child { border-bottom: none; }
.info-label { width: 140px; color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; flex-shrink: 0; padding-top: 2px; }
.info-value { color: var(--text-primary); font-size: 14px; }

/* ---- REMINDER LOG TABLE ---- */
.reminder-type { display: flex; align-items: center; gap: 8px; }

/* ---- SETTINGS ---- */
.settings-section { margin-bottom: 32px; }
.settings-section h5 { font-weight: 700; color: var(--text-primary); font-size: 15px; border-bottom: 2px solid var(--border-color); padding-bottom: 10px; margin-bottom: 20px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 0 999px rgba(0,0,0,.5); }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 16px; }
  .stat-value { font-size: 22px; }
  .search-bar .form-control, .search-bar .form-select { max-width: 100%; }
  .login-card { margin: 20px; padding: 32px 24px; }
}

/* ---- DATATABLES OVERRIDE ---- */
div.dataTables_wrapper div.dataTables_filter input { border-radius: 8px; border: 1px solid var(--border-color); padding: 6px 12px; font-size: 13px; }
div.dataTables_wrapper div.dataTables_length select { border-radius: 8px; border: 1px solid var(--border-color); padding: 6px 10px; }
div.dataTables_wrapper { padding: 16px 20px; }
div.dataTables_wrapper div.dataTables_info { font-size: 12px; color: var(--text-muted); }

/* ---- MISC ---- */
.text-truncate-150 { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
