/* =====================================================
   ITPIHRC Admin - Light content + Dark sidebar
   ===================================================== */

:root {
  --sidebar-w: 260px;
  --sidebar-collapsed: 72px;
  --topbar-h: 60px;

  /* Dark sidebar only */
  --bg-sidebar: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: #334155;
  --sidebar-border: #334155;

  /* Light main area */
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
  --transition: .25s ease;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

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

/* ========== SIDEBAR (DARK) ========== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--sidebar-border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width var(--transition);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-brand .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  font-weight: 700; font-size: 16px; color: #fff;
  white-space: nowrap;
  transition: opacity var(--transition);
}

.sidebar.collapsed .brand-text { opacity: 0; width: 0; overflow: hidden; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-border) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 4px; }

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  padding: 12px 12px 6px;
  white-space: nowrap;
}

.sidebar.collapsed .nav-section-title { opacity: 0; height: 0; padding: 0; overflow: hidden; }

.nav-item { margin-bottom: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.nav-link.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

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

.nav-link .nav-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-arrow { opacity: 0; width: 0; overflow: hidden; }

.nav-arrow { font-size: 12px; transition: transform var(--transition); }
.nav-item.open > .nav-link .nav-arrow { transform: rotate(90deg); }

.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
  padding-left: 12px;
}
.nav-item.open > .nav-submenu { max-height: 400px; }
.nav-submenu .nav-link { padding: 8px 12px 8px 32px; font-size: 13px; }
.sidebar.collapsed .nav-submenu { display: none; }

/* ========== MAIN (LIGHT) ========== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
}

.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

.topbar {
  height: var(--topbar-h);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.sidebar-toggle {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer; padding: 8px;
  border-radius: 8px; font-size: 20px;
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text); }

.page-title { font-size: 18px; font-weight: 600; color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-dropdown {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
  transition: background var(--transition);
}
.user-dropdown:hover { background: var(--bg-hover); }

.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; color: #fff;
}
.user-name { font-size: 14px; font-weight: 500; color: var(--text); }

.content-area { flex: 1; padding: 24px; }

/* Cards - WHITE */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: #fff;
}

.card-header h2, .card-header h3 {
  font-size: 16px; font-weight: 600; margin: 0; color: var(--text);
}

.card-body { padding: 20px; background: #fff; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
}

.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue { background: rgba(59,130,246,.12); color: #3b82f6; }
.stat-icon.green { background: rgba(34,197,94,.12); color: #22c55e; }
.stat-icon.orange { background: rgba(245,158,11,.12); color: #f59e0b; }
.stat-icon.purple { background: rgba(139,92,246,.12); color: #8b5cf6; }
.stat-icon.cyan { background: rgba(6,182,212,.12); color: #06b6d4; }
.stat-icon.red { background: rgba(239,68,68,.12); color: #ef4444; }

.stat-info h4 { font-size: 24px; font-weight: 700; margin: 0 0 2px; color: var(--text); }
.stat-info p { font-size: 13px; color: var(--text-muted); margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  border: none; cursor: pointer;
  transition: all var(--transition);
  text-decoration: none; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  margin-bottom: 6px; color: var(--text-muted);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-control::placeholder { color: #94a3b8; }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

/* Tables */
.table-responsive { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.table th {
  background: #f8fafc;
  font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); white-space: nowrap;
}
.table tbody tr:hover { background: #f8fafc; }
.table img { max-width: 60px; max-height: 40px; border-radius: 4px; object-fit: cover; }
.table .actions { display: flex; gap: 6px; white-space: nowrap; }

/* Badges */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-success { background: rgba(34,197,94,.12); color: #16a34a; }
.badge-danger { background: rgba(239,68,68,.12); color: #dc2626; }
.badge-warning { background: rgba(245,158,11,.15); color: #d97706; }
.badge-info { background: rgba(6,182,212,.12); color: #0891b2; }
.badge-primary { background: rgba(59,130,246,.12); color: #2563eb; }

/* Alerts */
.alert {
  padding: 12px 16px; border-radius: 8px;
  margin-bottom: 16px; font-size: 14px;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-danger { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #b45309; }
.alert-info { background: #ecfeff; border: 1px solid #a5f3fc; color: #0e7490; }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.1);
}
.login-card .logo { text-align: center; margin-bottom: 28px; }
.login-card .logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 22px; color: #fff; margin-bottom: 12px;
}
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.login-card .subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.login-card .form-group { margin-bottom: 20px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

/* DataTables light */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: #fff; border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 6px 10px;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter { color: var(--text-muted); }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text) !important;
  background: #fff !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important; margin: 0 2px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: #f1f5f9 !important;
  color: var(--text) !important;
}

/* Utilities */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .sidebar.collapsed { width: var(--sidebar-w); }
}
@media (max-width: 576px) {
  .content-area { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .card-header { flex-direction: column; align-items: flex-start; }
}
