/* Blynckr ATS — Light & Modern UI */

@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-Variable.ttf') format('truetype-variations');
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Variable.ttf') format('truetype-variations');
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #17384F;
  --koper: #D97B3D;
  --deep-ink: #0D1F33;
  --steel: #2A5C7A;
  --mist: #B8CDE0;
  --warm-white: #F5F1EB;
  --sand: #E8DED3;
  --glow: #F2C4A0;
  --burnt: #B5612E;
  --white: #FFFFFF;

  --bg: #F8F8FA;
  --border: #E5E7EB;
  --border-light: #F0F0F3;
  --fg-primary: #1D1D1F;
  --fg-secondary: #424245;
  --fg-tertiary: #86868B;
  --fg-quaternary: #AEAEB2;
  --surface: #FFFFFF;
  --surface-hover: #FAFAFA;
  --surface-active: #F5F5F7;

  --font-display: 'DM Sans', -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  --font-body: 'Inter', -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06), 0 0 1px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.04);

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 150ms;
  --dur-base: 250ms;
}

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

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-primary);
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  color: var(--fg-secondary);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 20px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo img { height: 24px; }
.sidebar-logo span {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  color: var(--koper);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(217, 123, 61, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
}

.sidebar-nav { flex: 1; }

.nav-section {
  padding: 0 12px;
  margin-bottom: 4px;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-quaternary);
  padding: 20px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 450;
  transition: all var(--dur-fast) var(--ease-out);
  text-decoration: none;
}

.nav-item:hover {
  background: var(--surface-active);
  color: var(--fg-primary);
}

.nav-item.active {
  background: var(--fg-primary);
  color: var(--white);
  font-weight: 500;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  flex-shrink: 0;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--border);
  color: var(--fg-tertiary);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}

.nav-item.active .badge {
  background: rgba(255,255,255,0.2);
  color: var(--white);
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}

.sidebar-user .avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--koper);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
}

.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: 11px;
  color: var(--fg-tertiary);
  text-transform: capitalize;
}

.sidebar-user .logout-btn {
  background: none;
  border: none;
  color: var(--fg-quaternary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--dur-fast);
}

.sidebar-user .logout-btn:hover {
  color: var(--fg-primary);
  background: var(--surface-active);
}

/* Main content */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  height: 56px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  flex-shrink: 0;
}

.topbar h1 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--fg-primary);
  letter-spacing: -0.01em;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 0 28px 28px;
}

/* Buttons */
.btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--dur-fast) var(--ease-out);
  text-decoration: none;
}

.btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.btn-primary {
  background: var(--fg-primary);
  color: var(--white);
}
.btn-primary:hover { background: #333336; }

.btn-accent {
  background: var(--fg-primary);
  color: var(--white);
}
.btn-accent:hover { background: #333336; }

.btn-secondary {
  background: var(--surface);
  color: var(--fg-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-active); }

.btn:active { transform: scale(0.97); }

/* Search */
.search-box {
  position: relative;
}

.search-box input {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg-primary);
  width: 240px;
  outline: none;
  transition: all var(--dur-fast);
}

.search-box input::placeholder { color: var(--fg-quaternary); }
.search-box input:focus {
  border-color: var(--fg-tertiary);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}

.search-box svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  stroke: var(--fg-quaternary);
  fill: none;
  stroke-width: 2;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--dur-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--fg-primary);
  letter-spacing: -0.02em;
}

.stat-card .stat-sub {
  font-size: 12px;
  color: var(--fg-tertiary);
  margin-top: 2px;
}

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
  vertical-align: middle;
  color: var(--fg-secondary);
}

tbody tr { transition: background var(--dur-fast); }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: none; }

/* Badges / tags */
.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.01em;
}

.badge-active { background: #DCFCE7; color: #15803D; }
.badge-archived { background: var(--surface-active); color: var(--fg-tertiary); }
.badge-placed { background: #DBEAFE; color: #1D4ED8; }

.badge-lead { background: var(--surface-active); color: var(--fg-tertiary); }
.badge-benaderd { background: #FFF7ED; color: #C2410C; }
.badge-kennismaking { background: #EFF6FF; color: #1D4ED8; }
.badge-offerte { background: #F5F3FF; color: #7C3AED; }
.badge-klant { background: #DCFCE7; color: #15803D; }
.badge-slapend { background: var(--surface-active); color: var(--fg-tertiary); }

.badge-open { background: #DCFCE7; color: #15803D; }
.badge-draft { background: var(--surface-active); color: var(--fg-tertiary); }
.badge-on_hold { background: #FFF7ED; color: #C2410C; }
.badge-closed { background: #FEF2F2; color: #DC2626; }
.badge-filled { background: #DBEAFE; color: #1D4ED8; }

.badge-screening_cv { background: var(--surface-active); color: var(--fg-tertiary); }
.badge-intake { background: #FFF7ED; color: #C2410C; }
.badge-voorgesteld_hr { background: #EFF6FF; color: #1D4ED8; }
.badge-gesprek { background: #F5F3FF; color: #7C3AED; }
.badge-voorstel { background: #F0FDF4; color: #16A34A; }
.badge-gestart { background: #DCFCE7; color: #15803D; }
.badge-afgewezen { background: #FEF2F2; color: #DC2626; }
.badge-afgevallen { background: #FEF2F2; color: #DC2626; }

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-secondary);
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  font-family: var(--font-body);
  font-size: 13.5px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg-primary);
  outline: none;
  transition: all var(--dur-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--fg-tertiary);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}

.form-group textarea { resize: vertical; min-height: 80px; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 460px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--fg-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-quaternary);
  padding: 4px;
  border-radius: 6px;
  transition: all var(--dur-fast);
}

.modal-close:hover {
  color: var(--fg-primary);
  background: var(--surface-active);
}

.modal-body { padding: 16px 24px; }

.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Pipeline kanban */
.pipeline {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.pipeline-column {
  min-width: 240px;
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.pipeline-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.pipeline-header h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-primary);
}

.pipeline-header .count {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-tertiary);
  background: var(--surface-active);
  padding: 1px 7px;
  border-radius: 999px;
}

.pipeline-cards {
  padding: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 60px;
}

.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all var(--dur-fast);
}

.pipeline-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

.pipeline-card .pc-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--fg-primary);
  margin-bottom: 3px;
}

.pipeline-card .pc-info {
  font-size: 12px;
  color: var(--fg-tertiary);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: var(--surface-active);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: fit-content;
}

.tab {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-tertiary);
  padding: 6px 14px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--dur-fast);
}

.tab:hover { color: var(--fg-primary); }
.tab.active {
  color: var(--fg-primary);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--fg-tertiary);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  stroke: var(--border);
  fill: none;
  stroke-width: 1.5;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-primary);
  margin-bottom: 4px;
}

/* Login page */
.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 360px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.login-card img { height: 28px; margin-bottom: 24px; }

.login-card h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--fg-primary);
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

.login-card .form-group { text-align: left; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 8px; }

.login-error {
  background: #FEF2F2;
  color: #DC2626;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: none;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--fg-primary);
  color: var(--white);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--dur-base) var(--ease-out);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Sortable headers */
th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: var(--fg-primary);
}

/* Selected row */
tr.selected-row {
  background: rgba(217, 123, 61, 0.06) !important;
}

/* Checkbox in table */
thead th:first-child,
tbody td:first-child {
  text-align: center;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--fg-primary);
  cursor: pointer;
}

/* AI response formatting */
.ai-response strong { font-weight: 600; }
.ai-response code {
  background: var(--surface-active);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

@keyframes pulse {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(200%); }
}

/* Mobile hamburger */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 90;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.mobile-header img { height: 20px; }

.hamburger {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--fg-primary);
  border-radius: 6px;
}

.hamburger:active { background: var(--surface-active); }

.mobile-header .mobile-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.sidebar-backdrop.open { display: block; }

/* Responsive */
@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .app {
    grid-template-columns: 1fr;
    padding-top: 52px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-out);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .topbar { display: none; }

  .content {
    padding: 16px !important;
    min-height: calc(100vh - 52px);
  }

  /* Stats */
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .stat-card .stat-value {
    font-size: 22px;
  }

  /* Tables: horizontal scroll */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    min-width: 580px;
  }

  /* Tabs: scroll horizontally */
  .tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
  }

  .tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 12px;
  }

  /* Pipeline */
  .pipeline {
    flex-direction: column;
    gap: 10px;
  }

  .pipeline-column {
    min-width: 100%;
  }

  /* Modal: full-screen on mobile */
  .modal {
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  .modal-overlay.open {
    align-items: stretch;
  }

  .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
  }

  .modal-header {
    padding: 16px 16px 0;
    flex-shrink: 0;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
  }

  /* Forms: prevent zoom on iOS */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
  }

  /* Search */
  .search-box { display: none; }

  /* All 2-col inline grids stack on mobile */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Login */
  .login-card {
    width: 100%;
    max-width: 360px;
    margin: 0 16px;
    padding: 32px 24px;
  }

  /* Toast */
  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    text-align: center;
  }

  /* Iframe pages full height */
  .content iframe {
    height: calc(100vh - 52px - 32px) !important;
  }

  /* Add button in mobile header */
  .mobile-add-btn {
    background: var(--fg-primary);
    color: var(--white);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .mobile-add-btn:active { opacity: 0.8; }
}
