/* ============================================================
   ATS - Applicant Tracking System
   style.css — Global styles, theme, layout
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary: #3498db;
  --primary-dark: #2176ae;
  --primary-light: #ebf5fb;
  --bg: #f4f8fb;
  --white: #ffffff;
  --sidebar-w: 240px;
  --sidebar-bg: #1a2940;
  --sidebar-text: #b8c7d9;
  --sidebar-active: #3498db;
  --text-main: #1c2b3a;
  --text-muted: #7f8fa4;
  --border: #dce8f4;
  --card-shadow: 0 2px 12px rgba(52,152,219,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --purple: #8e44ad;
  --transition: 0.2s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
}

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

/* ---- Sidebar ---- */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
}
#sidebar.collapsed { width: 64px; }
#sidebar.collapsed .nav-label,
#sidebar.collapsed .sidebar-logo-text,
#sidebar.collapsed .sidebar-section-title { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-logo-icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--primary); display: flex; align-items: center;
  justify-content: center; font-size: 18px; flex-shrink: 0;
}
.sidebar-logo-text { color: #fff; font-weight: 700; font-size: 17px; white-space: nowrap; transition: opacity var(--transition); }
.sidebar-section-title {
  color: rgba(184,199,217,0.5); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  padding: 18px 18px 6px; white-space: nowrap; transition: opacity var(--transition);
}
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; text-decoration: none;
  color: var(--sidebar-text); font-size: 14px; font-weight: 400;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(52,152,219,0.12);
  color: #fff; border-left-color: var(--primary);
}
.sidebar-nav a .nav-icon { font-size: 17px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-label { transition: opacity var(--transition); }
.sidebar-footer {
  padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.07);
}
.logout-btn {
  display: flex; align-items: center; gap: 10px;
  background: rgba(231,76,60,0.15); color: #e87070;
  border: none; border-radius: var(--radius-sm); padding: 9px 14px;
  cursor: pointer; font-family: 'Poppins', sans-serif; font-size: 13px;
  width: 100%; transition: background var(--transition);
}
.logout-btn:hover { background: rgba(231,76,60,0.28); }

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh; transition: margin-left var(--transition);
}
#sidebar.collapsed ~ .main-content { margin-left: 64px; }

/* ---- Topbar ---- */
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 64px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 6px rgba(52,152,219,0.06);
}
#sidebar-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--text-muted); padding: 6px;
  border-radius: 8px; transition: background var(--transition);
  display: flex; align-items: center;
}
#sidebar-toggle:hover { background: var(--primary-light); color: var(--primary); }
.topbar-search {
  flex: 1; max-width: 380px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 24px; padding: 0 14px;
}
.topbar-search input {
  border: none; background: none; padding: 8px 0;
  font-family: 'Poppins', sans-serif; font-size: 13px;
  color: var(--text-main); outline: none; flex: 1;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-badge {
  background: var(--primary-light); color: var(--primary);
  padding: 6px 14px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
}

/* ---- Page Content ---- */
.page-content { padding: 28px; flex: 1; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-main); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px; margin-bottom: 28px;
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--card-shadow);
  border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px;
}
.stat-icon { font-size: 28px; margin-bottom: 4px; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 400; }

/* ---- Cards ---- */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--card-shadow); border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 15px;
}
.card-body { padding: 18px 22px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--bg); color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  background: var(--bg); color: var(--text-muted);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
td {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  color: var(--text-main); vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--primary-light); }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-main); margin-bottom: 6px; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select, textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif; font-size: 14px;
  background: var(--white); color: var(--text-main);
  outline: none; transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 80px; }

/* ---- Modal ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(26,41,64,0.45); z-index: 1000;
  align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--white); border-radius: var(--radius);
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  animation: fadeSlide 0.22s ease;
}
.modal-lg { max-width: 720px; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-16px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.modal-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer; font-size: 22px;
  color: var(--text-muted); padding: 0 4px; line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 14px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border); }

/* ---- Form Row ---- */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }

/* ---- Kanban Board ---- */
.kanban-board {
  display: grid; gap: 14px;
  grid-template-columns: repeat(6, 1fr);
  overflow-x: auto; padding-bottom: 16px;
}
.kanban-col {
  background: var(--bg); border-radius: var(--radius);
  border: 1px solid var(--border); min-width: 210px;
  display: flex; flex-direction: column;
}
.kanban-col-header {
  padding: 12px 14px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 2px solid transparent;
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-col-body {
  flex: 1; padding: 10px; min-height: 180px;
  display: flex; flex-direction: column; gap: 10px;
}
.kanban-col-body.drag-over { background: rgba(52,152,219,0.08); border-radius: 8px; }
.kanban-card {
  background: var(--white); border-radius: 10px;
  border: 1px solid var(--border); padding: 13px 14px;
  cursor: grab; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: box-shadow var(--transition), transform var(--transition);
}
.kanban-card:hover { box-shadow: 0 6px 20px rgba(52,152,219,0.14); transform: translateY(-2px); }
.kanban-card.dragging { opacity: 0.5; cursor: grabbing; }
.kanban-card-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.kanban-card-job { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.kanban-card-footer { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---- Pipeline Steps ---- */
.pipeline {
  display: flex; align-items: center; gap: 0; margin: 20px 0;
  flex-wrap: wrap;
}
.pipeline-step {
  display: flex; align-items: center;
}
.pipeline-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--border); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; position: relative;
}
.pipeline-dot.active { background: var(--primary); color: #fff; }
.pipeline-dot.done { background: var(--success); color: #fff; }
.pipeline-label {
  font-size: 11px; color: var(--text-muted); margin-top: 4px; text-align: center;
}
.pipeline-step-inner { display: flex; flex-direction: column; align-items: center; }
.pipeline-line {
  height: 2px; width: 40px; background: var(--border);
  margin-bottom: 18px;
}
.pipeline-line.done { background: var(--success); }

/* ---- Timeline ---- */
.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 14px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item {
  display: flex; gap: 14px; padding: 0 0 18px 0; position: relative;
}
.timeline-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-light); border: 2px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; position: relative; z-index: 1;
}
.timeline-body { flex: 1; }
.timeline-event { font-weight: 600; font-size: 14px; }
.timeline-date { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.timeline-note { font-size: 13px; color: var(--text-muted); }

/* ---- Badges ---- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #eafaf1; color: var(--success); }
.badge-danger { background: #fce8e8; color: var(--danger); }
.badge-warning { background: #fef9e7; color: var(--warning); }
.badge-purple { background: #f4e8fc; color: var(--purple); }

/* ---- Search Bar ---- */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 24px; padding: 0 14px; margin-bottom: 18px;
  max-width: 320px;
}
.search-bar input { border: none; background: none; padding: 9px 0; font-size: 13px; outline: none; font-family: 'Poppins', sans-serif; flex: 1; }

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: linear-gradient(135deg, #1a2940 0%, #2c4a70 100%);
}
.login-card {
  background: var(--white); border-radius: 18px;
  padding: 40px 44px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.24);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
  width: 56px; height: 56px; background: var(--primary);
  border-radius: 16px; display: flex; align-items: center;
  justify-content: center; font-size: 28px; margin: 0 auto 12px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text-main); }
.login-logo p { font-size: 13px; color: var(--text-muted); }
.role-tabs {
  display: flex; gap: 0; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 20px;
}
.role-tab {
  flex: 1; padding: 10px; text-align: center; cursor: pointer;
  font-size: 13px; font-weight: 500; background: var(--bg);
  color: var(--text-muted); transition: all var(--transition); border: none;
  font-family: 'Poppins', sans-serif;
}
.role-tab.active { background: var(--primary); color: #fff; }

/* ---- Reports Charts ---- */
.chart-bar-wrap { display: flex; flex-direction: column; gap: 12px; }
.chart-bar-item { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.chart-bar-label { min-width: 120px; color: var(--text-muted); }
.chart-bar-track { flex: 1; background: var(--bg); border-radius: 8px; height: 20px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 8px; background: var(--primary); transition: width 0.5s ease; }
.chart-bar-val { min-width: 32px; text-align: right; font-weight: 600; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted); font-size: 14px;
}
.empty-state-icon { font-size: 44px; margin-bottom: 12px; }

/* ---- Action Row ---- */
.action-row {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 18px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: none; width: var(--sidebar-w); }
  .main-content { margin-left: 0 !important; }
  .kanban-board { grid-template-columns: repeat(6, 220px); }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 28px 22px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
