/* ========================================
   移动端响应式设计
   ======================================== */

@media (max-width: 768px) {
  /* 页面布局优化 */
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .row {
    margin: 0;
  }

  /* 左侧导航优化 - 侧边抽屉模式 */
  .col-md-3 {
    width: 100%;
    margin-bottom: 16px;
  }

  .account-nav {
    position: fixed;
    left: -100%;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 1050;
    transition: left 0.3s ease;
    border-radius: 0;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
  }

  .account-nav.show {
    left: 0;
  }

  .account-nav-group-title {
    padding: 10px 16px;
    font-size: 11px;
  }

  .account-nav-item {
    padding: 14px 16px;
    margin: 0 8px;
    border-radius: var(--radius-sm);
  }

  .account-nav-item i {
    font-size: 20px;
    width: 24px;
  }

  .account-nav-text {
    font-size: 15px;
  }

  /* 右侧内容优化 */
  .col-md-9 {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  /* 添加遮罩层 */
  .account-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
  }

  .account-nav-overlay.show {
    display: block;
  }

  /* 添加移动端导航按钮 */
  .mobile-nav-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: var(--text-white);
    border-radius: var(--radius-sm);
    border: none;
    font-size: 18px;
    cursor: pointer;
    position: relative;
    top: auto;
    right: auto;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
  }

  .mobile-nav-toggle:hover {
    background: var(--primary-hover);
  }
}

@media (max-width: 576px) {
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }

  /* 更紧凑的导航 */
  .account-nav {
    width: 260px;
  }

  .account-nav-item {
    padding: 12px 14px;
  }

  .account-nav-item i {
    font-size: 18px;
    width: 22px;
  }

  .account-nav-text {
    font-size: 14px;
  }

  .account-nav-group-title {
    padding: 8px 14px;
  }

  /* 移动端导航按钮调整 */
  .mobile-nav-toggle {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
}

/* 桌面端隐藏移动端导航按钮 */
@media (min-width: 769px) {
  .mobile-nav-toggle {
    display: none !important;
  }

  .account-nav-overlay {
    display: none !important;
  }
}

/* 暗色主题适配 */
[data-theme="dark"] .mobile-nav-toggle {
  background: var(--primary-color);
  color: var(--text-white);
}

[data-theme="dark"] .mobile-nav-toggle:hover {
  background: var(--primary-hover);
}

[data-theme="dark"] .account-nav {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .account-nav-group-title {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
}

[data-theme="dark"] .account-nav-item {
  color: var(--text-primary);
}

[data-theme="dark"] .account-nav-item:hover {
  background: var(--bg-secondary);
}

[data-theme="dark"] .account-nav-item.active {
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary-color);
}

[data-theme="dark"] .account-nav-item i {
  color: var(--text-primary);
}

[data-theme="dark"] .account-nav-item.active i {
  color: var(--primary-color);
}

/* ========================================
   概览页面移动端优化
   ======================================== */

@media (max-width: 768px) {
  /* 调整容器内边距，减少顶部空间 */
  .container {
    padding-top: 4px !important;
    padding-bottom: 8px !important;
    padding-left: 10px;
    padding-right: 10px;
  }

  /* 调整整体内容卡片间距 */
  .section-content.info-card {
    margin-bottom: 8px !important;
  }

  /* 调整customer-header的margin */
  .customer-header {
    padding: 8px 12px;
    margin-bottom: 8px !important;
  }

  .avatar-container {
    width: 60px;
    height: 60px;
  }

  .customer-avatar {
    border-width: 2px;
  }

  .avatar-placeholder i {
    font-size: 28px;
  }

  .customer-header h5 {
    font-size: 18px;
  }

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

  .customer-header .text-muted {
    font-size: 11px !important;
  }

  .customer-header .small {
    font-size: 11px !important;
  }

  .customer-header i {
    font-size: 12px;
  }

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

  /* 调整行间距 */
  .customer-header .d-flex.align-items-center.justify-content-between {
    margin-bottom: 4px;
  }

  /* 会员信息卡片优化 */
  .member-info-card {
    padding: 10px;
    margin-bottom: 8px !important;
  }

  .level-badge-wrapper .level-badge {
    padding: 4px 12px;
    font-size: 13px;
  }

  .level-points small {
    font-size: 10px;
  }

  .points-value {
    font-size: 18px;
  }

  .member-info-card .btn-sm {
    padding: 4px 10px;
    font-size: 12px;
  }

  /* 核心数据统计卡片优化 */
  .core-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 8px !important;
  }

  .stat-card {
    padding: 12px 8px;
    gap: 8px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
    border-radius: 8px;
  }

  .stat-value {
    font-size: 18px;
    line-height: 1.1;
  }

  .stat-label {
    font-size: 11px;
    margin-top: 2px;
  }

  /* 订单状态统计优化 */
  .order-stats-section {
    padding: 10px;
    margin-bottom: 8px !important;
  }

  .section-title {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .order-stats-section .stat-item {
    padding: 10px 8px;
  }

  .order-stats-section .stat-value {
    font-size: 18px;
  }

  .order-stats-section .stat-label {
    font-size: 11px;
  }

  /* 财务概况优化 */
  .finance-section {
    padding: 10px;
    margin-bottom: 8px !important;
  }

  .finance-grid {
    gap: 10px;
  }

  .finance-item {
    padding: 12px;
  }

  .finance-label {
    font-size: 11px;
  }

  .finance-value {
    font-size: 18px;
  }

  /* 待办事项优化 */
  .todo-reminders {
    margin-top: 10px;
  }

  .todo-item {
    padding: 10px 12px;
    font-size: 12px;
  }

  .todo-item i {
    font-size: 14px;
  }

  .todo-item .btn-link {
    font-size: 11px;
    padding: 2px 8px;
  }

  /* 优惠券区域优化 */
  .coupons-section {
    padding: 10px;
    margin-bottom: 8px !important;
  }

  .coupons-section .d-flex {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }

  .coupons-section h6 {
    font-size: 13px;
  }

  .coupons-section .btn-link {
    font-size: 12px;
  }

  /* 赊销订单区域优化 */
  .credit-order-section {
    padding: 10px;
    margin-bottom: 8px !important;
  }

  .credit-order-section .d-flex {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }

  .credit-stat-card {
    padding: 12px;
    gap: 10px;
  }

  .credit-stat-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
    border-radius: 8px;
  }

  .credit-stat-label {
    font-size: 11px;
  }

  .credit-stat-value {
    font-size: 18px;
  }

  /* 快捷入口优化 */
  .quick-actions {
    margin-top: 4px !important;
  }

  .quick-actions h6 {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .quick-action-item {
    padding: 12px 6px;
    gap: 4px;
  }

  .quick-action-item i {
    font-size: 18px;
  }

  .quick-action-item span {
    font-size: 11px;
  }

  .quick-action-item .badge {
    font-size: 9px;
    padding: 1px 4px;
    min-width: 14px;
  }
}

@media (max-width: 576px) {
  /* 容器优化 */
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }

  /* 用户头部进一步优化 */
  .customer-header {
    padding: 10px 10px;
  }

  .avatar-container {
    width: 50px;
    height: 50px;
  }

  .customer-avatar {
    border-width: 2px;
  }

  .avatar-placeholder i {
    font-size: 24px;
  }

  .customer-header h5 {
    font-size: 16px;
  }

  .customer-header p {
    font-size: 11px;
  }

  /* 隐藏次要信息 */
  .customer-header .text-muted:not(#nickname),
  .customer-header .small:not(#nickname) {
    display: none;
  }

  /* 只显示昵称和客户类型 */
  .customer-header .d-flex.align-items-center.justify-content-between {
    margin-bottom: 0;
  }

  /* 隐藏客户类型徽章 */
  .customer-type-badge {
    display: none;
  }

  /* 会员信息卡片进一步优化 */
  .member-info-card {
    padding: 10px;
    margin-bottom: 12px;
  }

  /* 隐藏"查看权益"按钮文字，只显示图标 */
  .member-info-card .btn-sm {
    padding: 6px 10px;
    font-size: 0;
  }

  .member-info-card .btn-sm::before {
    content: '\F471';
    font-family: 'bootstrap-icons';
    font-size: 18px;
  }

  .level-badge-wrapper .level-badge {
    padding: 3px 10px;
    font-size: 12px;
  }

  .level-points small {
    font-size: 9px;
  }

  .points-value {
    font-size: 16px;
  }

  .member-info-card .d-flex {
    gap: 8px !important;
  }

  /* 核心数据统计卡片进一步优化 - 隐藏标签文字 */
  .core-stats-grid {
    gap: 8px;
    margin-bottom: 12px;
  }

  .stat-card {
    padding: 10px 6px;
    gap: 6px;
    justify-content: center;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .stat-value {
    font-size: 16px;
  }

  /* 隐藏统计标签文字 */
  .stat-label {
    display: none;
  }

  /* 订单状态统计进一步优化 */
  .order-stats-section {
    padding: 10px;
    margin-bottom: 12px;
  }

  .section-title {
    font-size: 12px;
  }

  .order-stats-section .stat-item {
    padding: 8px 6px;
  }

  .order-stats-section .stat-value {
    font-size: 16px;
  }

  /* 隐藏订单状态标签文字 */
  .order-stats-section .stat-label {
    display: none;
  }

  /* 财务概况进一步优化 - 隐藏标签文字 */
  .finance-section {
    padding: 10px;
    margin-bottom: 12px;
  }

  .finance-grid {
    gap: 8px;
  }

  .finance-item {
    padding: 10px;
  }

  /* 隐藏财务标签文字 */
  .finance-label {
    display: none;
  }

  .finance-value {
    font-size: 16px;
  margin-bottom: 0;
  }

  /* 待办事项进一步优化 - 隐藏图标 */
  .todo-reminders {
    margin-top: 10px;
  }

  .todo-item {
    padding: 8px 10px;
    font-size: 11px;
    flex-wrap: wrap;
  }

  /* 隐藏待办事项图标 */
  .todo-item i {
    display: none;
  }

  .todo-item strong {
    margin: 0 4px;
  }

  .todo-item .btn-link {
    font-size: 10px;
    padding: 2px 6px;
    width: 100%;
    margin-left: 0;
    margin-top: 4px;
    text-align: center;
  }

  /* 优惠券区域进一步优化 */
  .coupons-section {
    padding: 10px;
    margin-bottom: 12px;
  }

  .coupons-section h6 {
    font-size: 12px;
  }

  /* 隐藏"全部优惠券"按钮文字 */
  .coupons-section .btn-link {
    font-size: 0;
  }

  .coupons-section .btn-link::after {
    content: '更多 »';
    font-size: 12px;
  }

  /* 赊销订单区域进一步优化 */
  .credit-order-section {
    padding: 10px;
    margin-bottom: 12px;
  }

  .credit-order-section h6 {
    font-size: 12px;
  }

  /* 隐藏赊销订单"全部订单"按钮文字 */
  .credit-order-section .btn-link {
    font-size: 0;
  }

  .credit-order-section .btn-link::after {
    content: '更多 »';
    font-size: 12px;
  }

  .credit-stat-card {
    padding: 10px;
  }

  .credit-stat-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  /* 隐藏赊销统计标签文字 */
  .credit-stat-label {
    display: none;
  }

  .credit-stat-value {
    font-size: 16px;
  }

  /* 快捷入口进一步优化 - 隐藏文字，只显示图标 */
  .quick-actions h6 {
    font-size: 12px;
  }

  .quick-actions-grid {
    gap: 4px;
  }

  .quick-action-item {
    padding: 10px 4px;
  }

  .quick-action-item i {
    font-size: 18px;
  }

  /* 隐藏快捷入口文字，只显示图标 */
  .quick-action-item span {
    display: none;
  }

  /* 徽标改为数字显示在图标上 */
  .quick-action-item {
    position: relative;
  }

  .quick-action-item .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 9px;
    padding: 1px 4px;
    min-width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    z-index: 1;
  }
}

/* 超小屏幕优化 (≤480px) */
@media (max-width: 480px) {
  /* 核心数据统计 - 进一步缩小 */
  .stat-card {
    padding: 8px 4px;
    gap: 4px;
  }

  .stat-icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .stat-value {
    font-size: 14px;
  }

  /* 订单状态 - 进一步缩小 */
  .order-stats-section .stat-value {
    font-size: 14px;
  }

  /* 财务概况 - 进一步缩小 */
  .finance-value {
    font-size: 14px;
  }

  /* 待办事项 - 进一步缩小 */
  .todo-item {
    font-size: 10px;
    padding: 6px 8px;
  }

  /* 快捷入口图标 - 进一步缩小 */
  .quick-action-item i {
    font-size: 16px;
  }

  .quick-action-item {
    padding: 8px 2px;
  }

  .quick-action-item .badge {
    top: 2px;
    right: 2px;
    font-size: 8px;
    min-width: 12px;
    height: 12px;
  }
}

/* 暗色主题下的移动端优化 */
[data-theme="dark"] .customer-header h5 {
  color: var(--text-primary);
}

[data-theme="dark"] .customer-header p,
[data-theme="dark"] .customer-header .text-muted,
[data-theme="dark"] .customer-header .small {
  color: var(--text-secondary);
}

[data-theme="dark"] .customer-type-badge {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .member-info-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border-color: var(--border-color);
}

[data-theme="dark"] .level-badge-wrapper .badge {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .points-value {
  color: var(--warning-color);
}

[data-theme="dark"] .stat-value,
[data-theme="dark"] .finance-value {
  color: var(--text-primary);
}

[data-theme="dark"] .order-stats-section .stat-value {
  color: var(--primary-color);
}

[data-theme="dark"] .todo-item {
  border-bottom-color: var(--border-color);
}
