/* ================================================
   PeacemakerOS — App UI (pipeline, dashboard, nav)
   All colours use the design tokens from theme.css
   ================================================ */

/* === NAV === */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 5vw;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand:hover { color: var(--accent-soft); }

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover { color: var(--fg); background: rgba(255,255,255,0.04); }
.nav-link.active { color: var(--accent-soft); background: var(--accent-glow); }

/* === APP CONTAINER === */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 5vw 80px;
}

/* === PAGE HEADER === */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-sub {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--fg); border-color: rgba(255,255,255,0.15); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.btn-icon:hover { opacity: 1; }

/* === STATS ROW === */
.stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 120px;
}

.stat-chip.positive { border-color: rgba(52, 211, 153, 0.25); }

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  font-family: var(--font-display);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}

/* === METRIC CARDS (dashboard) === */
.metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  flex: 1;
  min-width: 160px;
}

.metric.positive-border { border-color: rgba(52, 211, 153, 0.3); }

.positive { color: var(--positive); }

/* === ALERT === */
.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-size: 0.9rem;
}

/* === KANBAN BOARD === */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}

.kanban-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 400px;
  transition: border-color 0.2s;
}

.kanban-col.drag-over { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow); }

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

.col-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.col-count {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  padding: 2px 8px;
  border-radius: 100px;
  color: var(--fg-muted);
}

/* Column accent colors */
.col-prospect .col-label    { color: var(--fg-muted); }
.col-proposition .col-label { color: #fbbf24; }
.col-actif .col-label       { color: var(--positive); }
.col-termine .col-label     { color: var(--accent-soft); }

.kanban-cards {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* === PROJECT CARDS === */
.projet-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: grab;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.projet-card:hover {
  border-color: rgba(124, 92, 252, 0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.projet-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.projet-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.projet-nom {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}

.projet-client {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 12px;
}

.projet-card-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.projet-valeur {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--positive);
}

.projet-deadline {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* === BADGES === */
.badge {
  font-size: 0.7rem;
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 8px;
  border-radius: 100px;
}

.badge-recurrent {
  background: rgba(52, 211, 153, 0.12);
  color: var(--positive);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.badge-projet {
  background: rgba(124, 92, 252, 0.1);
  color: var(--accent-soft);
  border: 1px solid rgba(124, 92, 252, 0.2);
}

/* === CARDS (generic) === */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 20px 24px 0;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.card-chart { padding-bottom: 20px; }

/* === BAR CHART === */
.chart-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 24px;
  height: 180px;
  overflow-x: auto;
}

.bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 44px;
  max-width: 64px;
  height: 100%;
  justify-content: flex-end;
}

.bar-stack {
  display: flex;
  flex-direction: column-reverse;
  align-items: stretch;
  width: 100%;
  gap: 2px;
  flex: 1;
  justify-content: flex-end;
}

.bar-segment {
  border-radius: 4px 4px 0 0;
  transition: opacity 0.15s;
  min-height: 3px;
}

.bar-segment:hover { opacity: 0.75; }

.bar-projet   { background: var(--accent); }
.bar-recurrent { background: var(--positive); }

.bar-label {
  font-size: 0.68rem;
  color: var(--fg-muted);
  font-family: var(--font-display);
  white-space: nowrap;
}

.bar-total {
  font-size: 0.65rem;
  color: var(--fg-muted);
  font-family: var(--font-display);
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px 0;
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

/* === DATA TABLE === */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 24px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.fw-bold { font-weight: 600; }
.fg-muted { color: var(--fg-muted); }

.empty-state {
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.9rem;
  padding: 48px 24px;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 40px 80px rgba(0,0,0,0.5), 0 0 60px var(--accent-glow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}

.modal-close:hover { color: var(--fg); background: rgba(255,255,255,0.06); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* === FORMS === */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0; }

.form-label {
  font-size: 0.8rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder { color: rgba(136,136,160,0.5); }

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

/* === LANDING NAV LINKS === */
.hero-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.btn-hero-primary {
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px 28px;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 0 30px var(--accent-glow);
  transition: opacity 0.2s, transform 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-hero-primary:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-hero-ghost {
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.btn-hero-ghost:hover { color: var(--fg); }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .kanban-board { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
  .page-header { flex-direction: column; }
}
