/* ============================================================
   AquaCare CRM — Custom Stylesheet
   Font: Plus Jakarta Sans + DM Sans
   ============================================================ */

:root {
  --primary:        #0c6cf2;
  --primary-dark:   #0a56c8;
  --primary-light:  #e8f1fe;
  --sidebar-bg:     #0d1b35;
  --sidebar-text:   #a8b9d0;
  --sidebar-hover:  rgba(255,255,255,0.07);
  --sidebar-active: rgba(12,108,242,0.25);
  --sidebar-w:      255px;
  --topbar-h:       64px;
  --surface:        #ffffff;
  --bg:             #f0f4fa;
  --border:         #e2e8f0;
  --text:           #1a2540;
  --text-muted:     #6b7fa3;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;
  --radius:         10px;
  --shadow:         0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  margin: 0;
}

h1, h2, h3, h4, h5, h6, .fw-semibold, .fw-bold {
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ---- LAYOUT ---- */
.wrapper {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.brand-icon {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
  flex-shrink: 0;
}

.brand-name {
  display: block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  line-height: 1;
}

.brand-sub {
  display: block;
  font-size: 10px;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

.sidebar-menu {
  flex: 1;
  padding: 12px 10px;
}

.sidebar-menu .nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(168,185,208,0.5);
  padding: 14px 8px 4px;
  list-style: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.sidebar-menu .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.18s;
  margin-bottom: 2px;
}

.sidebar-menu .nav-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-menu .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-menu .nav-link.active {
  background: var(--sidebar-active);
  color: #6fb3ff;
  font-weight: 600;
}

.sidebar-menu .nav-link.text-danger-nav { color: #f87171; }
.sidebar-menu .nav-link.text-danger-nav:hover { background: rgba(239,68,68,0.12); color: #f87171; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

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

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.user-role {
  font-size: 11px;
  color: var(--sidebar-text);
}

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.topbar-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  flex: 1;
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  padding: 4px;
  line-height: 1;
}

/* ---- PAGE BODY ---- */
.page-body {
  padding: 24px;
  flex: 1;
}

/* ---- CARDS ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
}

.card-body { padding: 18px; }

/* Stat Cards */
.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

.stat-card .stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Color variants */
.icon-blue   { background: #e8f1fe; color: var(--primary); }
.icon-green  { background: #d1fae5; color: var(--success); }
.icon-orange { background: #fef3c7; color: var(--warning); }
.icon-red    { background: #fee2e2; color: var(--danger); }
.icon-teal   { background: #d0f4f0; color: #0d9488; }

/* ---- TABLES ---- */
.table-wrapper {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: #fff;
}

.table {
  margin-bottom: 0;
  font-size: 13.5px;
}

.table thead th {
  background: #f8fafc;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  padding: 11px 14px;
  white-space: nowrap;
}

.table tbody td {
  padding: 11px 14px;
  vertical-align: middle;
  border-color: var(--border);
  color: var(--text);
}

.table tbody tr:hover { background: #f8fafc; }

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.table-toolbar .title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
}

/* ---- FORMS ---- */
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

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

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(12,108,242,0.12);
  outline: none;
}

/* ---- BUTTONS ---- */
.btn { border-radius: 8px; font-size: 13.5px; font-weight: 500; padding: 7px 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

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

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1b35 0%, #0c3476 50%, #0a56c8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.login-logo {
  width: 56px; height: 56px;
  background: var(--primary);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: #fff;
  margin: 0 auto 16px;
}

/* ---- SEARCH BOX ---- */
.search-box {
  position: relative;
  min-width: 220px;
}

.search-box input {
  padding-left: 34px;
}

.search-box i {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

/* ---- ALERT BOX ---- */
.alert { border-radius: 8px; font-size: 13.5px; }

/* ---- MISC ---- */
.page-header {
  margin-bottom: 22px;
}

.page-header h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  margin: 0;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ---- PAGINATION ---- */
.pagination .page-link {
  border-radius: 6px !important;
  margin: 0 2px;
  font-size: 13px;
  color: var(--text);
  border-color: var(--border);
}

.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

/* ---- AMC Alert ---- */
.amc-expiring { border-left: 4px solid var(--warning) !important; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: block;
  }
  .page-body {
    padding: 16px;
  }
  .stat-card .stat-value { font-size: 22px; }
  .topbar-title { font-size: 14px; }
  .table-wrapper { overflow-x: auto; }
}

@media (max-width: 576px) {
  .topbar-actions .btn span { display: none; }
  .login-card { padding: 28px 22px; }
}
