/* Amarillo ATS — Custom Styles */

:root {
  --primary: #f59e0b;
  --primary-dark: #d97706;
  --primary-light: #fbbf24;
  --sidebar-width: 240px;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #f59e0b;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid #334155;
  letter-spacing: -0.025em;
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: #334155;
  color: #f8fafc;
}

.sidebar-nav a.active {
  background: #334155;
  color: var(--sidebar-active);
  border-left-color: var(--sidebar-active);
}

.sidebar-nav a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* Top bar */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
}

.search-global {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.search-global input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.875rem;
  background: #f8fafc;
  transition: all 0.15s;
}

.search-global input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
  background: #fff;
}

.search-global svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #94a3b8;
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 100;
}

.search-results-dropdown.visible { display: block; }

.search-result-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.search-result-item:hover { background: #f8fafc; }

.search-result-type {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.search-result-type.candidat { background: #dbeafe; color: #1d4ed8; }
.search-result-type.entreprise { background: #dcfce7; color: #16a34a; }
.search-result-type.decideur { background: #fae8ff; color: #9333ea; }
.search-result-type.mission { background: #fef3c7; color: #d97706; }

/* Page content */
.page-content {
  padding: 24px 32px;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.kpi-card .kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
}

.kpi-card .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e293b;
}

.kpi-card .kpi-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* Cards / Sections */
.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1e293b;
}

.card-body { padding: 20px; }

/* Data Table */
.data-table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  border-bottom: 2px solid #e2e8f0;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.data-table th:hover { color: #1e293b; }

.data-table th .sort-icon { margin-left: 4px; opacity: 0.3; }
.data-table th.sorted .sort-icon { opacity: 1; color: var(--primary); }

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.data-table tr:hover td { background: #f8fafc; }

.data-table tr { cursor: pointer; }

/* Badges / Status */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-to-call { background: #dbeafe; color: #1d4ed8; }
.badge-approche { background: #fef3c7; color: #d97706; }
.badge-en-qualification { background: #e0e7ff; color: #4338ca; }
.badge-shortliste { background: #fae8ff; color: #9333ea; }
.badge-presente { background: #fed7aa; color: #c2410c; }
.badge-place { background: #dcfce7; color: #16a34a; }
.badge-off-market { background: #f1f5f9; color: #64748b; }
.badge-pas-prioritaire { background: #f1f5f9; color: #94a3b8; }

.badge-a-faire { background: #fef3c7; color: #d97706; }
.badge-fait { background: #dcfce7; color: #16a34a; }

.badge-haute { background: #fee2e2; color: #dc2626; }
.badge-moyenne { background: #fef3c7; color: #d97706; }

.badge-middle { background: #dbeafe; color: #1d4ed8; }
.badge-top { background: #fae8ff; color: #9333ea; }

/* Entity links */
.entity-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.entity-link:hover {
  text-decoration: underline;
  color: #1d4ed8;
}

/* Filters bar */
.filters-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.filter-select {
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.8125rem;
  background: #fff;
  color: #334155;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.filter-search {
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.8125rem;
  background: #fff;
  min-width: 200px;
}

.filter-search:focus {
  outline: none;
  border-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-sm { padding: 4px 10px; font-size: 0.75rem; }

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  display: none;
}

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

.modal {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 1.0625rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #64748b;
  padding: 4px;
}

.modal-close:hover { color: #1e293b; }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Form elements */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #1e293b;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.tab-btn:hover { color: #1e293b; }

.tab-btn.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Detail page layout */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.detail-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
}

.detail-header .subtitle {
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 2px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

.detail-sidebar .card { position: sticky; top: 80px; }

/* Timeline */
.timeline { position: relative; }

.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 30px;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.timeline-dot.linkedin { background: #dbeafe; border-color: #93c5fd; }
.timeline-dot.appel { background: #dcfce7; border-color: #86efac; }

.timeline-body { flex: 1; }

.timeline-date {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 2px;
}

.timeline-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
}

.timeline-text {
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 4px;
}

/* Kanban */
.kanban {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  min-width: 260px;
  flex-shrink: 0;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
}

.kanban-column-header {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-column-count {
  background: #e2e8f0;
  color: #475569;
  font-size: 0.6875rem;
  padding: 1px 8px;
  border-radius: 9999px;
}

.kanban-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.kanban-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.kanban-card-sub {
  font-size: 0.75rem;
  color: #64748b;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.8125rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toast-in 0.3s ease;
}

.toast.success { border-left: 4px solid #22c55e; }
.toast.error { border-left: 4px solid #ef4444; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #94a3b8;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 16px;
}

/* Sync indicator */
.sync-indicator {
  margin-left: auto;
  font-size: 0.75rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.sync-dot.syncing {
  background: var(--primary);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Responsive */
@media (max-width: 1024px) {
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
