/* ===================================================
   generateur-devis.css
   =================================================== */

.gd-root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e2830;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 0 2rem;
}

/* ── Header ─────────────────────────────────────── */
.gd-header {
  background: #1664d2;
  color: #fff;
  border-radius: 14px;
  padding: 1.5rem 1.75rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.gd-main-title {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 4px;
}
.gd-devis-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.gd-num-badge {
  background: rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
}
.gd-date-badge {
  font-size: 12px;
  opacity: 0.85;
}
.gd-label { opacity: 0.75; }

/* ── Sections card ──────────────────────────────── */
.gd-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 1.25rem;
}
@media (max-width: 600px) {
  .gd-parties { grid-template-columns: 1fr; }
}
.gd-party-card {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}
.gd-party-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #8c95a5;
  margin-bottom: 12px;
}

.gd-field { display: flex; flex-direction: column; gap: 4px; }
.gd-field label { font-size: 12px; color: #7a8394; }
.gd-field input,
.gd-field textarea {
  border: 1px solid #dde1e8;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13.5px;
  color: #1e2830;
  background: #fff;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.gd-field input:focus,
.gd-field textarea:focus {
  outline: none;
  border-color: #1664d2;
  box-shadow: 0 0 0 3px rgba(22,100,210,0.10);
}
.gd-field textarea { resize: vertical; }
.gd-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 480px) { .gd-row2 { grid-template-columns: 1fr; } }

/* ── Barre de recherche ─────────────────────────── */
.gd-search-section {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  position: relative;
}
.gd-search-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #8c95a5;
  margin-bottom: 10px;
}
.gd-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.gd-search-ico {
  position: absolute;
  left: 10px;
  color: #a0a8b5;
  pointer-events: none;
}
#gd-search {
  width: 100%;
  border: 1px solid #dde1e8;
  border-radius: 8px;
  padding: 9px 36px 9px 34px;
  font-size: 14px;
  color: #1e2830;
  background: #fff;
  box-sizing: border-box;
}
#gd-search:focus {
  outline: none;
  border-color: #1664d2;
  box-shadow: 0 0 0 3px rgba(22,100,210,0.10);
}
.gd-spin {
  position: absolute;
  right: 10px;
  color: #1664d2;
}
@keyframes gd-rotate { to { transform: rotate(360deg); } }
.gd-rotating { animation: gd-rotate 0.8s linear infinite; }

/* ── Suggestions ────────────────────────────────── */
.gd-suggestions {
  position: absolute;
  top: calc(100% - 6px);
  left: 1.25rem;
  right: 1.25rem;
  background: #fff;
  border: 1px solid #dde1e8;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  z-index: 9999;
  max-height: 300px;
  overflow-y: auto;
}
.gd-sugg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid #f0f2f5;
}
.gd-sugg-item:last-child { border-bottom: none; }
.gd-sugg-item:hover { background: #f0f5ff; }
.gd-sugg-img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.gd-sugg-noimg {
  background: #f0f2f5;
}
.gd-sugg-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gd-sugg-name { font-size: 13.5px; font-weight: 500; color: #1e2830; }
.gd-sugg-sku  { font-size: 11.5px; color: #8c95a5; }
.gd-sugg-price {
  font-size: 13px;
  font-weight: 600;
  color: #1664d2;
  white-space: nowrap;
}
.gd-sugg-empty {
  padding: 14px;
  text-align: center;
  color: #8c95a5;
  font-size: 13px;
}

/* ── Table produits ─────────────────────────────── */
.gd-table-wrap {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.gd-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
.gd-table thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8c95a5;
  padding: 0 6px 10px;
  text-align: left;
  border-bottom: 1px solid #e8eaed;
}
.gd-table tbody tr:nth-child(even) td { background: #fafbfc; }
.gd-table tbody td { padding: 6px 4px; vertical-align: middle; }

.col-img  { width: 44px; }
.col-desc { width: auto; min-width: 150px; }
.col-ref  { width: 80px; }
.col-qty  { width: 60px; }
.col-pu   { width: 100px; }
.col-tva  { width: 60px; }
.col-tot  { width: 90px; text-align: right; padding-right: 10px; font-weight: 600; font-size: 13px; }
.col-del  { width: 36px; text-align: center; }

.gd-row-img {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}
.gd-row-noimg {
  background: #f0f2f5;
  width: 38px;
  height: 38px;
  border-radius: 6px;
}

.gd-inp {
  border: 1px solid #dde1e8;
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 13px;
  color: #1e2830;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}
.gd-inp:focus {
  outline: none;
  border-color: #1664d2;
  box-shadow: 0 0 0 2px rgba(22,100,210,0.10);
}
.gd-inp-sm  { font-size: 12px; }
.gd-inp-num { text-align: right; }

.gd-del-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #b0b8c5;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.gd-del-btn:hover {
  color: #e24b4a;
  background: #fef2f2;
}

.gd-empty {
  text-align: center;
  color: #a0a8b5;
  font-size: 13.5px;
  padding: 20px 0 10px;
  display: none;
}

.gd-btn-add {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #eef4ff;
  color: #1664d2;
  border: none;
  border-radius: 8px;
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s;
}
.gd-btn-add:hover { background: #dce9ff; }

/* ── Footer grid ────────────────────────────────── */
.gd-footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  margin-bottom: 1.25rem;
  align-items: start;
}
@media (max-width: 600px) {
  .gd-footer-grid { grid-template-columns: 1fr; }
}
.gd-conditions {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
}
.gd-conditions .gd-field input,
.gd-conditions .gd-field textarea {
  font-size: 13px;
}

.gd-totals {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  padding: 1.1rem 1.5rem;
  min-width: 220px;
}
.gd-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-size: 13.5px;
  padding: 5px 0;
  border-bottom: 1px solid #f0f2f5;
}
.gd-total-lbl { color: #7a8394; }
.gd-total-main {
  font-size: 15px;
  font-weight: 700;
  color: #1664d2;
  border-bottom: none;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 2px solid #e8eaed;
}

/* ── Actions ────────────────────────────────────── */
.gd-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.gd-btn-reset {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #dde1e8;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13.5px;
  color: #7a8394;
  cursor: pointer;
  transition: background 0.15s;
}
.gd-btn-reset:hover { background: #f7f8fa; }

.gd-btn-pdf {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1664d2;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 22px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.gd-btn-pdf:hover  { opacity: 0.88; }
.gd-btn-pdf:active { transform: scale(0.98); }

/* ── Toast ──────────────────────────────────────── */
.gd-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1664d2;
  color: #fff;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 99999;
  box-shadow: 0 4px 14px rgba(22,100,210,0.30);
}
.gd-toast-show { opacity: 1 !important; }
