/* ============================================================
   HRMS Global Stylesheet — CodePulse IT Solutions Theme
   Brand palette sampled from official CodePulse logo
   ============================================================ */

:root {
  /* Brand palette (from logo) */
  --brand-gold:    #dfa426;
  --brand-orange:  #ca6b27;
  --brand-red:     #b42829;
  --brand-maroon:  #a51c36;
  --brand-maroon-dark: #6e1626;
  --brand-gradient: linear-gradient(90deg, var(--brand-gold) 0%, var(--brand-orange) 45%, var(--brand-red) 75%, var(--brand-maroon) 100%);
  --brand-gradient-soft: linear-gradient(135deg, rgba(223,164,38,.16) 0%, rgba(180,40,41,.14) 100%);

  --sidebar-width: 252px;
  --sidebar-bg: #14100f;
  --sidebar-bg-2: #1b1412;
  --sidebar-hover: rgba(223,164,38,.12);
  --sidebar-active: var(--brand-gradient);
  --topbar-height: 60px;
  --topbar-bg: #ffffff;

  --primary: var(--brand-maroon);
  --primary-dark: #841a2e;
  --primary-light: #fbeee9;
  --text-muted-light: #8a7f7a;
  --border-color: #ece3de;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 4px rgba(40,20,15,.08);
  --shadow: 0 4px 18px rgba(40,20,15,.10);

  /* Stat-card colors (referenced inline via var(--clr-*)) */
  --clr-primary: var(--brand-gradient);
  --clr-success: linear-gradient(135deg,#1ea672,#16855c);
  --clr-danger:  linear-gradient(135deg,#c0392b,#8e2418);
  --clr-info:    linear-gradient(135deg,#2f8fc2,#1f6f9c);
  --clr-warning: linear-gradient(135deg,var(--brand-gold),var(--brand-orange));
  --clr-orange:  linear-gradient(135deg,var(--brand-orange),var(--brand-red));
  --clr-purple:  linear-gradient(135deg,#7a4cc7,#5a2fae);
}

/* ---- Base ---- */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f6f3f1;
  font-size: .9rem;
  color: #2b2422;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: #cfc3bd;
  z-index: 1030;
  overflow-y: auto;
  transition: width .25s ease, transform .25s ease;
  border-right: 1px solid rgba(223,164,38,.18);
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(223,164,38,.35); border-radius: 4px; }

.sidebar-brand {
  border-bottom: 1px solid rgba(223,164,38,.16);
}
.sidebar-brand img.brand-logo { height: 30px; width: auto; display: block; }
.sidebar .brand-text {
  color: #fff;
  font-size: 1rem;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

.sidebar .nav-link {
  color: #cfc3bd;
  border-radius: var(--radius);
  padding: .55rem .8rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar .nav-link:hover  { background: var(--sidebar-hover); color: var(--brand-gold); }
.sidebar .nav-link.active {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 2px 10px rgba(180,40,41,.35);
}
.sidebar .nav-icon { width: 20px; text-align: center; flex-shrink: 0; }
.sidebar .nav-item + .nav-item { margin-top: 2px; }

.sidebar-avatar,
.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(223,164,38,.45);
}
.sidebar-avatar-placeholder,
.topbar-avatar-placeholder {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .78rem;
  flex-shrink: 0;
}

.sidebar-user { border-bottom: 1px solid rgba(223,164,38,.14); }

/* ---- Main wrapper ---- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left .25s ease;
}

.topbar {
  position: sticky; top: 0;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border-color);
  z-index: 1020;
  box-shadow: var(--shadow-sm);
}
.topbar .breadcrumb-item a { color: var(--primary); text-decoration: none; }
.topbar .breadcrumb-item.active { color: var(--text-muted-light); }
.topbar #sidebarToggle { border-color: var(--border-color); color: var(--primary); }
.topbar #sidebarToggle:hover { background: var(--primary-light); color: var(--primary-dark); }

.page-content { padding: 1.5rem; }

/* ---- Collapsed sidebar ---- */
body.sidebar-collapsed .sidebar {
  width: 64px;
}
body.sidebar-collapsed .sidebar .nav-label,
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar img.brand-logo,
body.sidebar-collapsed .sidebar .sidebar-user { display: none; }
body.sidebar-collapsed .main-wrapper { margin-left: 64px; }
body.sidebar-collapsed .sidebar .nav-link { justify-content: center; }

/* ---- Cards ---- */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  border-top-left-radius: var(--radius) !important;
  border-top-right-radius: var(--radius) !important;
}

/* ---- Stats cards ---- */
.stat-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  color: #fff;
  box-shadow: var(--shadow);
  min-height: 100px;
}
.stat-card .stat-icon {
  font-size: 2.5rem;
  opacity: .28;
  position: absolute;
  right: 1rem; bottom: .6rem;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; }
.stat-card .stat-label { font-size: .78rem; opacity: .92; }
.stat-card.bg-dark { background: linear-gradient(135deg,#1c1614,#2c1e1a) !important; }

/* ---- Tables ---- */
.table thead th {
  background: #fbf4ee;
  color: #6e493a;
  font-weight: 700;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid var(--border-color);
}
.table-hover tbody tr:hover { background: var(--primary-light); }
.table > :not(caption) > * > * { box-shadow: none; }

/* ---- Badges ---- */
.badge-status {
  font-size: .72rem;
  padding: .3em .65em;
  border-radius: 50px;
  font-weight: 600;
}
.badge.bg-primary { background: var(--brand-gradient) !important; }
.badge.bg-primary-subtle { background: var(--primary-light) !important; color: var(--primary) !important; }

/* ---- Forms ---- */
.form-label { font-weight: 600; font-size: .85rem; color: #5b4a42; }
.form-control, .form-select {
  border-radius: var(--radius);
  border-color: #e3d7cf;
  font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(202,107,39,.16);
}

/* ---- Buttons ---- */
.btn { border-radius: var(--radius); font-weight: 600; }
.btn-primary {
  background: var(--brand-gradient);
  border: none;
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  filter: brightness(1.08);
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(180,40,41,.35);
}
.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--brand-gradient);
  border-color: transparent;
  color: #fff;
}
.btn-xs { padding: .2rem .5rem; font-size: .75rem; border-radius: 6px; }

/* ---- Auth pages ---- */
.auth-wrapper {
  background: radial-gradient(circle at 20% 20%, rgba(223,164,38,.10), transparent 45%),
              radial-gradient(circle at 80% 80%, rgba(165,28,54,.12), transparent 45%),
              #0f0c0b;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.auth-logo { height: 52px; }
.auth-card .btn-primary { padding: .6rem 1rem; }

/* ---- Avatar in lists ---- */
.emp-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
}
.emp-avatar-placeholder {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--brand-gradient-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem;
}

/* ---- Page title icon accent ---- */
h5.fw-bold i.text-primary,
h5 i.text-primary { color: var(--brand-orange) !important; }

/* ---- Utilities ---- */
.cursor-pointer { cursor: pointer; }
.text-primary    { color: var(--primary) !important; }
.bg-brand-gradient { background: var(--brand-gradient) !important; }
.text-brand-gradient {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

/* ---- Map container ---- */
#map { height: 350px; border-radius: var(--radius); border: 1px solid var(--border-color); }

/* ---- Empty state ---- */
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--text-muted-light); }
.empty-state i { font-size: 2.4rem; opacity: .35; margin-bottom: .75rem; display:block; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  body.sidebar-collapsed .main-wrapper { margin-left: 0; }
}
