/* Demo scheduling modal + extensions for eCourier Services */

.ecourier-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: ecourier-fade-in 0.2s ease;
}

.ecourier-modal {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
  animation: ecourier-slide-up 0.25s ease;
}

.ecourier-modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
  overflow-x: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.ecourier-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.5rem 0;
  max-width: 100%;
  box-sizing: border-box;
}

.ecourier-modal-header h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  color: #0f172a;
  font-family: Inter, system-ui, sans-serif;
}

.ecourier-modal-header p {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: #64748b;
  font-family: Inter, system-ui, sans-serif;
}

.ecourier-modal-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: #f1f5f9;
  color: #475569;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}

.ecourier-modal-close:hover {
  background: #e2e8f0;
}

.ecourier-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.ecourier-step {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: #e2e8f0;
  transition: background 0.2s;
}

.ecourier-step.active,
.ecourier-step.done {
  background: #0066cc;
}

.ecourier-field {
  margin-bottom: 1rem;
  min-width: 0;
  max-width: 100%;
}

.ecourier-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  font-family: Inter, system-ui, sans-serif;
}

.ecourier-field input,
.ecourier-field select,
.ecourier-field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  font-size: 1rem;
  line-height: 1.25;
  font-family: Inter, system-ui, sans-serif;
  color: #0f172a;
  background: #fff;
  box-sizing: border-box;
  min-height: 2.75rem;
}

.ecourier-field input:not([type="date"]),
.ecourier-field select,
.ecourier-field textarea {
  -webkit-appearance: none;
  appearance: none;
}

.ecourier-field select,
.ecourier-input-select {
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}

/* Date + time controls — matched dimensions */
.ecourier-input-control {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 2.75rem;
  min-height: 2.75rem;
  text-align: left;
}

.ecourier-date-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.ecourier-field input[type="date"],
.ecourier-date-wrap .ecourier-input-date {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 2.75rem;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.65rem 2.5rem 0.65rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  font-size: 1rem;
  line-height: 1.25;
  font-family: Inter, system-ui, sans-serif;
  color: #0f172a;
  background: #fff;
  box-sizing: border-box;
  cursor: pointer;
  position: relative;
  color-scheme: light;
  /* Match sibling controls; avoid iOS intrinsic overflow */
  -webkit-appearance: none;
  appearance: none;
}

.ecourier-date-wrap .ecourier-input-date::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
  padding: 0;
  min-height: 1.25em;
  line-height: 1.25;
}

.ecourier-date-wrap .ecourier-input-date::-webkit-calendar-picker-indicator {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  margin: 0;
  cursor: pointer;
  opacity: 0.7;
}

.ecourier-datetime-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-bottom: 0.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.ecourier-datetime-fields .ecourier-field {
  margin-bottom: 1rem;
  min-width: 0;
  width: 100%;
}

.ecourier-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.ecourier-row > .ecourier-field {
  min-width: 0;
}

@media (max-width: 640px) {
  .ecourier-modal-overlay {
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  }

  .ecourier-modal {
    max-height: min(92vh, calc(100dvh - 1.5rem));
  }

  .ecourier-modal-header,
  .ecourier-modal-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .ecourier-datetime-fields,
  .ecourier-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .ecourier-datetime-fields .ecourier-field,
  .ecourier-datetime-fields .ecourier-date-wrap,
  .ecourier-datetime-fields .ecourier-input-date,
  .ecourier-datetime-fields .ecourier-input-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .ecourier-field input[type="date"],
  .ecourier-date-wrap .ecourier-input-date {
    font-size: 16px; /* prevent iOS input zoom / layout jump */
    height: 2.75rem;
    min-height: 2.75rem;
    padding: 0.7rem 2.5rem 0.7rem 0.75rem;
  }

  .ecourier-row > .ecourier-field {
    margin-bottom: 1rem;
  }

  .ecourier-actions {
    flex-direction: column-reverse;
  }

  .ecourier-btn {
    width: 100%;
    min-height: 2.75rem;
  }
}

.ecourier-field input:focus,
.ecourier-field select:focus,
.ecourier-field textarea:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.ecourier-date-wrap .ecourier-input-date:focus {
  outline: none;
  border-color: #2E5BFF;
  box-shadow: 0 0 0 3px rgba(46, 91, 255, 0.15);
}
.ecourier-field textarea {
  min-height: 80px;
  resize: vertical;
  -webkit-appearance: none;
  appearance: none;
}

.ecourier-availability {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #0369a1;
  margin-bottom: 1rem;
  font-family: Inter, system-ui, sans-serif;
}

.ecourier-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.ecourier-btn {
  flex: 1;
  padding: 0.7rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: Inter, system-ui, sans-serif;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}

.ecourier-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ecourier-btn-primary {
  background: #0066cc;
  color: #fff;
}

.ecourier-btn-primary:hover:not(:disabled) {
  background: #0052a3;
}

.ecourier-btn-secondary {
  background: #f1f5f9;
  color: #334155;
}

.ecourier-btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

.ecourier-error {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.45;
}

.ecourier-success {
  text-align: center;
  padding: 2rem 1rem;
  font-family: Inter, system-ui, sans-serif;
}

.ecourier-success-icon {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1rem;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.ecourier-success h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  color: #0f172a;
}

.ecourier-success p {
  margin: 0;
  color: #64748b;
  font-size: 0.95rem;
}

.ecourier-summary {
  background: #f8fafc;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #334155;
  font-family: Inter, system-ui, sans-serif;
}

.ecourier-summary dt {
  font-weight: 600;
  margin-top: 0.5rem;
}

.ecourier-summary dt:first-child {
  margin-top: 0;
}

.ecourier-summary dd {
  margin: 0.15rem 0 0;
  color: #64748b;
}

@keyframes ecourier-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ecourier-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Back to top — matches Courier-TopShippingdev ScrollToTop behavior */
.ecourier-back-to-top {
  position: fixed;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 9999px;
  color: #fff;
  cursor: pointer;
  background: #ea580c;
  box-shadow:
    0 4px 14px rgba(234, 88, 12, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.12);
  /* Sit above the WhatsApp chat FAB */
  bottom: calc(1.25rem + 3.75rem + 0.75rem);
  bottom: calc(max(1.25rem, env(safe-area-inset-bottom, 0px)) + 3.75rem + 0.75rem);
  right: max(1.25rem, env(safe-area-inset-right, 0px));
  transition:
    opacity 0.75s ease-in-out,
    transform 0.75s ease-in-out,
    box-shadow 0.2s ease;
}

.ecourier-back-to-top--visible:hover {
  transform: translateY(0) scale(1.04);
  background: #c2410c;
  box-shadow:
    0 6px 20px rgba(234, 88, 12, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.15);
}

.ecourier-back-to-top:focus-visible {
  outline: 2px solid #ea580c;
  outline-offset: 2px;
}

.ecourier-back-to-top--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.ecourier-back-to-top--hidden {
  opacity: 0;
  transform: translateY(0.75rem);
  pointer-events: none;
}

.ecourier-back-to-top svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Contact Us modal */
.ecourier-contact-modal {
  max-width: 340px;
}

.ecourier-contact-modal .ecourier-modal-header {
  padding: 1rem 1.15rem 0;
  gap: 0.75rem;
}

.ecourier-contact-modal .ecourier-modal-header h2 {
  font-size: 1.125rem;
}

.ecourier-contact-modal .ecourier-modal-header p {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
}

.ecourier-contact-modal .ecourier-modal-close {
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
}

.ecourier-contact-modal .ecourier-modal-body {
  padding: 0.85rem 1.15rem 1.15rem;
}

.ecourier-contact-options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ecourier-contact-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #f8fafc;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.ecourier-contact-option:hover {
  border-color: #0066cc;
  background: #f0f9ff;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.ecourier-contact-option-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.55rem;
  background: #0066cc;
  color: #fff;
}

.ecourier-contact-option-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

.ecourier-contact-option-icon--sms {
  background: #0ea5e9;
}

.ecourier-contact-option-icon--imessage {
  background: #34c759;
}

.ecourier-contact-option-icon--imessage svg {
  width: 1.85rem;
  height: 1.85rem;
}

.ecourier-contact-option-icon--whatsapp {
  background: #25d366;
}

.ecourier-contact-option-icon--whatsapp svg {
  width: 1.53rem;
  height: 1.53rem;
}

.ecourier-contact-option-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  font-family: Inter, system-ui, sans-serif;
}

.ecourier-contact-option-text strong {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
}

.ecourier-contact-option-text span:last-child {
  font-size: 0.8125rem;
  color: #0066cc;
  word-break: break-word;
}

/* US & China warehouse flags */
.warehouse-flags-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.5rem;
  margin: 0 auto 1.5rem;
}

.warehouse-flags-row--integrations {
  max-width: 36rem;
}

.warehouse-flags-row--partnership {
  max-width: 40rem;
  margin-bottom: 2rem;
}

.warehouse-flag-item {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
}

.warehouse-flags-row--partnership .warehouse-flag-item {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: none;
}

.warehouse-flag-item img {
  width: 2rem;
  height: auto;
  border-radius: 0.2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.ecourier-input-select option:disabled {
  color: #94a3b8;
  font-style: italic;
}


/* WhatsApp chat FAB — bottom-right */
.ecourier-whatsapp-fab {
  position: fixed;
  z-index: 9001;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.75rem;
  height: 3.75rem;
  border: none;
  border-radius: 9999px;
  background: #2563eb;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    0 6px 20px rgba(37, 99, 235, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.15);
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  right: max(1.25rem, env(safe-area-inset-right, 0px));
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ecourier-whatsapp-fab:hover {
  background: #1d4ed8;
  transform: scale(1.05);
  box-shadow:
    0 8px 24px rgba(37, 99, 235, 0.48),
    0 4px 10px rgba(0, 0, 0, 0.18);
}

.ecourier-whatsapp-fab:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

.ecourier-whatsapp-fab img.ecourier-whatsapp-fab-icon-chat {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  background: #0b1220;
  display: block;
}

.ecourier-whatsapp-fab svg {
  width: 2rem;
  height: 2rem;
  display: block;
}

.ecourier-whatsapp-fab-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 480px) {
  .ecourier-whatsapp-fab {
    width: 3.5rem;
    height: 3.5rem;
  }
  .ecourier-whatsapp-fab img.ecourier-whatsapp-fab-icon-chat {
    width: 34px;
    height: 34px;
  }
  .ecourier-whatsapp-fab svg {
    width: 1.85rem;
    height: 1.85rem;
  }
}


.ecourier-whatsapp-fab .ecourier-whatsapp-fab-icon-close {
  display: none;
}
.ecourier-whatsapp-fab--open .ecourier-whatsapp-fab-icon-chat {
  display: none;
}
.ecourier-whatsapp-fab--open .ecourier-whatsapp-fab-icon-close {
  display: block;
  width: 1.6rem;
  height: 1.6rem;
}

.ecourier-webchat-panel[hidden] {
  display: none !important;
}

.ecourier-webchat-panel {
  position: fixed;
  z-index: 9002;
  right: max(1.25rem, env(safe-area-inset-right, 0px));
  bottom: calc(max(1.25rem, env(safe-area-inset-bottom, 0px)) + 3.75rem + 0.75rem);
  width: min(380px, calc(100vw - 1.5rem));
  height: min(560px, calc(100dvh - 7.5rem), calc(100vh - 7.5rem));
  max-height: calc(100dvh - 7.5rem);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow:
    0 18px 50px rgba(15, 23, 42, 0.22),
    0 4px 14px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-family: Inter, system-ui, sans-serif;
  /* Keep compose row above mobile keyboards when possible */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.ecourier-webchat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  flex-shrink: 0;
}

.ecourier-webchat-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  padding: 0.9rem 1rem;
}

.ecourier-webchat-header strong {
  display: block;
  font-size: 0.95rem;
}

.ecourier-webchat-header span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  opacity: 0.92;
}

.ecourier-webchat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.85rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ecourier-webchat-bubble {
  max-width: 85%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.85rem;
  font-size: 0.875rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.ecourier-webchat-bubble--visitor {
  align-self: flex-end;
  background: #dbeafe;
  color: #0f172a;
  border-bottom-right-radius: 0.25rem;
}

.ecourier-webchat-bubble--ai {
  align-self: flex-start;
  background: #eff6ff;
  color: #0f172a;
  border: 1px solid #bfdbfe;
  border-bottom-left-radius: 0.25rem;
}

.ecourier-webchat-bubble--agent {
  align-self: flex-start;
  background: #fff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 0.25rem;
}

.ecourier-webchat-bubble--system {
  align-self: center;
  background: transparent;
  color: #64748b;
  font-size: 0.78rem;
  text-align: center;
  max-width: 95%;
}


.ecourier-webchat-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  min-height: 2.4rem;
  opacity: 0;
  animation: ecourier-webchat-typing-fade-in 0.55s ease forwards;
}

@keyframes ecourier-webchat-typing-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ecourier-webchat-typing-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

.ecourier-webchat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
}

.ecourier-webchat-typing-dots span {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: #3b82f6;
  opacity: 0.35;
  animation: ecourier-webchat-typing-bounce 1.2s infinite ease-in-out;
}

.ecourier-webchat-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ecourier-webchat-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ecourier-webchat-typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-3px); opacity: 1; }
}


.ecourier-webchat-end {
  display: block;
  width: calc(100% - 1.5rem);
  margin: 0 0.75rem 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #fecaca;
  border-radius: 0.55rem;
  background: #fef2f2;
  color: #b91c1c;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.ecourier-webchat-end:hover { background: #fee2e2; }
.ecourier-webchat-end[hidden] { display: none !important; }
.ecourier-webchat-end:disabled { opacity: 0.65; cursor: wait; }

.ecourier-webchat-ended {
  flex: 0 0 auto;
  border-top: 1px solid #e2e8f0;
  padding: 0.85rem 0.75rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.ecourier-webchat-ended[hidden] { display: none !important; }
.ecourier-webchat-ended-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
}
.ecourier-webchat-ended-note {
  margin: 0;
  font-size: 0.85rem;
  color: #15803d;
  text-align: center;
  font-weight: 600;
}
.ecourier-webchat-ended-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.ecourier-webchat-ended-actions[hidden] { display: none !important; }
.ecourier-webchat-transcript-btn {
  border: none;
  border-radius: 0.55rem;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
}
.ecourier-webchat-transcript-btn:hover { background: #1d4ed8; }
.ecourier-webchat-transcript-btn[hidden] { display: none !important; }
.ecourier-webchat-close-ended {
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}
.ecourier-webchat-transcript-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.ecourier-webchat-transcript-form[hidden] { display: none !important; }
.ecourier-webchat-transcript-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}
.ecourier-webchat-form[hidden] { display: none !important; }
.ecourier-webchat-form {
  flex: 0 0 auto;
  border-top: 1px solid #e2e8f0;
  padding: 0.65rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ecourier-webchat-name {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
  /* 16px avoids iOS zoom-on-focus */
  font-size: 1rem;
  line-height: 1.3;
  -webkit-appearance: none;
  appearance: none;
}

.ecourier-webchat-compose {
  display: flex;
  gap: 0.45rem;
  align-items: flex-end;
}

.ecourier-webchat-compose textarea {
  box-sizing: border-box;
  flex: 1;
  resize: none;
  min-height: 2.75rem;
  /* ~5 lines (WhatsApp-style), then scroll */
  max-height: calc(1.35em * 5 + 1.3rem);
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.35;
  -webkit-appearance: none;
  appearance: none;
}

.ecourier-webchat-send {
  flex: 0 0 auto;
  border: none;
  border-radius: 0.65rem;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  min-height: 2.75rem;
  min-width: 4.25rem;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  touch-action: manipulation;
}

.ecourier-webchat-send:hover { background: #1d4ed8; }
.ecourier-webchat-form.is-sending .ecourier-webchat-send { opacity: 0.7; pointer-events: none; }

.ecourier-webchat-connect {
  display: inline-block;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1d4ed8;
  text-decoration: none;
  padding: 0.45rem 0.25rem;
  touch-action: manipulation;
}
.ecourier-webchat-connect:hover { text-decoration: underline; }
.ecourier-webchat-connect[hidden] { display: none !important; }
.ecourier-webchat-inline-connect {
  display: inline-block;
  margin-top: 0.35rem;
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
}
.ecourier-webchat-inline-connect:hover { text-decoration: underline; }

/* Phone / small tablet: compact floating card (not full-page) */
@media (max-width: 640px) {
  .ecourier-whatsapp-fab {
    width: 3.5rem;
    height: 3.5rem;
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    right: max(1rem, env(safe-area-inset-right, 0px));
  }

  .ecourier-webchat-panel {
    top: auto;
    left: auto;
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    bottom: calc(max(1rem, env(safe-area-inset-bottom, 0px)) + 3.5rem + 0.55rem);
    width: min(340px, calc(100vw - 1.25rem));
    height: min(420px, calc(100dvh - 8.5rem), calc(100vh - 8.5rem));
    max-height: min(420px, calc(100dvh - 8.5rem), calc(100vh - 8.5rem));
    border-radius: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow:
      0 18px 50px rgba(15, 23, 42, 0.22),
      0 4px 14px rgba(15, 23, 42, 0.12);
  }

  .ecourier-webchat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  flex-shrink: 0;
}

.ecourier-webchat-header {
    padding: 0.75rem 0.85rem;
  }

  .ecourier-webchat-messages {
    padding: 0.75rem 0.85rem;
  }

  .ecourier-webchat-bubble {
    max-width: 90%;
    font-size: 0.9375rem;
  }

  .ecourier-webchat-form {
    padding: 0.7rem 0.85rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    gap: 0.5rem;
  }

  .ecourier-webchat-send {
    min-width: 4.5rem;
  }
}

/* Very short viewports (landscape phones / keyboard open) */
@media (max-width: 640px) and (max-height: 480px) {
  .ecourier-webchat-panel {
    top: auto;
    height: min(280px, calc(100dvh - 6.5rem));
    max-height: min(280px, calc(100dvh - 6.5rem));
    border-radius: 0.85rem;
  }

  .ecourier-webchat-header span {
    display: none;
  }

  .ecourier-webchat-name {
    padding: 0.4rem 0.6rem;
  }
}

/* Keep page behind chat fixed (especially mobile).
   Do NOT set touch-action:none on body — that blocks selecting/copying chat text. */
body.ecourier-webchat-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.ecourier-webchat-panel,
.ecourier-webchat-messages,
.ecourier-webchat-bubble {
  touch-action: manipulation;
}

html.ecourier-webchat-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.ecourier-webchat-open-fixed {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}
