/* ═══════════════════════════════════════════
   新疆旅游报价系统 — 移动端样式 v2
   仅报价页面 (index.html)，不涉及管理后台
   ≤768px 生效
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
  * { box-sizing: border-box; }

  body {
    background: #f5f0eb;
    -webkit-tap-highlight-color: transparent;
  }

  /* ─── 全局触控友好 ─── */
  button, select, input, textarea, .btn {
    min-height: 44px;
  }
  input[type="number"] { min-height: 36px; }
  input, select, textarea { font-size: 16px !important; }
  input[type="checkbox"], input[type="radio"] {
    min-height: auto;
    width: 20px; height: 20px;
  }

  /* ─── Header ─── */
  .header {
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .header h1 { font-size: 18px; letter-spacing: 1px; }
  .header p { font-size: 11px; margin-top: 2px; }
  .header > div { margin-top: 8px !important; gap: 6px !important; flex-wrap: wrap; }
  .mode-btn { padding: 10px 16px; font-size: 14px; border-radius: 22px; }

  /* ─── 容器 ─── */
  .container { max-width: 100%; padding: 8px; }

  /* ─── 聊天区 ─── */
  .chat-box { border-radius: 10px; margin-bottom: 10px; }
  .chat-messages {
    padding: 10px;
    max-height: calc(100vh - 300px);
    min-height: 160px;
    gap: 8px;
  }
  .message .avatar { width: 32px; height: 32px; font-size: 16px; flex-shrink: 0; }
  .message .bubble {
    max-width: 85%;
    padding: 10px 12px;
    font-size: 15px;
    line-height: 1.65;
  }
  .message.agent .bubble { max-width: 88%; }
  .message .bubble .route-card {
    padding: 12px;
    margin-top: 8px;
  }
  .route-card .route-name { font-size: 15px; }
  .route-card .route-meta { font-size: 12px; }

  /* ─── 快捷参数（横滑） ─── */
  .quick-params {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .quick-params::-webkit-scrollbar { display: none; }
  .param-group {
    flex-shrink: 0;
    font-size: 13px;
    white-space: nowrap;
  }
  .param-group label { font-size: 12px; margin-right: 4px; }
  .param-group select,
  .param-group input {
    padding: 8px 10px;
    font-size: 14px !important;
    border-radius: 6px;
    min-height: 36px;
    border: 1px solid #e0ddd5;
  }
  .param-group input[type="number"] { width: 50px !important; }
  .param-group input[type="checkbox"] { width: 18px; height: 18px; min-height: auto; }

  /* ─── 输入区 ─── */
  .input-area {
    padding: 10px 12px;
    gap: 8px;
  }
  .input-area > div:last-child {
    display: flex !important;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .input-area textarea {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    font-size: 16px !important;
    min-height: 44px;
    max-height: 80px;
    border-radius: 22px;
  }
  .input-area button {
    padding: 10px 12px;
    font-size: 15px !important;
    border-radius: 22px;
    flex-shrink: 0;
    white-space: nowrap;
    min-height: 44px;
    min-width: auto;
    width: auto;
  }

  /* ─── 自由拼团面板 ─── */
  .custom-panel { border-radius: 12px; padding: 14px; margin-bottom: 12px; }
  .custom-header h3 { font-size: 16px; margin-bottom: 10px; }
  .custom-header > div {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: stretch !important;
  }
  .custom-header > div > * {
    width: 100% !important;
    max-width: 100% !important;
  }
  .custom-header select,
  .custom-header input[type="number"],
  .custom-header input[type="text"] {
    width: 100% !important;
    padding: 10px 12px;
    font-size: 16px !important;
    min-height: 44px;
    border-radius: 8px;
    border: 1px solid #e0ddd5;
    box-sizing: border-box;
  }
  .custom-header button {
    width: 100% !important;
    padding: 14px;
    font-size: 16px !important;
    border-radius: 12px;
    min-height: 48px;
  }
  .custom-header label {
    font-size: 14px !important;
    display: block;
    margin-bottom: 2px;
  }

  /* 票价行保持内联 */
  #flightPriceWrap {
    display: flex !important;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
  }
  #flightPriceWrap label { display: inline !important; }
  #flightPriceWrap input { width: 100px !important; flex: 0 0 auto; }

  /* ─── 景点网格 ─── */
  .spot-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 300px;
  }
  .spot-card { padding: 10px; border-radius: 10px; }
  .spot-card .spot-name { font-size: 14px; margin-bottom: 2px; }
  .spot-card .spot-city { font-size: 11px; }
  .spot-card .spot-price { font-size: 12px; }
  .spot-card .spot-check { width: 22px; height: 22px; font-size: 12px; top: 8px; right: 8px; }

  /* ─── 报价结果 ─── */
  .custom-result { padding: 14px; border-radius: 12px; }
  .custom-result .total { font-size: 24px; }
  .custom-result .per { font-size: 14px; }
  .custom-result .btn {
    width: 100% !important;
    text-align: center;
    padding: 14px;
    font-size: 15px !important;
    border-radius: 10px;
    display: block;
    margin-top: 10px;
    min-height: 48px;
    box-sizing: border-box;
  }
  .custom-result a {
    display: block !important;
    width: 100% !important;
    text-align: center;
    padding: 12px !important;
    font-size: 15px !important;
    border-radius: 10px;
    margin: 6px 0 !important;
    min-height: 44px;
    box-sizing: border-box;
  }

  /* ─── 行程日行 ─── */
  .day-row {
    padding: 10px 12px !important;
    font-size: 13px;
    margin-bottom: 8px !important;
    border-radius: 8px;
  }
  .day-row strong { font-size: 14px; display: block; margin-bottom: 4px; }
  .day-row select {
    padding: 6px 8px;
    font-size: 14px !important;
    min-height: 36px;
    border-radius: 5px;
  }
  .day-row input[type="number"] {
    width: 65px !important;
    padding: 6px 8px;
    font-size: 14px !important;
    min-height: 36px;
    border-radius: 5px;
  }
  .day-row .day-meals label {
    font-size: 13px !important;
    display: inline-flex;
    align-items: center;
    gap: 2px;
  }
  .day-row .day-meals input[type="checkbox"] {
    width: 18px; height: 18px;
    min-height: auto;
  }

  /* ─── 筛选按钮 ─── */
  .day-filter-btn {
    padding: 8px 14px !important;
    font-size: 13px !important;
    border-radius: 20px !important;
    min-height: 40px;
  }

  /* ─── 报价汇总 ─── */
  .price-summary { padding: 14px; border-radius: 12px; }
  .price-summary .total { font-size: 22px; }
  .price-summary .per { font-size: 13px; }
  .price-summary .actions { flex-direction: column; gap: 8px; }
  .price-summary .actions .btn {
    width: 100%;
    text-align: center;
    padding: 12px;
    font-size: 14px !important;
    min-height: 44px;
    border-radius: 8px;
  }

  /* ─── 路线卡片 ─── */
  .route-card { padding: 10px; border-radius: 10px; }
  .route-card .route-name { font-size: 15px; }
  .route-card .route-meta { font-size: 12px; }

  /* ─── iframe ─── */
  .message .bubble iframe {
    min-height: 280px !important;
    max-height: 50vh !important;
    border-radius: 6px;
  }

  /* ─── 警告提示 ─── */
  .custom-warnings {
    font-size: 13px !important;
    padding: 10px 14px !important;
  }

  /* ─── 加载动画 ─── */
  .loading span { width: 10px; height: 10px; }
}

/* ═══════════════════════════════════════════
   超小屏优化 (≤400px)
   ═══════════════════════════════════════════ */
@media (max-width: 400px) {
  .container { padding: 4px; }
  .header { padding: 10px 12px; }
  .header h1 { font-size: 16px; }
  .mode-btn { padding: 8px 12px; font-size: 13px; }

  .chat-messages {
    padding: 8px;
    max-height: calc(100vh - 260px);
  }
  .message .avatar { width: 28px; height: 28px; font-size: 14px; }
  .message .bubble { font-size: 14px; padding: 8px 10px; }

  .spot-grid {
    grid-template-columns: 1fr;
    gap: 6px;
    max-height: 240px;
  }
  .spot-card { padding: 8px 10px; }
  .spot-card .spot-name { font-size: 13px; }
  .spot-card .spot-check { width: 20px; height: 20px; font-size: 10px; top: 6px; right: 6px; }

  .custom-panel { padding: 10px; }
  .custom-header h3 { font-size: 15px; }

  .quick-params { padding: 8px 10px; gap: 6px; }
  .input-area { padding: 8px 10px; }

  .custom-result .total { font-size: 22px; }
  .price-summary .total { font-size: 20px; }

  .day-row { padding: 8px 10px !important; font-size: 12px; }
  .day-row strong { font-size: 13px; }
}
