/* ========================================
   号码篮 (Haoma Basket) - 样式文件
   悬浮投注中间层组件
   ======================================== */

/* ========== 悬浮球 ========== */
.haoma-fab {
  position: fixed;
  right: 16px;
  bottom: 90px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #f59e0b;
  background-image: url('/static/img/haoma_cart.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.2s;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.haoma-fab:active { transform: scale(0.9); }
.haoma-fab .basket-icon { display: none; }
.haoma-fab .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #fff;
}

/* 悬浮球弹跳动画 */
@keyframes fabBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.haoma-fab.bounce { animation: fabBounce 0.4s ease; }

/* ========== 展开面板 ========== */
.haoma-panel {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 380px;
  height: 88vh;
  max-height: 780px;
  background: #0f172a;
  border-radius: 16px;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: none;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  touch-action: none;
}
.haoma-panel.open {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
.haoma-panel.dragging { transition: none; transform: none !important; cursor: grabbing; }

/* 遮罩 */
.haoma-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  display: none;
}
.haoma-mask.show { display: block; }

/* 面板头部 */
.haoma-panel .panel-header {
  padding: 8px 16px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.haoma-panel .panel-header .title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}
.haoma-panel .panel-header .title img {
  width: 18px;
  height: 22px;
  border-radius: 50%;
}
.haoma-panel .panel-header .close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1e293b;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  border: none;
}
.haoma-panel .panel-header .clear-btn-header {
  font-size: 12px;
  color: #10b981;
  cursor: pointer;
  padding: 2px 8px;
  border: 1px solid #10b981;
  border-radius: 10px;
  transition: all 0.2s;
}
.haoma-panel .panel-header .clear-btn-header:hover {
  background: #10b981;
  color: #fff;
}
.haoma-panel .panel-header .clear-btn-header.disabled {
  color: #6b7280;
  border-color: #6b7280;
  cursor: not-allowed;
  opacity: 0.5;
}
.haoma-panel .panel-header .clear-btn-header.disabled:hover {
  background: transparent;
  color: #6b7280;
}

/* 面板内容区 */
.haoma-panel .panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
/* 底部渐隐提示可滚动 */
.haoma-panel .panel-body::after {
  content: '';
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  display: block;
  background: linear-gradient(transparent, rgba(15,23,42,0.9));
  pointer-events: none;
  margin-top: -20px;
}

/* 空状态 */
.haoma-panel .empty-basket {
  text-align: center;
  padding: 60px 20px;
  color: #475569;
}
.haoma-panel .empty-basket .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.haoma-panel .empty-basket .text {
  font-size: 13px;
  line-height: 1.6;
}

/* ========== 场次卡片 ========== */
.haoma-panel .basket-match {
  background: #0f172a;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 4px;
  border-left: 3px solid #f59e0b;
  border: 1px solid #1e293b;
  border-left: 3px solid #f59e0b;
}
.haoma-panel .basket-match .match-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.haoma-panel .basket-match .match-info {
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.haoma-panel .basket-match .match-info .play-tag {
  font-size: 10px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 500;
}
.haoma-panel .basket-match .match-info .source-tag {
  font-size: 10px;
  color: #64748b;
}
.haoma-panel .basket-match .del-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
  border: none;
}
.haoma-panel .basket-match .options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.haoma-panel .basket-match .opt-box {
  position: relative;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 3px 10px 3px 8px;
  font-size: 11px;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.haoma-panel .basket-match .opt-box .odds {
  color: #10b981;
  font-weight: 600;
  font-size: 11px;
}
/* 单个选项右上角小红 X：可单独删除复选内容 */
.haoma-panel .basket-match .opt-box .opt-del {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 0;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  z-index: 2;
}
.haoma-panel .basket-match .opt-box .opt-del:hover {
  background: #dc2626;
  transform: scale(1.12);
}

/* ========== 底部操作栏 ========== */
.haoma-panel .panel-footer {
  padding: 10px 12px;
  border-top: 1px solid #1e293b;
  background: #0f172a;
  flex-shrink: 0;
}

/* 串关选择行 */
.haoma-panel .footer-series-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.haoma-panel .series-label {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}
.haoma-panel .series-select {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.haoma-panel .series-tag {
  background: #1e293b;
  color: #94a3b8;
  border-radius: 4px;
  padding: 5px 0;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  width: calc(25% - 3px);
  text-align: center;
}
.haoma-panel .series-tag.active {
  background: #f59e0b;
  color: #1a1a2e;
  font-weight: 700;
}
.haoma-panel .series-tag.pending {
  background: #172033;
  color: #475569;
  cursor: not-allowed;
  opacity: 0.7;
}
.haoma-panel .series-tag.pending.active {
  background: #3a2e12;
  color: #a8842f;
  font-weight: 700;
}

/* 操作行 */
.haoma-panel .footer-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.haoma-panel .footer-left {
  flex: 1 1 100%;
  min-width: 0;
}
.haoma-panel .match-count {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}
.haoma-panel .match-count b { color: #f59e0b; }

/* 倍数控制 */
.haoma-panel .multi-control {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.haoma-panel .multi-control button {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: #1e293b;
  color: #e2e8f0;
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.haoma-panel .multi-input {
  width: 56px;
  height: 26px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
  color: #f59e0b;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  outline: none;
}
.haoma-panel .multi-input:focus {
  border-color: #f59e0b;
}
.haoma-panel .multi-unit {
  font-size: 11px;
  color: #64748b;
}

/* 预计奖金 */
.haoma-panel .prize-info {
  flex-shrink: 0;
  text-align: right;
  margin-left: auto;
}
.haoma-panel .prize-info .label {
  font-size: 10px;
  color: #64748b;
}
.haoma-panel .prize-info .amount {
  font-size: 16px;
  font-weight: 800;
  color: #10b981;
  line-height: 1.1;
  white-space: nowrap;
}

/* 保存按钮 */
.haoma-panel .btn-save {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.haoma-panel .btn-save:active { transform: scale(0.97); }
.haoma-panel .btn-save:disabled {
  background: #374151;
  color: #6b7280;
  cursor: not-allowed;
}

/* 奖金预估+保存合并按钮 */
.haoma-panel .btn-prize-save {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.haoma-panel .btn-prize-save span {
  font-size: 15px;
  font-weight: 800;
}
.haoma-panel .btn-prize-save:active { transform: scale(0.97); }
.haoma-panel .btn-prize-save:disabled {
  background: #374151;
  color: #6b7280;
  cursor: not-allowed;
}

/* ========== 加入按钮（小按钮） ========== */
.add-haoma-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
  margin-left: 6px;
  padding: 0;
}
.add-haoma-btn:active { transform: scale(0.9); }
.add-haoma-btn.added {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}

/* ========== 一键加入按钮（大按钮） ========== */
.btn-add-haoma-large {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-add-haoma-large:active { transform: scale(0.97); }
.btn-add-haoma-large .coin { font-size: 14px; }

/* ========== 金币飞入动画 ========== */
.haoma-coin {
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fde047, #f59e0b, #92400e);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  z-index: 10001;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #92400e;
}
@keyframes coinFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(var(--mid-x), var(--mid-y)) scale(0.8);
  }
  100% {
    opacity: 0;
    transform: translate(var(--end-x), var(--end-y)) scale(0.3);
  }
}
.haoma-coin.flying {
  animation: coinFly 0.6s ease-in forwards;
}

/* ========== Toast 提示 ========== */
.haoma-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10002;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.haoma-toast.show { opacity: 1; }

/* ========== 移动端适配 ========== */
@media (max-width: 480px) {
  .haoma-fab {
    width: 50px;
    height: 50px;
    right: 12px;
    bottom: 80px;
  }
  .haoma-panel {
    width: 88%;
    max-width: 88%;
    height: 88vh;
    max-height: 88vh;
    right: auto;
    left: 6%;
  }
  .haoma-panel .footer-row {
    gap: 6px;
  }
  .haoma-panel .series-tag {
    padding: 3px 5px;
    font-size: 9px;
  }
  .haoma-panel .btn-save {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* ========== 自定义确认弹窗 ========== */
.haoma-confirm-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: haomaFadeIn 0.2s ease;
}
@keyframes haomaFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.haoma-confirm-box {
  background: #1e293b;
  border-radius: 12px;
  padding: 28px 24px 20px;
  width: 280px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: haomaScaleIn 0.2s ease;
}
@keyframes haomaScaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.haoma-confirm-icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.haoma-confirm-msg {
  font-size: 15px;
  color: #e2e8f0;
  margin-bottom: 24px;
  line-height: 1.5;
}
.haoma-confirm-btns {
  display: flex;
  gap: 12px;
}
.haoma-confirm-btns button {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.haoma-confirm-cancel {
  background: #334155;
  color: #94a3b8;
}
.haoma-confirm-cancel:hover {
  background: #475569;
}
.haoma-confirm-ok {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}
.haoma-confirm-ok:hover {
  background: linear-gradient(135deg, #f87171, #ef4444);
}
.haoma-confirm-ok:active,
.haoma-confirm-cancel:active {
  transform: scale(0.97);
}

/* ========== 奖金优化按钮 ========== */
.haoma-panel .btn-optimize {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.haoma-panel .btn-optimize:active { transform: scale(0.97); }
.haoma-panel .btn-optimize.optimized {
  background: linear-gradient(135deg, #10b981, #059669);
}

/* ========== 奖金优化弹窗 ========== */
.haoma-opt-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 16px;
}
.haoma-opt-mask.show {
  display: flex;
  animation: haomaFadeIn 0.2s ease;
}
.haoma-opt-modal {
  background: #1e293b;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: haomaScaleIn 0.2s ease;
}
.opt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #334155;
}
.opt-title {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
}
.opt-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
}
.opt-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}
.opt-amount-row {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
}
.opt-amount-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.opt-amount-item label {
  font-size: 12px;
  color: #94a3b8;
}
.opt-amount-val {
  font-size: 16px;
  font-weight: 700;
  color: #fbbf24;
}
.opt-amount-input {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 9px 12px;
  color: #f1f5f9;
  font-size: 15px;
  font-weight: 700;
  outline: none;
  box-sizing: border-box;
}
.opt-amount-input:focus { border-color: #f59e0b; }
.opt-tip {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.6;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  padding: 8px 10px;
  border-radius: 4px;
  margin-bottom: 14px;
}
.opt-table-wrap {
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
}
.opt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.opt-table thead {
  background: #0f172a;
}
.opt-table th {
  padding: 9px 6px;
  color: #94a3b8;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
.opt-table td {
  padding: 9px 6px;
  color: #e2e8f0;
  text-align: center;
  border-top: 1px solid #283548;
}
.opt-table .c-content {
  text-align: left;
  font-size: 11px;
  line-height: 1.5;
}
.opt-pass {
  display: inline-block;
  background: #334155;
  color: #cbd5e1;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  margin-right: 4px;
}
.opt-table .c-mult {
  color: #fbbf24;
  font-weight: 700;
}
.opt-table .c-prize {
  color: #4ade80;
  font-weight: 600;
}
.opt-summary {
  margin-top: 12px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.7;
}
.opt-summary b {
  color: #e2e8f0;
  font-weight: 700;
}
.opt-footer {
  display: flex;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid #334155;
}
.opt-footer button {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-restore {
  background: #334155;
  color: #cbd5e1;
}
.btn-restore:active { transform: scale(0.97); }
.btn-confirm-opt {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}
.btn-confirm-opt:active { transform: scale(0.97); }
