/* ========================================
   移动端响应式适配样式
   适配范围: 320px - 480px 宽度
   支持主流移动浏览器: Chrome, Safari, Firefox, Edge
   ======================================== */

/* CSS 变量 - 移动端优化 */
:root {
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
  --mobile-font-size-base: 16px;
  --mobile-line-height: 1.6;
  --mobile-touch-target-size: 44px;
  --mobile-spacing-sm: 8px;
  --mobile-spacing-md: 16px;
  --mobile-spacing-lg: 24px;
}

/* 基础移动端重置 */
@media screen and (max-width: 768px) {
  html {
    font-size: var(--mobile-font-size-base);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    font-size: var(--mobile-font-size-base);
    line-height: var(--mobile-line-height);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-top: var(--safe-area-inset-top);
    padding-bottom: calc(var(--safe-area-inset-bottom) + 70px);
  }

  /* 防止 iOS Safari 中表单元素缩放 */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* 触摸目标优化 */
  button, 
  .btn,
  a,
  input[type="checkbox"],
  input[type="radio"],
  select {
    min-height: var(--mobile-touch-target-size);
    min-width: var(--mobile-touch-target-size);
  }

  /* 滚动容器优化 */
  .container, 
  .card-body,
  .modal-body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

/* 超小屏幕适配 (320px - 360px) */
@media screen and (max-width: 360px) {
  html {
    font-size: 14px;
  }

  .header {
    padding: 16px 12px;
  }

  .header h1 {
    font-size: 16px;
  }

  .container {
    padding: 12px;
  }

  .card {
    margin-bottom: 12px;
    border-radius: 10px;
  }

  .card-header {
    padding: 12px;
    font-size: 14px;
  }

  .card-body {
    padding: 12px;
  }

  .btn {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 6px;
  }

  .price-value {
    font-size: 28px;
  }

  .price-item .value {
    font-size: 16px;
  }

  .nav-item {
    font-size: 10px;
    padding: 8px 0;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .menu-item {
    padding: 12px;
  }

  .menu-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .menu-text h3 {
    font-size: 14px;
  }

  .menu-text p {
    font-size: 11px;
  }

  .order-amount {
    font-size: 18px;
  }

  .form-group label {
    font-size: 12px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 12px;
    font-size: 14px;
  }

  .badge {
    padding: 2px 6px;
    font-size: 10px;
  }

  .alert-box {
    width: 90%;
    max-width: 280px;
  }

  .alert-title {
    font-size: 16px;
  }

  .alert-message {
    font-size: 13px;
  }

  .invite-card {
    padding: 16px;
  }

  .invite-link {
    flex-direction: column;
    gap: 8px;
  }

  .invite-link input {
    width: 100%;
    text-align: center;
  }

  .invite-link button {
    width: 100%;
  }
}

/* 小屏幕适配 (361px - 480px) */
@media screen and (min-width: 361px) and (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .header {
    padding: 18px 14px;
  }

  .header h1 {
    font-size: 18px;
  }

  .container {
    padding: 14px;
  }

  .price-value {
    font-size: 32px;
  }
}

/* 横屏模式适配 */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .header {
    padding: 12px 16px;
  }

  .header h1 {
    font-size: 16px;
  }

  .nav-bar {
    padding-bottom: var(--safe-area-inset-bottom);
  }

  .nav-item {
    padding: 6px 0;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .modal-box {
    max-height: 80vh;
  }

  .price-card {
    margin: -12px 12px 12px;
    padding: 16px;
  }

  .price-main {
    padding: 8px 0;
  }

  .price-row {
    padding: 8px 0;
  }

  .avatar {
    width: 48px;
    height: 48px;
    font-size: 24px;
    margin-bottom: 8px;
  }

  .user-name {
    font-size: 16px;
  }

  .user-phone {
    font-size: 12px;
  }
}

/* 高分辨率屏幕适配 */
@media screen and (-webkit-min-device-pixel-ratio: 2), 
       screen and (min-resolution: 192dpi) {
  .card,
  .menu-card,
  .order-card,
  .price-card {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  }

  .btn {
    border: none;
  }
}

/* iOS Safari 特殊处理 */
@supports (-webkit-touch-callout: none) {
  body {
    min-height: -webkit-fill-available;
  }

  .nav-bar {
    padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
  }

  input, select, textarea {
    -webkit-appearance: none;
    appearance: none;
  }

  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
  }

  input[type="date"],
  input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
  }
}

/* Android 特殊处理 */
@supports not (-webkit-touch-callout: none) {
  .nav-bar {
    padding-bottom: max(env(safe-area-inset-bottom), 8px);
  }
}

/* 表单元素移动端优化 */
@media screen and (max-width: 768px) {
  .form-group {
    margin-bottom: var(--mobile-spacing-md);
  }

  .form-group label {
    display: block;
    margin-bottom: var(--mobile-spacing-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
  }

  .form-group input[type="text"],
  .form-group input[type="number"],
  .form-group input[type="password"],
  .form-group input[type="tel"],
  .form-group input[type="email"],
  .form-group input[type="date"],
  .form-group input[type="time"],
  .form-group select,
  .form-group textarea {
    width: 100%;
    padding: 14px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
  }

  .form-group input:focus,
  .form-group select:focus,
  .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
  }

  .form-group input[type="checkbox"],
  .form-group input[type="radio"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    margin-right: 8px;
    vertical-align: middle;
    cursor: pointer;
    accent-color: var(--primary);
  }

  .form-group textarea {
    min-height: 100px;
    resize: vertical;
  }

  .form-row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
  }

  .form-row > .form-group {
    width: 100%;
  }
}

/* 按钮移动端优化 */
@media screen and (max-width: 768px) {
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
    min-height: var(--mobile-touch-target-size);
  }

  .btn:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  .btn-block {
    display: flex;
    width: 100%;
  }

  .btn-primary {
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    color: #fff;
  }

  .btn-primary:active {
    background: linear-gradient(135deg, #0d47a1, #1a73e8);
  }

  .btn-success {
    background: var(--success);
    color: #fff;
  }

  .btn-warning {
    background: var(--warning);
    color: #333;
  }

  .btn-danger {
    background: var(--danger);
    color: #fff;
  }

  .btn-secondary {
    background: var(--secondary);
    color: #fff;
  }

  .btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
  }

  .btn-sm {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 32px;
  }

  .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
  }

  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .btn-group .btn {
    width: 100%;
  }
}

/* 卡片移动端优化 */
@media screen and (max-width: 768px) {
  .card {
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: var(--mobile-spacing-md);
    overflow: hidden;
  }

  .card-header {
    padding: var(--mobile-spacing-md);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-body {
    padding: var(--mobile-spacing-md);
  }

  .menu-card {
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 12px;
  }

  .menu-item {
    display: flex;
    align-items: center;
    padding: var(--mobile-spacing-md);
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    touch-action: manipulation;
    min-height: var(--mobile-touch-target-size);
  }

  .menu-item:last-child {
    border-bottom: none;
  }

  .menu-item:active {
    background: var(--bg);
  }

  .menu-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
  }

  .menu-text {
    flex: 1;
    min-width: 0;
  }

  .menu-text h3 {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .menu-text p {
    font-size: 12px;
    color: var(--text2);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .menu-arrow {
    color: var(--text2);
    font-size: 14px;
    margin-left: 8px;
  }
}

/* 导航栏移动端优化 */
@media screen and (max-width: 768px) {
  .nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    display: flex;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    z-index: 100;
    padding-bottom: max(env(safe-area-inset-bottom), 8px);
    padding-top: 8px;
  }

  .nav-item {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    text-decoration: none;
    color: var(--text2);
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: var(--mobile-touch-target-size);
    -webkit-tap-highlight-color: transparent;
  }

  .nav-item.active {
    color: var(--primary);
  }

  .nav-item svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
  }

  .nav-item span {
    font-size: 10px;
  }
}

/* 价格卡片移动端优化 */
@media screen and (max-width: 768px) {
  .price-card {
    background: var(--card);
    margin: -16px var(--mobile-spacing-md) var(--mobile-spacing-md);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: var(--mobile-spacing-lg);
    position: relative;
    z-index: 1;
  }

  .price-main {
    text-align: center;
    padding: 12px 0;
  }

  .price-label {
    font-size: 14px;
    color: var(--text2);
    margin-bottom: 8px;
  }

  .price-value {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -1px;
  }

  .price-value span {
    font-size: 16px;
    font-weight: 400;
  }

  .price-unit {
    font-size: 13px;
    color: var(--text2);
    margin-top: 4px;
  }

  .price-row {
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    border-top: 1px solid var(--border);
  }

  .price-item {
    text-align: center;
    flex: 1;
    min-width: 0;
  }

  .price-item .label {
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 4px;
  }

  .price-item .value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
  }

  .price-time {
    font-size: 11px;
    color: var(--text2);
    text-align: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
}

/* 订单卡片移动端优化 */
@media screen and (max-width: 768px) {
  .order-card {
    background: var(--card);
    border-radius: 12px;
    padding: var(--mobile-spacing-md);
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }

  .order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .order-no {
    font-size: 13px;
    color: var(--text2);
    word-break: break-all;
  }

  .order-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .order-amount {
    font-size: 20px;
    font-weight: 600;
  }

  .order-amount small {
    font-size: 12px;
    font-weight: 400;
    color: var(--text2);
  }

  .order-info {
    font-size: 12px;
    color: var(--text2);
    margin-top: 8px;
  }

  .order-info div {
    margin-bottom: 4px;
    word-break: break-all;
  }

  .order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
  }

  .order-time {
    font-size: 11px;
    color: var(--text2);
  }

  .order-detail {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
  }
}

/* 弹窗移动端优化 */
@media screen and (max-width: 768px) {
  .alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--mobile-spacing-md);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
  }

  .alert-overlay.show {
    opacity: 1;
    visibility: visible;
  }

  .alert-box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 320px;
    text-align: center;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.2s;
  }

  .alert-overlay.show .alert-box {
    transform: scale(1);
  }

  .alert-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 24px auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
  }

  .alert-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    padding: 0 20px;
  }

  .alert-message {
    font-size: 14px;
    color: #666;
    padding: 0 20px 20px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .alert-btn {
    width: 100%;
    padding: 16px;
    border: none;
    background: #1a73e8;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    min-height: var(--mobile-touch-target-size);
  }

  .alert-btn:active {
    background: #0d47a1;
  }

  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 999;
    padding: 0;
  }

  .modal-overlay.show {
    display: flex;
  }

  .modal-box {
    background: var(--card);
    border-radius: 16px 16px 0 0;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    -webkit-overflow-scrolling: touch;
  }

  .modal-header {
    padding: 0 0 16px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .modal-header h3 {
    font-size: 18px;
    font-weight: 600;
  }

  .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text2);
    padding: 8px;
    min-width: var(--mobile-touch-target-size);
    min-height: var(--mobile-touch-target-size);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .modal-body {
    padding: 16px 0 0 0;
  }
}

/* 表格移动端优化 */
@media screen and (max-width: 768px) {
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--mobile-spacing-md) * -1);
    padding: 0 var(--mobile-spacing-md);
  }

  .table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
  }

  .table th,
  .table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    white-space: nowrap;
  }

  .table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text2);
    position: sticky;
    top: 0;
  }

  .table tr:active {
    background: var(--bg);
  }

  .table-responsive {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive .table {
    margin-bottom: 0;
  }
}

/* 标签徽章移动端优化 */
@media screen and (max-width: 768px) {
  .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
  }

  .badge-success {
    background: #e8f5e9;
    color: #2e7d32;
  }

  .badge-warning {
    background: #fff3e0;
    color: #e65100;
  }

  .badge-danger {
    background: #ffebee;
    color: #c62828;
  }

  .badge-info {
    background: #e3f2fd;
    color: #1565c0;
  }

  .badge-primary {
    background: #e8eaf6;
    color: #3949ab;
  }

  .badge-secondary {
    background: #f5f5f5;
    color: #616161;
  }
}

/* 搜索栏和筛选器移动端优化 */
@media screen and (max-width: 768px) {
  .search-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
  }

  .search-bar input,
  .search-bar select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
  }

  .search-bar button {
    width: 100%;
  }

  .filter-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
  }

  .filter-bar select,
  .filter-bar input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
  }

  .filter-bar button {
    width: 100%;
  }
}

/* 统计卡片移动端优化 */
@media screen and (max-width: 768px) {
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }

  .stat-card {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }

  .stat-card .label {
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 8px;
  }

  .stat-card .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
  }

  .stat-card .trend {
    font-size: 11px;
    color: var(--success);
    margin-top: 4px;
  }

  .stats-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .stat-item {
    background: var(--card);
    border-radius: 12px;
    padding: 12px 16px;
    min-width: 100px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
  }

  .stat-item .label {
    font-size: 11px;
    color: var(--text2);
    margin-bottom: 4px;
  }

  .stat-item .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
  }
}

/* Toast 提示移动端优化 */
@media screen and (max-width: 768px) {
  .toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 80%;
    text-align: center;
    word-break: break-word;
  }

  .toast.show {
    opacity: 1;
  }
}

/* 头部移动端优化 */
@media screen and (max-width: 768px) {
  .header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    padding: 20px var(--mobile-spacing-md);
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 50;
    padding-top: calc(var(--safe-area-inset-top) + 20px);
  }

  .header h1 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
  }

  .header p {
    font-size: 12px;
    opacity: 0.8;
  }

  .header .avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
  }

  .header .user-name {
    font-size: 16px;
    font-weight: 600;
  }

  .header .user-phone {
    font-size: 13px;
    opacity: 0.7;
    margin-top: 4px;
  }
}

/* 登录页面移动端优化 */
@media screen and (max-width: 768px) {
  .login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    padding: var(--mobile-spacing-md);
    padding-top: calc(var(--safe-area-inset-top) + var(--mobile-spacing-md));
    padding-bottom: calc(var(--safe-area-inset-bottom) + var(--mobile-spacing-md));
  }

  .login-card {
    background: var(--card);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  }

  .login-card h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 22px;
  }

  .login-card .btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 8px;
  }
}

/* 管理后台侧边栏移动端优化 */
@media screen and (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: #1a1a2e;
    color: #fff;
    padding: 20px 0;
    overflow-y: auto;
    z-index: 1000;
    transition: left 0.3s ease;
    padding-top: calc(var(--safe-area-inset-top) + 20px);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .main {
    margin-left: 0;
    padding: var(--mobile-spacing-md);
    min-height: 100vh;
    padding-top: calc(var(--safe-area-inset-top) + 60px + var(--mobile-spacing-md));
  }

  .mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--card);
    padding: 12px var(--mobile-spacing-md);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 100;
    padding-top: calc(var(--safe-area-inset-top) + 12px);
  }

  .mobile-header .menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    min-width: var(--mobile-touch-target-size);
    min-height: var(--mobile-touch-target-size);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-header h1 {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
  }

  .nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .nav-item {
    margin-bottom: 4px;
  }

  .nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s;
    min-height: var(--mobile-touch-target-size);
    -webkit-tap-highlight-color: transparent;
  }

  .nav-item a:hover,
  .nav-item a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  .nav-item a.active {
    border-left: 3px solid var(--primary);
  }
}

/* KYC 状态移动端优化 */
@media screen and (max-width: 768px) {
  .kyc-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    margin-left: 6px;
  }

  .kyc-none {
    background: #e0e0e0;
    color: #616161;
  }

  .kyc-pending {
    background: #fff3e0;
    color: #e65100;
  }

  .kyc-approved {
    background: #e8f5e9;
    color: #2e7d32;
  }

  .kyc-rejected {
    background: #ffebee;
    color: #c62828;
  }

  .status-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
  }

  .status-icon.none {
    background: #e3f2fd;
  }

  .status-icon.pending {
    background: #fff3e0;
  }

  .status-icon.approved {
    background: #e8f5e9;
  }

  .status-icon.rejected {
    background: #ffebee;
  }

  .status-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
  }

  .status-desc {
    font-size: 13px;
    color: var(--text2);
  }
}

/* 邀请卡片移动端优化 */
@media screen and (max-width: 768px) {
  .invite-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    padding: var(--mobile-spacing-md);
    color: #fff;
    margin-bottom: 12px;
  }

  .invite-card h3 {
    font-size: 14px;
    margin-bottom: 8px;
    opacity: 0.9;
  }

  .invite-link {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }

  .invite-link input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    outline: none;
    text-overflow: ellipsis;
  }

  .invite-link button {
    background: #fff;
    color: #764ba2;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    min-height: 36px;
  }

  .invite-tip {
    font-size: 11px;
    opacity: 0.8;
  }
}

/* 佣金卡片移动端优化 */
@media screen and (max-width: 768px) {
  .commission-card {
    padding: var(--mobile-spacing-md);
  }

  .commission-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
    padding: 12px 0;
    flex-wrap: wrap;
    gap: 12px;
  }

  .commission-stat {
    flex: 1;
    min-width: 80px;
  }

  .commission-stat .value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
  }

  .commission-stat .label {
    font-size: 11px;
    color: var(--text2);
    margin-top: 4px;
  }
}

/* 快捷操作按钮移动端优化 */
@media screen and (max-width: 768px) {
  .quick-weights {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
  }

  .quick-weight {
    flex: 1;
    min-width: 60px;
    padding: 10px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    min-height: var(--mobile-touch-target-size);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .quick-weight:active,
  .quick-weight.active {
    border-color: var(--primary);
    color: var(--primary);
    background: #e3f2fd;
  }

  .weight-input {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .weight-input input {
    flex: 1;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 18px;
    text-align: center;
    min-height: var(--mobile-touch-target-size);
  }

  .weight-btn {
    width: var(--mobile-touch-target-size);
    height: var(--mobile-touch-target-size);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
  }

  .weight-btn:active {
    background: var(--bg);
  }
}

/* 底部提交栏移动端优化 */
@media screen and (max-width: 768px) {
  .submit-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    padding: 12px var(--mobile-spacing-md);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 100;
    padding-bottom: calc(var(--safe-area-inset-bottom) + 12px);
  }

  .submit-bar .total {
    flex: 1;
  }

  .submit-bar .total .label {
    font-size: 11px;
    color: var(--text2);
  }

  .submit-bar .total .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--danger);
  }

  .submit-bar button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    min-height: var(--mobile-touch-target-size);
    white-space: nowrap;
  }

  .submit-bar button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
}

/* 日志页面移动端优化 */
@media screen and (max-width: 768px) {
  .log-container {
    font-size: 11px;
    padding: 8px;
  }

  .log-line {
    padding: 6px 8px;
    font-size: 11px;
    word-break: break-all;
  }

  .timestamp {
    display: block;
    margin-bottom: 2px;
  }

  .level {
    display: inline-block;
    width: auto;
    margin-right: 6px;
  }

  .data {
    display: block;
    margin-left: 0;
    margin-top: 4px;
    font-size: 10px;
    overflow-x: auto;
  }
}

/* 打印样式优化 */
@media print {
  body {
    padding: 0;
    background: #fff;
  }

  .nav-bar,
  .header,
  .submit-bar,
  .btn,
  button {
    display: none !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* 暗色模式支持 (可选) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --card: #1e1e1e;
    --text: #e0e0e0;
    --text2: #a0a0a0;
    --border: #333;
  }
}

/* 减少动画 (用户偏好) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* 文本截断 */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 多行文本截断 */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 安全区域内边距 */
.safe-area-padding {
  padding-top: var(--safe-area-inset-top);
  padding-bottom: var(--safe-area-inset-bottom);
  padding-left: var(--safe-area-inset-left);
  padding-right: var(--safe-area-inset-right);
}

/* 触摸反馈 */
.touch-feedback {
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s;
}

.touch-feedback:active {
  background-color: rgba(0, 0, 0, 0.05);
}

/* 滚动条样式 (Webkit) */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}
