/**
 * Drop2Desk - Styles Mode Asynchrone & Tournées IDEL
 * Palette officielle Vert Officine (#409348, #2f7035, #ebf9ee)
 * Conforme Charte Zéro Emoji (SVG vectoriel pur)
 */

.async-patient-section {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 30px auto;
  padding: 0 4px;
}

/* Bandeau Pharmacie & Sécurité */
.async-header-card {
  background: linear-gradient(135deg, #ebf9ee 0%, #f0fdf4 100%);
  border: 1.5px solid #bbf7d0;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(64, 147, 72, 0.06);
}

.async-pharma-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #143318;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.async-pharma-city {
  font-size: 0.85rem;
  font-weight: 600;
  color: #409348;
  margin-bottom: 8px;
}

.async-security-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #86efac;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #166534;
}

/* Sélecteur de Rôle (Patient vs IDEL) */
.async-role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f1f5f9;
  padding: 5px;
  border-radius: 14px;
  margin-bottom: 18px;
  border: 1px solid #e2e8f0;
}

.async-role-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.async-role-btn.active {
  background: #ffffff;
  color: #143318;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.async-role-btn.active svg {
  stroke: #409348;
}

/* Bandeau Tournée IDEL */
.async-idel-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  color: #1e40af;
  line-height: 1.4;
}

.async-idel-banner svg {
  flex-shrink: 0;
  stroke: #2563eb;
  margin-top: 2px;
}

/* Cartes de sections */
.async-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.async-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.async-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.96rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
}

.async-card-title svg {
  stroke: #409348;
}

.async-badge-required {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.async-badge-optional {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.async-card-desc {
  font-size: 0.82rem;
  color: #64748b;
  margin: -6px 0 12px 0;
  line-height: 1.4;
}

/* Champs formulaires */
.async-field-group {
  margin-bottom: 12px;
}

.async-field-group:last-child {
  margin-bottom: 0;
}

.async-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}

.async-input, .async-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.92rem;
  color: #0f172a;
  background: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.async-input:focus, .async-textarea:focus {
  outline: none;
  border-color: #409348;
  box-shadow: 0 0 0 3px rgba(64, 147, 72, 0.15);
}

.async-textarea {
  resize: vertical;
  min-height: 64px;
}

/* Zone d'import de documents */
.async-upload-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.async-btn-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #f8fafc;
  border: 1.5px dashed #94a3b8;
  border-radius: 12px;
  padding: 11px 10px;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
  text-align: center;
}

.async-btn-upload:active, .async-btn-upload:hover {
  background: #ebf9ee;
  border-color: #409348;
  color: #143318;
}

.async-btn-upload svg {
  stroke: #409348;
  flex-shrink: 0;
}

/* Liste des fichiers importés */
.async-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.async-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
}

.async-file-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  background: #e2e8f0;
  flex-shrink: 0;
  margin-right: 10px;
}

.async-file-thumb-fallback {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #ebf9ee;
  color: #409348;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-right: 10px;
}

.async-file-info {
  flex-grow: 1;
  overflow: hidden;
}

.async-file-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.async-file-size {
  font-size: 0.74rem;
  color: #64748b;
}

.async-file-remove {
  background: transparent;
  border: none;
  color: #ef4444;
  padding: 6px;
  cursor: pointer;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.async-file-remove:hover {
  background: #fee2e2;
}

/* Programme de Renouvellement */
.async-renewal-box {
  background: #fcfdfa;
  border: 1px solid #d9f3dc;
  border-radius: 12px;
  padding: 12px 14px;
}

.async-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.async-toggle-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #143318;
  display: flex;
  align-items: center;
  gap: 8px;
}

.async-toggle-label svg {
  stroke: #409348;
}

.async-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.async-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.async-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: 0.2s;
  border-radius: 24px;
}

.async-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.async-switch input:checked + .async-slider {
  background-color: #409348;
}

.async-switch input:checked + .async-slider:before {
  transform: translateX(20px);
}

.async-renewal-options {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #d9f3dc;
}

.async-renewal-hint {
  font-size: 0.78rem;
  color: #409348;
  margin-top: 6px;
  line-height: 1.35;
}

/* Bouton Géant d'envoi */
.async-submit-area {
  margin-top: 22px;
  text-align: center;
}

.btn-async-submit {
  width: 100%;
  padding: 16px 20px;
  background: #409348;
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(64, 147, 72, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.btn-async-submit:hover:not(:disabled) {
  background: #2f7035;
  box-shadow: 0 6px 18px rgba(64, 147, 72, 0.45);
  transform: translateY(-1px);
}

.btn-async-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-async-submit:disabled {
  background: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}

.async-submit-hint {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 10px;
  line-height: 1.35;
}

/* Écran de Succès Asynchrone */
.async-success-card {
  background: #ffffff;
  border: 1.5px solid #86efac;
  border-radius: 20px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(64, 147, 72, 0.1);
  margin-bottom: 24px;
}

.async-success-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #dcfce7;
  color: #166534;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.async-pickup-box {
  background: #f0fdf4;
  border: 2px solid #409348;
  border-radius: 14px;
  padding: 14px 20px;
  margin: 16px auto;
  max-width: 320px;
}

.async-pickup-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #166534;
  margin-bottom: 4px;
}

.async-pickup-code {
  font-family: monospace;
  font-size: 2.2rem;
  font-weight: 900;
  color: #143318;
  letter-spacing: 3px;
}

.async-success-text {
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 16px;
}

.btn-async-restart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  padding: 13px 20px;
  background: #409348;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 0.94rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(64, 147, 72, 0.25);
  margin-top: 6px;
  touch-action: manipulation;
}

.btn-async-restart:hover {
  background: #2f7035;
}

/* Modale de Progression du Chiffrement et Envoi */
.async-progress-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(14, 30, 47, 0.65);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.async-progress-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 24px 20px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.async-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e2e8f0;
  border-top-color: #409348;
  border-radius: 50%;
  animation: asyncSpin 0.9s linear infinite;
  margin: 0 auto 16px auto;
}

@keyframes asyncSpin {
  to { transform: rotate(360deg); }
}

.async-progress-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 6px;
}

.async-progress-status {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 12px;
}
