:root {
  --sidebar-w: 220px;
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --text-dark: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --bg-body: #f4f5f8;
  --bg-card: #ffffff;
  --radius: 8px;
  --font-sm: 12.5px;
}

* { box-sizing: border-box; }

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  font-size: var(--font-sm);
  background: var(--bg-body);
  color: var(--text-dark);
  margin: 0;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 100;
  transition: width .2s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; font-weight: 700; font-size: 15px;
  color: var(--primary); border-bottom: 1px solid var(--border-color);
}
.sidebar-brand i { font-size: 18px; }
.sidebar-nav { display: flex; flex-direction: column; padding: 6px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: var(--text-muted); text-decoration: none;
  font-size: 12.5px; font-weight: 500; border-left: 3px solid transparent;
}
.sidebar-nav a i { width: 16px; text-align: center; font-size: 13px; }
.sidebar-nav a:hover { background: var(--primary-light); color: var(--primary); }
.sidebar-nav a.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.sidebar-nav a.disabled { opacity: .5; cursor: not-allowed; }

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

.topbar {
  height: 52px; background: #fff; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 14px; padding: 0 16px; position: sticky; top: 0; z-index: 90;
}
.icon-btn {
  border: none; background: transparent; color: var(--text-muted); font-size: 14px;
  position: relative; cursor: pointer; padding: 6px 8px; border-radius: 6px;
}
.icon-btn:hover { background: var(--primary-light); color: var(--primary); }
.badge-dot { position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; background: #ef4444; border-radius: 50%; }
.topbar-search { flex: 1; max-width: 360px; display: flex; align-items: center; gap: 8px; background: var(--bg-body); border-radius: 6px; padding: 6px 10px; }
.topbar-search input { border: none; background: transparent; outline: none; font-size: var(--font-sm); width: 100%; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.admin-profile { display: flex; align-items: center; gap: 6px; padding-left: 10px; border-left: 1px solid var(--border-color); margin-left: 6px; }
.admin-profile img { width: 26px; height: 26px; border-radius: 50%; }
.admin-profile span { font-weight: 600; font-size: 12px; }

.page-content { padding: 16px 18px; flex: 1; }
.page-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.page-header h1 { font-size: 17px; font-weight: 700; margin: 0; }
.breadcrumb-mini { font-size: 11px; color: var(--text-muted); }

.app-footer {
  padding: 10px 18px; border-top: 1px solid var(--border-color); background: #fff;
  display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted);
}

/* Cards */
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius);
  padding: 12px 14px; display: flex; align-items: center; gap: 12px; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease; text-decoration: none; color: inherit;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
.stat-icon {
  width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; flex-shrink: 0;
}
.stat-card .stat-count { font-size: 20px; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 2px; }
.stat-card .stat-today { font-size: 11px; color: #16a34a; font-weight: 600; }

.panel {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 16px;
}
.panel-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.panel-title small { font-weight: 400; color: var(--text-muted); }

/* Tables */
table.dataTable { font-size: 12px; }
table.dataTable thead th { background: #fafafa; font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); padding: 7px 8px !important; }
table.dataTable tbody td { padding: 6px 8px !important; vertical-align: middle; }
.table-wrap { overflow-x: auto; }
.badge-status { font-size: 10.5px; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.badge-active, .badge-success, .badge-completed, .badge-paid { background: #dcfce7; color: #16a34a; }
.badge-inactive, .badge-failed, .badge-expired { background: #fee2e2; color: #dc2626; }
.badge-pending, .badge-suspended { background: #fef9c3; color: #ca8a04; }
.badge-high { background:#fee2e2;color:#dc2626; }
.badge-medium { background:#fef9c3;color:#ca8a04; }
.badge-low { background:#dbeafe;color:#2563eb; }

.btn-xs { padding: 3px 9px; font-size: 11px; }

.nav-tabs .nav-link { font-size: 12px; padding: 6px 12px; }
.form-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.form-control, .form-select { font-size: 12px; padding: 5px 8px; }

.progress { height: 8px; }

.plan-badge-Free{background:#e5e7eb;color:#374151;}
.plan-badge-Silver{background:#e5e7eb;color:#4b5563;}
.plan-badge-Gold{background:#fef3c7;color:#b45309;}
.plan-badge-Platinum{background:#ede9fe;color:#6d28d9;}
.plan-badge-Unpaid{background:#fee2e2;color:#dc2626;}
.plan-pill{font-size:10.5px;padding:3px 9px;border-radius:14px;font-weight:700;}

/* Advanced search */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 12px; }

/* User details */
.detail-card { background:#fff;border:1px solid var(--border-color);border-radius:var(--radius);padding:12px 14px;margin-bottom:14px; }
.detail-card h6 { font-size:12.5px;font-weight:700;color:var(--primary);margin-bottom:8px;text-transform:uppercase;letter-spacing:.4px; }
.kv-row { display:flex;justify-content:space-between;padding:4px 0;border-bottom:1px dashed #f0f0f0;font-size:12px; }
.kv-row span:first-child { color: var(--text-muted); }
.kv-row span:last-child { font-weight: 600; text-align:right; }
.avatar-lg { width:72px;height:72px;border-radius:10px;object-fit:cover;border:1px solid var(--border-color); }

@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar .brand-text, .sidebar-nav a span { display: none; }
  .main-content { margin-left: 60px; }
}


/* Alternating table row colors */
.table tbody tr:nth-child(odd) { background-color: #ffffff !important; }
.table tbody tr:nth-child(even) { background-color: #F2F2F2!important; }
.table tbody tr:hover { background-color: #f3f4f6 !important; }
table.dataTable tbody tr:nth-child(odd) { background-color: #ffffff !important; }
table.dataTable tbody tr:nth-child(even) { background-color: #F2F2F2!important; }
table.dataTable tbody tr:hover { background-color: #f3f4f6 !important; }
table.table tbody tr:nth-child(odd) { background-color: #ffffff !important; }
table.table tbody tr:nth-child(even) { background-color: #F2F2F2!important; }
table.table tbody tr:hover { background-color: #f3f4f6 !important; }
table.data-table tbody tr:nth-child(odd) { background-color: #ffffff !important; }
table.data-table tbody tr:nth-child(even) { background-color: #F2F2F2!important; }
table.data-table tbody tr:hover { background-color: #f3f4f6 !important; }

/* DataTables striping override */
table.dataTable.stripe tbody tr.odd { background-color: #ffffff !important; }
table.dataTable.stripe tbody tr.even { background-color: #F2F2F2!important; }
table.dataTable tbody tr.odd { background-color: #ffffff !important; }
table.dataTable tbody tr.even { background-color: #F2F2F2!important; }

/* Table row highlight classes */
.table tbody tr.row-highlight-danger { background-color: #fef2f2 !important; }
.table tbody tr.row-highlight-danger:hover { background-color: #fed7d7 !important; }
.table tbody tr.row-highlight-success { background-color: #ecfdf5 !important; opacity: 0.8; }
.table tbody tr.row-highlight-success:hover { background-color: #d1fae5 !important; }


/* Override Bootstrap table-striped */
.table-striped tbody tr:nth-child(odd) { background-color: #ffffff !important; }
.table-striped tbody tr:nth-child(even) { background-color: #F2F2F2!important; }
table tbody td { background-color: inherit !important; }


/* Maximum specificity for alternating rows */
table.data-table tbody tr:nth-child(2n) td,
table.dataTable tbody tr:nth-child(2n) td,
.table tbody tr:nth-child(2n) td { background-color: #F2F2F2!important; }

table.data-table tbody tr:nth-child(2n+1) td,
table.dataTable tbody tr:nth-child(2n+1) td,
.table tbody tr:nth-child(2n+1) td { background-color: #ffffff !important; }


/* Multi-select Dropdown Styles */
.multi-select-dropdown {
  position: relative;
  width: 100%;
}

.multi-select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  transition: border-color 0.2s ease;
}

.multi-select-trigger:hover {
  border-color: #9ca3af;
}

.multi-select-trigger i {
  font-size: 12px;
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.multi-select-trigger.open i {
  transform: rotate(180deg);
}

.multi-select-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 50;
  max-height: 300px;
  overflow-y: auto;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
  color: #374151;
  user-select: none;
  margin: 0;
}

.checkbox-option:hover {
  background: #f9fafb;
}

.checkbox-option input[type="checkbox"] {
  cursor: pointer;
  accent-color: #4f46e5;
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.checkbox-option:last-child {
  border-bottom: none;
}


/* User Suggestions Dropdown */
.user-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 50;
  max-height: 300px;
  overflow-y: auto;
}

.user-suggestion-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  user-select: none;
  transition: background 0.15s ease;
}

.user-suggestion-item:hover {
  background: #f9fafb;
}

.user-suggestion-item:last-child {
  border-bottom: none;
}

.user-suggestion-item-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-suggestion-item-name {
  font-weight: 500;
  color: #1f2937;
}

.user-suggestion-item-meta {
  color: #999;
  font-size: 12px;
}
