/* src/static/css/mobile.css */
/* ===== 移动端适配 ===== */

/* 底部导航 - 可滑动 */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 4px 0 env(safe-area-inset-bottom, 4px) 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* 隐藏滚动条 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.bottom-nav::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.bottom-nav .nav-items {
  display: flex;
  gap: 2px;
  padding: 0 8px;
  min-width: max-content;
  /* 确保内容撑开宽度，触发滚动 */
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  color: var(--text-secondary);
  font-size: 0.55em;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: transparent;
  flex: 0 0 auto;
  min-width: 56px;
  position: relative;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav .nav-item .icon {
  font-size: 1.5em;
  line-height: 1.3;
}

.bottom-nav .nav-item .label {
  font-size: 0.6em;
  margin-top: 1px;
  white-space: nowrap;
}

.bottom-nav .nav-item.active {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

.bottom-nav .nav-item:active {
  transform: scale(0.92);
}

.bottom-nav .nav-item .badge-dot {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
}

/* 滑动提示（左右边缘渐变） */
.bottom-nav::before,
.bottom-nav::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 5;
}

.bottom-nav::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-sidebar), transparent);
}

.bottom-nav::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-sidebar), transparent);
}

/* ===== 桌面端隐藏 ===== */
@media (min-width: 769px) {
  .bottom-nav {
    display: none !important;
  }
  .bottom-nav::before,
  .bottom-nav::after {
    display: none !important;
  }
}

/* ===== 移动端显示 ===== */
@media (max-width: 768px) {
  .bottom-nav {
    display: block;
  }
  .bottom-nav::before,
  .bottom-nav::after {
    display: block;
  }
  
  /* 侧边栏 */
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 200;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    backdrop-filter: blur(2px);
  }
  
  .sidebar-overlay.active {
    display: block;
  }
  
  .main-content {
    padding-bottom: 70px;
  }
  
  .topbar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 4px;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  
  .topbar .hamburger {
    display: block !important;
  }
  
  .topbar .user-info {
    font-size: 0.75em;
    gap: 6px;
  }
  
  #pageContent {
    padding: 12px 12px 20px 12px;
  }
  
  #pageContent h2 {
    font-size: 1.15em;
    margin-bottom: 8px;
  }
  
  #pageContent h3 {
    font-size: 0.95em;
  }
  
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 8px 0;
  }
  
  .stat-card {
    padding: 10px 8px;
  }
  
  .stat-card .val {
    font-size: 1.2em;
  }
  
  .stat-card .lbl {
    font-size: 0.65em;
  }
  
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 0;
  }
  
  .filter-bar > * {
    width: 100%;
  }
  
  .filter-bar label {
    flex-wrap: wrap;
  }
  
  .filter-bar label input,
  .filter-bar label select {
    flex: 1;
  }
  
  .filter-bar .btn {
    width: 100%;
    justify-content: center;
  }
  
  .table-wrap {
    overflow-x: auto;
    margin: 6px 0;
  }
  
  table {
    font-size: 0.7rem;
    min-width: 700px;
  }
  
  th, td {
    padding: 5px 6px;
    white-space: nowrap;
  }
  
  .order-card-grid,
  .customer-card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .order-card,
  .customer-card {
    padding: 12px;
  }
  
  .order-card .card-body,
  .customer-card .card-body {
    grid-template-columns: 1fr 1fr;
    font-size: 0.75em;
    gap: 2px 12px;
  }
  
  .order-card .card-footer,
  .customer-card .card-footer {
    gap: 4px;
    flex-wrap: wrap;
  }
  
  .order-card .card-footer .btn,
  .customer-card .card-footer .btn {
    font-size: 0.6em;
    padding: 3px 8px;
  }
  
  .btn {
    padding: 6px 12px;
    font-size: 0.8em;
  }
  
  .btn-sm {
    padding: 4px 10px;
    font-size: 0.7em;
  }
  
  .btn-xs {
    padding: 2px 6px;
    font-size: 0.6em;
  }
  
  .batch-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  
  .batch-actions .btn {
    width: 100%;
    justify-content: center;
  }
  
  .modal-overlay {
    padding: 8px;
    align-items: flex-end;
  }
  
  .modal-box {
    padding: 16px;
    margin: 0;
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
    max-width: 100%;
    animation: slideUp 0.3s ease;
  }
  
  @keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  
  .modal-title {
    font-size: 1em;
  }
  
  .modal-footer {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .modal-footer .btn {
    flex: 1;
    justify-content: center;
    min-height: 40px;
  }
  
  .field-group {
    margin-bottom: 8px;
  }
  
  .field-group input,
  .field-group select,
  .field-group textarea {
    padding: 8px 10px;
    font-size: 0.85em;
  }
  
  .toast {
    bottom: 80px;
    padding: 8px 16px;
    font-size: 0.8em;
    max-width: 90%;
  }
  
  .system-qr-area {
    padding: 8px 12px;
    gap: 10px;
  }
  
  .system-qr-area .qr-wrapper {
    width: 60px;
    height: 60px;
  }
  
  .system-qr-area .qr-wrapper canvas {
    width: 52px !important;
    height: 52px !important;
  }
  
  .system-qr-area .qr-info .title {
    font-size: 0.8em;
  }
  
  #trendChart {
    height: 80px;
    gap: 2px;
  }
  
  #trendChart > div {
    gap: 1px;
  }
  
  #trendChart span[style*="font-size:0.45em"] {
    font-size: 0.4em !important;
  }
  
  .report-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .config-modal-grid {
    grid-template-columns: 1fr;
    max-height: 200px;
  }
}

/* ===== 极小屏 ===== */
@media (max-width: 480px) {
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  
  .stat-card {
    padding: 8px 6px;
  }
  
  .stat-card .val {
    font-size: 1em;
  }
  
  #pageContent {
    padding: 8px 8px 16px 8px;
  }
  
  .topbar {
    padding: 6px 8px;
  }
  
  .topbar .user-info {
    font-size: 0.65em;
    gap: 4px;
  }
  
  .topbar .hamburger {
    font-size: 1.2em;
  }
  
  .order-card .card-body,
  .customer-card .card-body {
    grid-template-columns: 1fr 1fr;
    font-size: 0.7em;
    gap: 1px 8px;
  }
  
  .bottom-nav .nav-item {
    min-width: 48px;
    padding: 4px 8px;
  }
  
  .bottom-nav .nav-item .icon {
    font-size: 1.2em;
  }
  
  .bottom-nav .nav-item .label {
    font-size: 0.5em;
  }
  
  .modal-box {
    padding: 12px;
  }
  
  .modal-footer .btn {
    min-height: 36px;
    font-size: 0.75em;
  }
}

/* ===== 横屏 ===== */
@media (max-width: 768px) and (orientation: landscape) {
  .stat-cards {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .sidebar {
    width: 240px;
  }
  
  .bottom-nav .nav-item {
    min-width: 44px;
    padding: 2px 6px;
  }
  
  .bottom-nav .nav-item .icon {
    font-size: 1.1em;
  }
}