/* ==========================================================================
   AeroTrade B2B Studio (星海智造) - Common Conversion & UI CSS
   100% Original Architecture · Zero Legacy Dependencies
   ========================================================================== */

:root {
  --tm-primary: #eab308;
  --tm-primary-hover: #ca8a04;
  --tm-primary-contrast: #111827;
  --tm-dark: #111827;
  --tm-surface: #ffffff;
  --tm-surface-alt: #f8fafc;
  --tm-text: #1e293b;
  --tm-text-muted: #64748b;
  --tm-border: #e2e8f0;
  --tm-radius: 8px;
  --tm-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --tm-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--tm-text);
  background-color: var(--tm-surface);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--tm-transition), background-color var(--tm-transition), border-color var(--tm-transition);
}

/* Top Prototype Bar (Allows seamless switching between Showcase Hub and Live Templates) */
.tm-proto-bar {
  background: #0f172a;
  color: #f8fafc;
  font-size: 13px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
  z-index: 1050;
}

.tm-proto-bar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tm-proto-badge {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.tm-proto-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tm-proto-link {
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tm-proto-link:hover,
.tm-proto-link.is-active {
  background: #fff;
  color: #0f172a;
}

.tm-proto-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Native Dialog Styling (Modern Web Guidance Compliant) */
dialog.tm-dialog {
  border: 1px solid var(--tm-border);
  border-radius: 12px;
  padding: 0;
  max-width: 860px;
  width: calc(100% - 32px);
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

dialog.tm-dialog::backdrop {
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
}

.tm-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.tm-dialog__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.tm-dialog__close {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  font-size: 16px;
  transition: all 0.2s;
}

.tm-dialog__close:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.tm-dialog__body {
  padding: 24px;
  max-height: 82vh;
  overflow-y: auto;
}

/* Right Floating Multi-Channel Suspension Bar (Upgraded from tm_sns) */
.tm-suspension {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 990;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tm-suspension__item {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s, background-color 0.2s, color 0.2s, border-color 0.2s;
  padding: 0;
}

.tm-suspension__item:hover {
  transform: translateX(-4px);
  background: var(--tm-primary);
  color: var(--tm-primary-contrast);
  border-color: var(--tm-primary);
}

.tm-suspension__item--whatsapp {
  background: #22c55e;
  color: #ffffff;
  border-color: #16a34a;
}

.tm-suspension__item--whatsapp:hover {
  background: #16a34a;
  color: #ffffff;
  border-color: #15803d;
}

.tm-suspension__tooltip {
  position: absolute;
  right: 54px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: #0f172a;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tm-suspension__item:hover .tm-suspension__tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Bottom-Right Quick Inquiry Floating Widget (Upgraded from feedback.css) */
.tm-quick-inquiry {
  position: fixed;
  right: 20px;
  bottom: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  z-index: 995;
  background: #ffffff;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 25px rgba(15, 23, 42, 0.18);
  border: 1px solid #cbd5e1;
  border-bottom: none;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tm-quick-inquiry.is-collapsed .tm-quick-inquiry__body {
  display: none;
}

.tm-quick-inquiry__header {
  background: var(--tm-primary);
  color: var(--tm-primary-contrast);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  user-select: none;
}

.tm-quick-inquiry__header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tm-quick-inquiry__toggle-btn {
  background: rgba(0, 0, 0, 0.12);
  border: none;
  color: inherit;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}

.tm-quick-inquiry__body {
  padding: 16px;
  background: #ffffff;
}

.tm-form-group {
  margin-bottom: 12px;
}

.tm-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}

.tm-form-input,
.tm-form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color 0.2s, background-color 0.2s;
}

.tm-form-input:focus,
.tm-form-textarea:focus {
  outline: none;
  border-color: var(--tm-primary);
  background: #ffffff;
}

.tm-form-submit {
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: var(--tm-primary);
  color: var(--tm-primary-contrast);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: filter 0.2s, transform 0.1s;
}

.tm-form-submit:hover {
  filter: brightness(0.95);
}

/* Toast Notification */
.tm-toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tm-toast {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid #22c55e;
  animation: tmSlideIn 0.25s ease-out;
}

@keyframes tmSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Exclusive Accordion Details (Modern Web Guidance Section 5) */
details.tm-faq-item {
  border: 1px solid var(--tm-border);
  border-radius: 8px;
  background: #ffffff;
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

details.tm-faq-item[open] {
  border-color: var(--tm-primary);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

details.tm-faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #0f172a;
}

details.tm-faq-item summary::-webkit-details-marker {
  display: none;
}

details.tm-faq-item summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 700;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, background-color 0.2s, color 0.2s;
}

details.tm-faq-item[open] summary::after {
  content: "−";
  background: var(--tm-primary);
  color: var(--tm-primary-contrast);
}

.tm-faq-content,
.tm-faq-item__body {
  padding: 0 20px 16px 20px;
  color: #475569;
  font-size: 14px;
  line-height: 1.65;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

/* Modern Web Guidance: :user-invalid and :user-valid form feedback */
.tm-error-msg {
  display: none;
  color: #dc2626;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.tm-form-input:user-invalid,
.tm-form-textarea:user-invalid,
.tm-form-input.user-invalid-fallback,
.tm-form-textarea.user-invalid-fallback {
  border-color: #dc2626;
  background-color: #fef2f2;
}

.tm-form-input:user-invalid + .tm-error-msg,
.tm-form-textarea:user-invalid + .tm-error-msg,
.tm-form-input.user-invalid-fallback + .tm-error-msg,
.tm-form-textarea.user-invalid-fallback + .tm-error-msg {
  display: block;
}

.tm-form-input:required:user-valid,
.tm-form-textarea:required:user-valid {
  border-color: #16a34a;
}

/* Admin & Live Visual Edit Buttons in Top Switcher Bar */
.tm-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff !important;
  border: 1px solid rgba(96, 165, 250, 0.45);
  cursor: pointer;
  transition: all 0.15s;
}

.tm-admin-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.tm-admin-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.3;
}

.tm-live-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  cursor: pointer;
  transition: all 0.15s;
}

.tm-live-edit-btn.is-active {
  background: #10b981;
  color: #052e16;
  border-color: #34d399;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.5);
}

/* On-Page Visual Live Edit Mode Overlay */
body.tm-live-edit-active [data-cms-slot] {
  position: relative;
  outline: 2px dashed #10b981 !important;
  outline-offset: 3px;
  cursor: pointer !important;
  transition: outline-color 0.2s, box-shadow 0.2s;
}

body.tm-live-edit-active [data-cms-slot]:hover {
  outline: 3px solid #f59e0b !important;
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.22) !important;
}

body.tm-live-edit-active [data-cms-slot]::after {
  content: "📷 点击换图 / 改价 / 改参数";
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 40;
  background: #10b981;
  color: #052e16;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

body.tm-live-edit-active [data-cms-block] {
  position: relative;
  outline: 2px dashed #38bdf8 !important;
  outline-offset: 3px;
  cursor: pointer !important;
  transition: outline-color 0.2s, box-shadow 0.2s;
}

body.tm-live-edit-active [data-cms-block]:hover {
  outline: 3px solid #f59e0b !important;
  box-shadow: 0 10px 28px rgba(56, 189, 248, 0.24) !important;
}

body.tm-live-edit-active [data-cms-block]::after {
  content: attr(data-cms-label);
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 40;
  background: #0284c7;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

/* Dropzone inside Visual Image Editor Dialog */
.tm-img-dropzone {
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s;
}

.tm-img-dropzone:hover,
.tm-img-dropzone.is-dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

.tm-img-dropzone__preview {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #e2e8f0;
  display: block;
}

@media (max-width: 768px) {
  .tm-suspension {
    right: 10px;
    bottom: 70px;
    top: auto;
    transform: none;
  }
  .tm-quick-inquiry {
    right: 10px;
    width: 300px;
  }
}
