/* =====================================================
   PEST DETECTOR AI – Styles Frontend v3.12.3
   Mobile-first — box-sizing global — pas d'overflow:hidden sur conteneurs texte
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=DM+Sans:wght@400;500&display=swap');

/* ─── RESET GLOBAL DANS LE WIDGET ─── */
.pd-wrapper,
.pd-wrapper * {
  box-sizing: border-box;
}

/* ─── VARIABLES ─── */
:root {
  --pd-dark:    #0f1f17;
  --pd-green:   #1a5c3a;
  --pd-mid:     #246b44;
  --pd-light:   #e8f5ee;
  --pd-accent:  #4ade80;
  --pd-warn1:   #fbbf24;
  --pd-warn2:   #f97316;
  --pd-danger:  #ef4444;
  --pd-white:   #ffffff;
  --pd-grey:    #6b7280;
  --pd-border:  #d1fae5;
  --pd-radius:  16px;
  --pd-shadow:  0 4px 24px rgba(15,31,23,.10);
  --pd-font-h:  'Sora', sans-serif;
  --pd-font-b:  'DM Sans', sans-serif;
}

/* ─── WRAPPER ─── */
.pd-wrapper {
  font-family: var(--pd-font-b);
  width: 100%;
  max-width: 720px;
  margin: 1rem auto;
  background: var(--pd-white);
  border: 1.5px solid var(--pd-border);
  box-shadow: var(--pd-shadow);
}
@media (min-width: 600px) {
  .pd-wrapper { margin: 2rem auto; border-radius: var(--pd-radius); }
}

/* ─── HEADER ─── */
.pd-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: .75rem;
  background: linear-gradient(135deg, var(--pd-dark) 0%, var(--pd-green) 100%);
  padding: 1.25rem 1rem; color: var(--pd-white);
}
@media (min-width: 480px) { .pd-header { padding: 1.75rem 1.5rem; gap: 1rem; } }

.pd-header-icon {
  flex-shrink: 0; width: 44px; height: 44px;
  background: rgba(255,255,255,.12); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; color: var(--pd-accent);
}
@media (min-width: 480px) { .pd-header-icon { width: 52px; height: 52px; border-radius: 14px; } }
.pd-header-icon svg { width: 28px; height: 28px; }
@media (min-width: 480px) { .pd-header-icon svg { width: 34px; height: 34px; } }

.pd-header-text { flex: 1; min-width: 0; }
.pd-title {
  font-family: var(--pd-font-h); font-size: 1.1rem; font-weight: 700;
  margin: 0 0 .2rem; color: #ffffff !important; word-break: break-word;
}
@media (min-width: 480px) { .pd-title { font-size: 1.35rem; } }
.pd-subtitle { margin: 0; font-size: .8rem; opacity: .8; color: var(--pd-white); word-break: break-word; }
@media (min-width: 480px) { .pd-subtitle { font-size: .875rem; } }

.pd-geo-status {
  flex-basis: 100%; background: rgba(255,255,255,.15); border-radius: 8px;
  padding: .3rem .75rem; font-size: .75rem; color: rgba(255,255,255,.9);
}
.pd-geo-status span { font-weight: 600; }
@media (min-width: 480px) { .pd-geo-status { flex-basis: auto; margin-left: auto; white-space: nowrap; } }

/* ─── UPLOAD ─── */
.pd-upload-section { padding: 1rem; }
@media (min-width: 480px) { .pd-upload-section { padding: 1.5rem; } }

.pd-dropzone {
  border: 2px dashed var(--pd-border); border-radius: var(--pd-radius);
  background: var(--pd-light); cursor: pointer;
  transition: border-color .2s, background .2s;
  min-height: 160px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; position: relative;
}
@media (min-width: 480px) { .pd-dropzone { min-height: 200px; } }
.pd-dropzone.pd-has-files { min-height: unset; justify-content: flex-start; cursor: default; background: var(--pd-white); }
.pd-dropzone:hover:not(.pd-has-files), .pd-dropzone.pd-drag-over { border-color: var(--pd-mid); background: #d1fae5; }

.pd-dropzone-content { text-align: center; padding: 1.25rem 1rem; width: 100%; }
@media (min-width: 480px) { .pd-dropzone-content { padding: 2rem; } }

.pd-upload-icon { width: 48px; height: 48px; margin: 0 auto .75rem; color: var(--pd-mid); }
.pd-upload-icon svg { width: 100%; height: 100%; }
.pd-drop-title { font-family: var(--pd-font-h); font-size: .95rem; font-weight: 600; color: var(--pd-dark); margin: 0 0 .4rem; }
@media (min-width: 480px) { .pd-drop-title { font-size: 1.05rem; } }
.pd-drop-sub { font-size: .875rem; color: var(--pd-grey); margin: 0 0 .5rem; }
.pd-link-btn { background: none; border: none; color: var(--pd-mid); font-weight: 600; cursor: pointer; font-size: .875rem; text-decoration: underline; padding: 0; }
.pd-drop-hint { font-size: .8rem; color: #9ca3af; margin: 0; }

.pd-preview-wrap { position: absolute; inset: 0; }
.pd-preview-wrap img { width: 100%; height: 100%; object-fit: cover; }
.pd-remove-img {
  position: absolute; top: 10px; right: 10px;
  background: rgba(15,31,23,.7); color: white; border: none; border-radius: 50%;
  width: 30px; height: 30px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

.pd-photo-types { margin: 1rem 0; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.pd-photo-type-label { font-size: .78rem; color: var(--pd-grey); font-weight: 500; width: 100%; }
@media (min-width: 480px) { .pd-photo-type-label { width: auto; } }
.pd-photo-type-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.pd-chip { background: var(--pd-light); border: 1px solid var(--pd-border); border-radius: 99px; padding: .2rem .65rem; font-size: .75rem; color: var(--pd-green); font-weight: 500; }

.pd-analyze-btn {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; padding: .85rem 1rem; min-height: 48px;
  background: linear-gradient(135deg, var(--pd-green) 0%, var(--pd-mid) 100%);
  color: var(--pd-white); border: none; border-radius: 12px;
  font-family: var(--pd-font-h); font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: opacity .2s, transform .1s; margin-top: .5rem;
}
@media (min-width: 480px) { .pd-analyze-btn { font-size: 1rem; padding: .9rem 1.5rem; } }
.pd-analyze-btn:disabled { opacity: .4; cursor: not-allowed; }
.pd-analyze-btn:not(:disabled):hover { opacity: .9; transform: translateY(-1px); }
.pd-btn-icon { font-size: 1.1rem; }

.pd-error-msg { background: #fee2e2; border: 1px solid #fca5a5; color: #dc2626; border-radius: 8px; padding: .75rem 1rem; font-size: .875rem; margin-top: 1rem; }

.pd-upload-footer { display: flex; align-items: center; justify-content: space-between; padding: .35rem .25rem 0; font-size: .82rem; }
.pd-photo-count { color: var(--pd-mid); font-weight: 600; }
.pd-add-more-btn { background: none; border: 1.5px dashed var(--pd-mid); color: var(--pd-mid); border-radius: 8px; padding: .3rem .75rem; font-size: .8rem; font-weight: 600; cursor: pointer; transition: background .15s; }
.pd-add-more-btn:hover { background: var(--pd-light); }

.pd-thumb-strip { display: flex; flex-wrap: wrap; gap: .6rem; padding: 1rem; justify-content: center; width: 100%; }
.pd-thumb { position: relative; width: 110px; height: 90px; border-radius: 10px; overflow: hidden; border: 2px solid var(--pd-border); box-shadow: 0 2px 8px rgba(15,31,23,.10); flex-shrink: 0; }
@media (min-width: 480px) { .pd-thumb { width: 130px; height: 110px; } }
.pd-thumb-img-wrap { width: 100%; height: 100%; }
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-thumb-remove { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.62); color: #fff; border: none; border-radius: 50%; font-size: 11px; font-weight: 700; line-height: 1; cursor: pointer; padding: 0; z-index: 10; opacity: 0; transition: opacity .18s, background .15s, transform .15s; }
.pd-thumb:hover .pd-thumb-remove { opacity: 1; }
.pd-thumb-remove:hover { background: #ef4444; transform: scale(1.15); }

/* ─── LOADER ─── */
.pd-loader { padding: 2.5rem 1rem; text-align: center; }
@media (min-width: 480px) { .pd-loader { padding: 3rem 2rem; } }
.pd-spinner { width: 48px; height: 48px; border: 4px solid var(--pd-light); border-top-color: var(--pd-mid); border-radius: 50%; margin: 0 auto 1.25rem; animation: pd-spin .8s linear infinite; }
@keyframes pd-spin { to { transform: rotate(360deg); } }
.pd-loader-text { font-family: var(--pd-font-h); font-weight: 600; color: var(--pd-dark); margin: 0 0 .4rem; }
.pd-loader-sub { font-size: .875rem; color: var(--pd-grey); margin: 0 0 1rem; }
.pd-loader-progress-wrap { display: flex; flex-direction: column; align-items: center; gap: .6rem; margin: .5rem auto 0; width: 100%; max-width: 280px; }
.pd-loader-progress-bar { width: 100%; height: 6px; background: var(--pd-light); border-radius: 999px; overflow: hidden; }
.pd-loader-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--pd-green), var(--pd-accent)); border-radius: 999px; transition: width .9s linear; }
.pd-loader-timer-label { font-size: .82rem; font-weight: 600; color: var(--pd-mid); }

/* ─── RÉSULTATS ─── */
.pd-results { padding: 1rem; }
@media (min-width: 480px) { .pd-results { padding: 1.5rem 1.5rem 2rem; } }

.pd-result-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.pd-back-btn { background: none; border: 1.5px solid var(--pd-border); color: var(--pd-mid); border-radius: 8px; padding: .4rem .9rem; font-size: .82rem; font-weight: 600; cursor: pointer; transition: background .15s; flex-shrink: 0; white-space: nowrap; }
.pd-back-btn:hover { background: var(--pd-light); }
.pd-result-title { font-family: var(--pd-font-h); font-size: 1rem; font-weight: 700; color: var(--pd-dark); margin: 0; word-break: break-word; min-width: 0; }
@media (min-width: 480px) { .pd-result-title { font-size: 1.1rem; } }

/* ─── CARDS ─── */
.pd-result-card {
  background: var(--pd-white); border: 1.5px solid var(--pd-border);
  border-radius: var(--pd-radius); padding: 1rem; margin-bottom: 1rem;
  word-break: break-word; overflow-wrap: anywhere; min-width: 0;
}
@media (min-width: 480px) { .pd-result-card { padding: 1.25rem; } }

.pd-card-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .85rem; }
.pd-card-icon { font-size: 1.1rem; flex-shrink: 0; }
.pd-card-header h4 { font-family: var(--pd-font-h); font-size: .9rem; font-weight: 700; color: var(--pd-dark); margin: 0; flex: 1; min-width: 0; word-break: break-word; }
@media (min-width: 480px) { .pd-card-header h4 { font-size: .95rem; } }
.pd-confidence-badge { background: var(--pd-light); color: var(--pd-green); border-radius: 99px; padding: .2rem .6rem; font-size: .75rem; font-weight: 600; flex-shrink: 0; white-space: nowrap; }

.pd-common-name { font-family: var(--pd-font-h); font-size: 1.2rem; font-weight: 700; color: var(--pd-dark); margin: 0 0 .2rem; word-break: break-word; }
@media (min-width: 480px) { .pd-common-name { font-size: 1.4rem; } }
.pd-scientific-name { font-style: italic; font-size: .875rem; color: var(--pd-grey); margin: 0 0 .5rem; word-break: break-word; }
.pd-meta-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .25rem; }
.pd-meta-tag { background: var(--pd-light); color: var(--pd-green); border-radius: 99px; padding: .2rem .65rem; font-size: .75rem; font-weight: 600; border: 1px solid var(--pd-border); }
.pd-description { font-size: .875rem; color: #374151; line-height: 1.6; word-break: break-word; overflow-wrap: anywhere; min-width: 0; }

.pd-danger-gauge-wrap { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.pd-danger-gauge { flex: 1; height: 12px; background: #e5e7eb; border-radius: 99px; overflow: hidden; min-width: 0; }
.pd-danger-fill { height: 100%; border-radius: 99px; transition: width .6s cubic-bezier(.34,1.56,.64,1), background-color .3s; }
.pd-danger-label { font-family: var(--pd-font-h); font-size: .85rem; font-weight: 700; min-width: 70px; text-align: right; flex-shrink: 0; }
@media (min-width: 480px) { .pd-danger-label { font-size: .9rem; min-width: 80px; } }

.pd-risks-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
@media (min-width: 480px) { .pd-risks-grid { grid-template-columns: 1fr 1fr; gap: 1rem; } }
.pd-risk-col h5 { font-family: var(--pd-font-h); font-size: .8rem; font-weight: 700; color: var(--pd-dark); margin: 0 0 .4rem; }
.pd-risk-col ul { list-style: none; margin: 0; padding: 0; }
.pd-risk-col ul li { font-size: .8rem; color: #374151; padding: .2rem 0; display: flex; align-items: flex-start; gap: .4rem; word-break: break-word; overflow-wrap: anywhere; }
.pd-risk-col ul li::before { content: '•'; color: var(--pd-mid); font-weight: 700; flex-shrink: 0; margin-top: .05rem; }

.pd-signs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.pd-signs-list li { display: flex; align-items: flex-start; gap: .5rem; font-size: .875rem; color: #374151; word-break: break-word; overflow-wrap: anywhere; }
.pd-signs-list li::before { content: '✓'; color: var(--pd-mid); font-weight: 700; flex-shrink: 0; }

.pd-treatment-text { font-size: .875rem; color: #374151; line-height: 1.6; margin: 0; word-break: break-word; overflow-wrap: anywhere; min-width: 0; }

/* ─── SCORE D'URGENCE ANIMÉ ─── */
.pd-urgency-score {
  position: relative; background: #fef2f2; border: 2px solid #ef4444;
  border-radius: var(--pd-radius); padding: 1rem; margin-bottom: 1rem; overflow: hidden;
}
.pd-urgency-pulse-ring { position: absolute; inset: 0; border-radius: inherit; border: 2px solid #ef4444; animation: pd-ring-pulse 1.5s ease-out infinite; }
@keyframes pd-ring-pulse { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.06); } }
.pd-urgency-content { display: flex; align-items: flex-start; gap: .75rem; position: relative; }
.pd-urgency-icon { font-size: 1.6rem; flex-shrink: 0; animation: pd-shake .4s ease infinite alternate; }
@media (min-width: 480px) { .pd-urgency-icon { font-size: 2rem; } }
@keyframes pd-shake { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.pd-urgency-content div { min-width: 0; flex: 1; }
.pd-urgency-content strong { font-family: var(--pd-font-h); font-size: .9rem; color: #dc2626; display: block; word-break: break-word; }
@media (min-width: 480px) { .pd-urgency-content strong { font-size: 1rem; } }
.pd-urgency-content p { margin: .2rem 0 0; font-size: .82rem; color: #7f1d1d; word-break: break-word; overflow-wrap: anywhere; }
@media (min-width: 480px) { .pd-urgency-content p { font-size: .88rem; } }
#pd-countdown { font-family: 'Courier New', monospace; font-weight: 700; font-size: .95rem; color: #dc2626; }
@media (min-width: 480px) { #pd-countdown { font-size: 1.1rem; } }
.pd-urgency-link { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pd-urgency-link:hover { opacity: .85; }

/* ─── CTA ─── */
.pd-cta-block { background: linear-gradient(135deg, var(--pd-dark) 0%, var(--pd-green) 100%); border-radius: var(--pd-radius); overflow: hidden; margin-top: .5rem; }
.pd-cta-urgency { background: var(--pd-danger); display: flex; align-items: center; gap: .6rem; padding: .6rem 1rem; font-size: .8rem; font-weight: 700; color: white; word-break: break-word; }
.pd-urgency-dot { width: 8px; height: 8px; background: white; border-radius: 50%; flex-shrink: 0; animation: pd-pulse 1.2s ease-in-out infinite; }
@keyframes pd-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .6; transform: scale(1.4); } }
.pd-cta-content { padding: 1rem; display: flex; flex-direction: column; align-items: stretch; gap: .75rem; }
@media (min-width: 520px) { .pd-cta-content { flex-direction: row; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.5rem; } }
.pd-cta-text { min-width: 0; }
.pd-cta-text h3 { font-family: var(--pd-font-h); font-size: 1.05rem; font-weight: 700; color: white; margin: 0 0 .25rem; word-break: break-word; }
@media (min-width: 480px) { .pd-cta-text h3 { font-size: 1.15rem; margin-bottom: .35rem; } }
.pd-cta-text p { font-size: .82rem; color: rgba(255,255,255,.75); margin: 0; word-break: break-word; }
@media (min-width: 480px) { .pd-cta-text p { font-size: .85rem; } }
.pd-cta-actions { display: flex; flex-direction: column; gap: .5rem; }
@media (min-width: 520px) { .pd-cta-actions { flex-shrink: 0; gap: .6rem; } }
.pd-cta-btn { display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .7rem 1.1rem; border-radius: 10px; font-family: var(--pd-font-h); font-size: .85rem; font-weight: 700; text-decoration: none !important; transition: opacity .2s, transform .1s; white-space: normal; text-align: center; min-height: 44px; width: 100%; }
@media (min-width: 520px) { .pd-cta-btn { white-space: nowrap; width: auto; } }
.pd-cta-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.pd-cta-btn:hover { opacity: .9; transform: translateY(-1px); }
.pd-cta-primary  { background: var(--pd-accent); color: var(--pd-dark) !important; }
.pd-cta-secondary { background: rgba(255,255,255,.15); color: white !important; border: 1.5px solid rgba(255,255,255,.3); }

/* ─── CONFIANCE FAIBLE ─── */
.pd-low-confidence { text-align: center; padding: 1.5rem 1rem; background: #fffbeb; border: 1.5px solid #fde68a; border-radius: var(--pd-radius); margin-bottom: 1rem; }
@media (min-width: 480px) { .pd-low-confidence { padding: 2rem; } }
.pd-lc-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.pd-low-confidence h4 { font-family: var(--pd-font-h); font-size: 1rem; margin: 0 0 .5rem; color: #92400e; }
.pd-low-confidence p  { font-size: .85rem; color: #78350f; margin: 0 0 .5rem; word-break: break-word; }
.pd-lc-actions { display: flex; gap: .6rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }

/* ─── FORMULAIRE DE RAPPEL ─── */
.pd-callback-block {
  border: 1.5px solid var(--pd-border); border-radius: var(--pd-radius);
  margin-top: 1rem; background: var(--pd-white);
}
.pd-callback-header {
  background: var(--pd-light); padding: .85rem 1rem;
  display: flex; align-items: center; gap: .65rem; font-size: 1.2rem;
  border-radius: var(--pd-radius) var(--pd-radius) 0 0;
}
@media (min-width: 480px) { .pd-callback-header { padding: 1rem 1.25rem; font-size: 1.3rem; } }
.pd-callback-header div { min-width: 0; flex: 1; }
.pd-callback-header div strong { font-family: var(--pd-font-h); font-size: .9rem; color: var(--pd-dark); display: block; word-break: break-word; }
@media (min-width: 480px) { .pd-callback-header div strong { font-size: .95rem; } }
.pd-callback-header div p { margin: .15rem 0 0; font-size: .78rem; color: var(--pd-grey); word-break: break-word; }

.pd-callback-form { padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
@media (min-width: 480px) { .pd-callback-form { padding: 1.25rem; } }

.pd-form-row { display: grid; grid-template-columns: 1fr; gap: .6rem; }
@media (min-width: 440px) { .pd-form-row { grid-template-columns: 1fr 1fr; } }

.pd-form-input {
  border: 1.5px solid #e5e7eb; border-radius: 8px;
  padding: .6rem .85rem; font-size: .875rem;
  width: 100%; min-width: 0;
  transition: border-color .15s; outline: none;
}
.pd-form-input:focus { border-color: var(--pd-mid); }
.pd-form-input[readonly] { background: var(--pd-light); color: var(--pd-grey); }

.pd-form-submit {
  width: 100%; padding: .85rem 1rem; min-height: 48px;
  background: linear-gradient(135deg, var(--pd-green), var(--pd-mid));
  color: #fff; border: none; border-radius: 10px;
  font-family: var(--pd-font-h); font-size: .9rem; font-weight: 700;
  cursor: pointer; transition: opacity .2s;
  white-space: normal; line-height: 1.3;
}
@media (min-width: 480px) { .pd-form-submit { font-size: .95rem; } }
.pd-form-submit:hover { opacity: .9; }
.pd-form-submit:disabled { opacity: .5; cursor: not-allowed; }

.pd-callback-success {
  padding: 1rem; background: #f0fdf4; color: #166534; font-size: .875rem;
  text-align: center; border-radius: 0 0 var(--pd-radius) var(--pd-radius); word-break: break-word;
}
