/* ============================================================
   Imara HRIS — Main Stylesheet
   assets/css/main.css
   ============================================================ */

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

:root {
  --green:       #0F6E56;
  --green-light: #E1F5EE;
  --green-mid:   #1D9E75;
  --blue:        #185FA5;
  --blue-light:  #E6F1FB;
  --amber:       #854F0B;
  --amber-light: #FAEEDA;
  --red:         #A32D2D;
  --red-light:   #FCEBEB;
  --gray-50:     #F8F8F6;
  --gray-100:    #F1EFE8;
  --gray-200:    #D3D1C7;
  --gray-400:    #888780;
  --gray-600:    #5F5E5A;
  --gray-900:    #1A1A18;
  --sidebar-w:   220px;
  --radius:      8px;
  --radius-lg:   12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-50);
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 0.5px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.25rem 1rem;
  border-bottom: 0.5px solid var(--gray-200);
}
.brand-mark {
  width: 36px; height: 36px;
  background: var(--green);
  color: #fff;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.brand-name { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.brand-sub  { font-size: 10px; color: var(--gray-400); }

.nav-links { list-style: none; padding: 0.75rem 0; flex: 1; }
.nav-links li a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 1rem;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.nav-links li a:hover  { background: var(--gray-50); color: var(--gray-900); }
.nav-links li a.active { background: var(--green-light); color: var(--green); border-left-color: var(--green); font-weight: 500; }
.nav-links li a svg    { flex-shrink: 0; }

.sidebar-footer { padding: 1rem; border-top: 0.5px solid var(--gray-200); }
.user-info       { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--green-light); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.user-name  { font-size: 12px; font-weight: 500; color: var(--gray-900); }
.user-role  { font-size: 11px; color: var(--gray-400); }
.logout-link { font-size: 12px; color: var(--gray-400); text-decoration: none; }
.logout-link:hover { color: var(--red); }

/* ---- Main content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 1.75rem 2rem;
  max-width: 1100px;
}

.page-footer { display: none; }

/* ---- Page header ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 20px; font-weight: 600; color: var(--gray-900); }
.page-header p  { font-size: 13px; color: var(--gray-400); margin-top: 2px; }

/* ---- Stat cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}
.stat-label { font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--gray-900); margin-top: 4px; }
.stat-sub   { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ---- Controls bar ---- */
.controls-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 1rem;
}
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
  color: var(--gray-900);
}
.search-wrap input:focus { outline: none; border-color: var(--green-mid); }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }

select, .filter-select {
  padding: 8px 10px;
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
  color: var(--gray-900);
  cursor: pointer;
}
select:focus { outline: none; border-color: var(--green-mid); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  border: 0.5px solid var(--gray-200);
  background: #fff; color: var(--gray-900);
  transition: background 0.15s;
}
.btn:hover    { background: var(--gray-100); }
.btn-primary  { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: #0c5c46; }
.btn-sm       { padding: 5px 12px; font-size: 12px; }
.btn-danger   { background: var(--red-light); color: var(--red); border-color: #F7C1C1; }
.btn-danger:hover { background: #F7C1C1; }

/* ---- Table ---- */
.table-wrap { background: #fff; border: 0.5px solid var(--gray-200); border-radius: var(--radius-lg); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 11px; font-weight: 500; color: var(--gray-400);
  text-align: left; padding: 10px 14px;
  border-bottom: 0.5px solid var(--gray-200);
  background: var(--gray-50);
  white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 0.5px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }
.td-primary { font-weight: 500; color: var(--gray-900); }
.td-muted   { color: var(--gray-400); font-size: 12px; }

/* ---- Pagination ---- */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; font-size: 12px; color: var(--gray-400);
  border-top: 0.5px solid var(--gray-200);
}
.pg-btns { display: flex; gap: 4px; }
.pg-btn {
  padding: 4px 9px; border: 0.5px solid var(--gray-200);
  border-radius: var(--radius); background: #fff; font-size: 12px;
  color: var(--gray-900); cursor: pointer;
}
.pg-btn:hover    { background: var(--gray-100); }
.pg-btn.active   { background: var(--green); color: #fff; border-color: var(--green); }
.pg-btn:disabled { opacity: 0.4; cursor: default; }

/* ---- Badges ---- */
.badge { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 500; }
.badge-perm     { background: var(--green-light); color: var(--green); }
.badge-intern   { background: var(--blue-light);  color: var(--blue); }
.badge-wage     { background: var(--amber-light); color: var(--amber); }
.badge-active   { background: #EAF3DE; color: #3B6D11; }
.badge-leave    { background: var(--amber-light); color: var(--amber); }
.badge-inactive { background: var(--red-light);   color: var(--red); }
.badge-hr       { background: var(--green-light); color: var(--green); }
.badge-payroll  { background: var(--blue-light);  color: var(--blue); }

/* ---- Avatar ---- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.av-p { background: var(--green-light); color: var(--green); }
.av-i { background: var(--blue-light);  color: var(--blue); }
.av-w { background: var(--amber-light); color: var(--amber); }
.emp-cell { display: flex; align-items: center; gap: 10px; }

/* ---- Forms ---- */
.form-card {
  background: #fff; border: 0.5px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.form-section-title { font-size: 12px; font-weight: 500; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; color: var(--gray-600); font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 10px;
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--gray-900);
  background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--green-mid); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 8px; margin-top: 1.25rem; }
.required { color: var(--red); }
.hint { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ---- Alerts ---- */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 1rem; }
.alert-success { background: #EAF3DE; color: #3B6D11; border: 0.5px solid #C0DD97; }
.alert-error   { background: var(--red-light); color: var(--red); border: 0.5px solid #F7C1C1; }

/* ---- Login page ---- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--gray-50); margin: 0; }
.login-card {
  background: #fff; border: 0.5px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 2.5rem;
  width: 100%; max-width: 380px;
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 2rem; }
.login-card h1 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.login-card p  { font-size: 13px; color: var(--gray-400); margin-bottom: 1.5rem; }

/* ---- Detail view ---- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.detail-field .key { font-size: 11px; color: var(--gray-400); }
.detail-field .val { font-size: 13px; font-weight: 500; color: var(--gray-900); margin-top: 2px; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); font-size: 13px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content, .page-footer { margin-left: 0; padding: 1rem; }
}
