/* ============================================================
   plots.css — page Buttes (Sprint 2)
   À importer après style.css et drawer.css.
   Utilise les variables du design system, ajoute celles spécifiques.
   ============================================================ */

/* Couleurs sémantiques pour la page buttes */
:root {
  --paper-warm: #f8f5ef;
  --paper-warm-2: #f1ece1;
  --moss-soft: #d8e6d8;
  --slate-soft: #d8dee5;
  --terracotta-soft: #f1dfd2;
  --sand-soft: #f3e6c8;
}

/* ============================================================
   Onglets buttes
   ============================================================ */
.plot-tabs-wrap {
  margin-bottom: 22px;
  position: relative;
}

.plot-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 12px;
  scrollbar-width: none;
}
.plot-tabs::-webkit-scrollbar { display: none; }

.plot-tab {
  flex-shrink: 0;
  padding: 9px 16px;
  border: 1px solid var(--line, #d9e2ec);
  background: var(--paper-warm);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft, #5a6862);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 160ms;
}
.plot-tab:hover {
  border-color: var(--ink, #1f2a24);
  color: var(--ink, #1f2a24);
}
.plot-tab.active {
  background: var(--ink, #1f2a24);
  color: var(--paper-warm);
  border-color: var(--ink, #1f2a24);
}

.plot-tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--moss, #4a7a4f);
  flex-shrink: 0;
}
.plot-tab.warning .plot-tab-dot { background: #b87333; }
.plot-tab.empty .plot-tab-dot { background: #93998f; }
.plot-tab.active .plot-tab-dot { background: #6b9a6f; }

.plot-tab-add {
  background: transparent;
  border: 1px dashed var(--line, #d9e2ec);
  color: var(--ink-soft, #5a6862);
}
.plot-tab-add:hover {
  border-color: var(--moss, #4a7a4f);
  color: var(--moss, #4a7a4f);
  background: var(--moss-soft);
}

/* ============================================================
   En-tête de butte (récap)
   ============================================================ */
.plot-summary {
  background: var(--paper-warm);
  border: 1px solid var(--line, #d9e2ec);
  border-radius: 22px;
  padding: 22px 24px;
  margin-bottom: 22px;
}

.plot-summary-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.plot-name-display {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
}

.plot-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  color: var(--ink-soft, #5a6862);
  font-size: 13px;
}
.plot-meta-row .meta-sep { color: var(--line, #d9e2ec); }

.plot-occupancy {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}

.occupancy-bar {
  flex: 1;
  height: 8px;
  background: var(--paper-warm-2);
  border-radius: 4px;
  overflow: hidden;
}
.occupancy-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6b9a6f, var(--moss, #4a7a4f));
  border-radius: 4px;
  transition: width 240ms;
}

.occupancy-percent {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--moss, #4a7a4f);
  font-variant-numeric: tabular-nums;
}
.occupancy-percent small { font-size: 14px; color: var(--ink-soft, #5a6862); }

.occupancy-text {
  color: var(--ink-soft, #5a6862);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

/* ============================================================
   Carte ligne — LE cœur
   ============================================================ */
.lines-stack {
  display: grid;
  gap: 16px;
}

.line-card {
  background: var(--paper-warm);
  border: 1px solid var(--line, #d9e2ec);
  border-radius: 22px;
  overflow: hidden;
  transition: border-color 200ms;
}
.line-card:hover { border-color: #93998f; }

.line-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 14px;
}

.line-number {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--paper-warm-2);
  color: var(--ink, #1f2a24);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.line-header-text { flex: 1; min-width: 0; }
.line-title { font-size: 15px; font-weight: 600; }
.line-subtitle { font-size: 13px; color: var(--ink-soft, #5a6862); margin-top: 2px; }

.line-status-chip {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.line-status-chip.present { background: var(--moss-soft); color: var(--moss, #4a7a4f); }
.line-status-chip.empty { background: #ece8db; color: #93998f; }

/* État actuel */
.line-current { padding: 0 20px 14px; }

.current-crop {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--moss-soft);
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--moss, #4a7a4f) 18%, transparent);
}

.current-crop-leaf {
  width: 32px;
  height: 32px;
  background: var(--moss, #4a7a4f);
  color: var(--paper-warm);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.current-crop-info { flex: 1; min-width: 0; }
.current-crop-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink, #1f2a24);
}
.current-crop-meta {
  font-size: 13px;
  color: var(--ink-soft, #5a6862);
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.current-crop-action {
  border: none;
  background: transparent;
  color: var(--moss, #4a7a4f);
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 140ms;
}
.current-crop-action:hover { background: rgba(74,122,79,0.1); }

/* Indicateur phénologique */
.phenology-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  margin-top: 6px;
}
.phenology-pill.dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.phenology-pill.before-sowing { background: rgba(0,0,0,.05); color: var(--ink-soft, #5a6862); }
.phenology-pill.before-sowing.dot::before { background: #93998f; }
.phenology-pill.growing { background: rgba(216, 183, 116, .25); color: #8b6e2c; }
.phenology-pill.growing.dot::before { background: var(--sand, #d8b774); }
.phenology-pill.harvest { background: rgba(74,122,79,.18); color: var(--moss, #4a7a4f); }
.phenology-pill.harvest.dot::before { background: var(--moss, #4a7a4f); }
.phenology-pill.over { background: rgba(184, 115, 51, .18); color: #b87333; }
.phenology-pill.over.dot::before { background: #b87333; }

/* Barre d'occupation visuelle */
.line-bar-section { padding: 0 20px 14px; }

.line-bar-rule {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #93998f;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.line-bar {
  height: 28px;
  background: var(--paper-warm-2);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  border: 1px solid #e6e1d4;
}

.line-bar-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--paper-warm);
  white-space: nowrap;
  overflow: hidden;
  border: none;
  cursor: pointer;
  position: relative;
  transition: filter 160ms;
}
.line-bar-segment:hover { filter: brightness(1.05); }
.line-bar-segment.crop {
  background: linear-gradient(135deg, #6b9a6f, var(--moss, #4a7a4f));
}
.line-bar-segment.planned {
  background: linear-gradient(135deg, #8a98a5, #6c7a87);
  color: var(--paper-warm);
}
.line-bar-segment.free {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 6px,
    var(--paper-warm) 6px,
    var(--paper-warm) 12px
  );
  background-color: var(--paper-warm-2);
  color: #93998f;
  cursor: default;
}

/* Tooltip natif via title= — natif, pas de JS */

.line-bar-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
}
.line-bar-foot .used { color: var(--moss, #4a7a4f); font-weight: 600; }
.line-bar-foot .free { color: #93998f; }

/* Zone "PUIS" */
.line-future {
  padding: 0 20px 14px;
  display: grid;
  gap: 8px;
}

.future-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--paper-warm-2);
  border: 1px dashed var(--line, #d9e2ec);
}

.future-step-arrow {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--paper-warm);
  color: #6c7a87;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid var(--line, #d9e2ec);
}

.future-step-label { flex: 1; font-size: 14px; color: var(--ink, #1f2a24); }
.future-step-label .future-name { font-weight: 600; }
.future-step-label .future-when { color: var(--ink-soft, #5a6862); font-size: 13px; }

.future-step.suggest {
  background: linear-gradient(135deg, var(--sand-soft), var(--paper-warm-2));
  border-color: var(--sand, #d8b774);
  border-style: solid;
}
.future-step.suggest .future-step-arrow {
  background: var(--sand, #d8b774);
  color: var(--ink, #1f2a24);
  border-color: var(--sand, #d8b774);
}

.future-step-action {
  border: 1px solid var(--line, #d9e2ec);
  background: var(--paper-warm);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #1f2a24);
  cursor: pointer;
}
.future-step-action:hover { border-color: var(--moss, #4a7a4f); color: var(--moss, #4a7a4f); }

/* Bouton ajout */
.line-add { padding: 0 20px 18px; }

.line-add-btn {
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--line, #d9e2ec);
  background: transparent;
  border-radius: 14px;
  color: var(--ink-soft, #5a6862);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 160ms;
}
.line-add-btn:hover {
  border-color: var(--moss, #4a7a4f);
  color: var(--moss, #4a7a4f);
  background: var(--moss-soft);
  border-style: solid;
}

/* ============================================================
   Drawer Suggestions (panneau de propositions de variétés)
   ============================================================ */
.suggestion-section {
  border: 1px solid var(--line, #d9e2ec);
  border-radius: 14px;
  background: var(--paper-warm);
  padding: 14px;
  margin-bottom: 12px;
}

.suggestion-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--moss, #4a7a4f);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.suggestion-section.caution .suggestion-section-title { color: #b87333; }

.suggestion-list { display: grid; gap: 6px; }

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--paper-warm-2);
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: all 140ms;
}
.suggestion-item:hover {
  border-color: var(--moss, #4a7a4f);
  background: var(--moss-soft);
}

.suggestion-info { flex: 1; min-width: 0; }
.suggestion-name { font-weight: 600; font-size: 14px; }
.suggestion-rationale {
  font-size: 12px;
  color: var(--ink-soft, #5a6862);
  margin-top: 2px;
}

.suggestion-arrow { color: #93998f; font-size: 14px; flex-shrink: 0; }

.suggestion-empty {
  padding: 14px;
  text-align: center;
  color: var(--ink-soft, #5a6862);
  font-size: 13px;
  font-style: italic;
}

.suggestion-missing-data {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(216, 183, 116, .12);
  border: 1px solid color-mix(in srgb, var(--sand, #d8b774) 30%, transparent);
  font-size: 12px;
  color: #8b6e2c;
}
.suggestion-missing-data a {
  color: #b87333;
  font-weight: 600;
  margin-left: 6px;
}

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 640px) {
  .plot-summary { padding: 18px; }
  .plot-summary-top { flex-direction: column; }
  .plot-name-display { font-size: 22px; }

  .line-card { border-radius: 16px; }
  .line-header { padding: 14px 16px 10px; }
  .line-current,
  .line-bar-section,
  .line-future,
  .line-add { padding-left: 14px; padding-right: 14px; }

  .line-number { width: 38px; height: 38px; font-size: 19px; }
  .current-crop { flex-wrap: wrap; }
  .line-bar { height: 32px; }
  .line-bar-segment { font-size: 10px; }
}
