/* ============================================================
   Souqnests ERP — Custom Stylesheet
   ============================================================ */

:root {
  --sidebar-width: 250px;
  --topbar-height: 56px;
  --sidebar-bg: #1a2236;
  --sidebar-text: #c8cfe8;
  --sidebar-active-bg: rgba(255,255,255,0.1);
  --sidebar-active-text: #fff;
}

/* ── Layout ─────────────────────────────────────────────── */
body {
  background-color: #f0f2f8;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
}

#topbar {
  height: var(--topbar-height);
  z-index: 1050;
}

#sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  background-color: var(--sidebar-bg);
  transition: width 0.25s ease, transform 0.25s ease;
  z-index: 1040;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

#sidebar.collapsed {
  width: 0;
  transform: translateX(-100%);
}

.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
  transition: margin-left 0.25s ease;
}

.main-content.expanded {
  margin-left: 0;
}

/* ── Sidebar Nav ─────────────────────────────────────────── */
#sidebar .nav-link {
  color: var(--sidebar-text);
  font-size: 0.84rem;
  border-radius: 0;
  padding: 0.55rem 1.2rem;
  transition: background 0.15s ease, color 0.15s ease;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

#sidebar .nav-link.active {
  border-left: 3px solid #0d6efd;
}

#sidebar .sub-link {
  font-size: 0.82rem;
  padding-left: 2.8rem !important;
  color: #94a3b8;
}

#sidebar .sub-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}

.chevron-icon {
  transition: transform 0.2s;
}

.nav-link[aria-expanded="true"] .chevron-icon,
.nav-group.open > a .chevron-icon {
  transform: rotate(180deg);
}

/* ── Auth page ───────────────────────────────────────────── */
.auth-bg {
  background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 50%, #084298 100%);
  min-height: 100vh;
}

/* ── KPI Cards ───────────────────────────────────────────── */
.kpi-card { transition: transform 0.2s, box-shadow 0.2s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important; }
.kpi-icon { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }

/* ── Cards ───────────────────────────────────────────────── */
.card { border-radius: 0.625rem; }
.card-header { border-radius: 0.625rem 0.625rem 0 0 !important; font-size: 0.875rem; }

/* ── Tables ──────────────────────────────────────────────── */
.table th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.table td { vertical-align: middle; }

/* ── DataTables ──────────────────────────────────────────── */
.dataTables_wrapper .dataTables_filter input { border-radius: 6px !important; }
.dataTables_wrapper .dataTables_length select { border-radius: 6px !important; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { font-size: 0.72rem; font-weight: 500; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-sm { font-size: 0.8rem; }
.btn-group-sm > .btn { font-size: 0.78rem; padding: 0.2rem 0.45rem; }

/* ── Select2 ─────────────────────────────────────────────── */
.select2-container .select2-selection--single { height: calc(1.5em + 0.75rem + 2px) !important; }
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { line-height: 1.5 !important; padding-top: 0.375rem !important; }/* Select2 bootstrap-5 theme sets dropdown z-index to ~1070 which floats
   above Bootstrap modals (1055). Force it below any open modal. */
body.modal-open .select2-container .select2-dropdown {
  z-index: 1040 !important;
}
/* ── Form ────────────────────────────────────────────────── */
.form-label { font-weight: 500; margin-bottom: 0.25rem; font-size: 0.84rem; }
.form-control, .form-select { font-size: 0.875rem; }
.form-control:focus, .form-select:focus { border-color: #86b7fe; box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.2); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { border-radius: 0.5rem; font-size: 0.875rem; }

/* ── Print ───────────────────────────────────────────────── */
@media print {
  #sidebar, #topbar, .no-print, .btn, .btn-group, .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
  #sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .kpi-card .fs-2 { font-size: 1.5rem !important; }
}

/* ── Utilities ───────────────────────────────────────────── */
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cursor-pointer { cursor: pointer; }
.border-dashed { border-style: dashed !important; }
code.text-primary { background: rgba(13,110,253,0.08); padding: 0.1rem 0.35rem; border-radius: 0.25rem; font-size: 0.8rem; }

/* ── Status Colors ───────────────────────────────────────── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.status-dot.active { background: #198754; }
.status-dot.inactive { background: #6c757d; }
.status-dot.pending { background: #ffc107; }
