/* 新模版 - 會員中心樣式（電腦端不修改 buyer 側欄佈局） */

/* 電腦端：完全不渲染手機會員區塊 */
@media (min-width: 992px) {
  .user-mobile-scope {
    display: none !important;
  }
}

/* ========== 手機端個人中心（僅 .user-mobile-scope 內） ========== */
@media (max-width: 991.98px) {
  .user-mobile-scope {
    margin-bottom: 12px;
  }

  .muh-hub {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  .muh-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #ee4d2d, #ff8c42);
    color: #fff;
  }

  .muh-profile-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    overflow: hidden;
  }

  .muh-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .muh-profile-info {
    flex: 1;
    min-width: 0;
  }

  .muh-profile-info strong {
    display: block;
    font-size: 15px;
  }

  .muh-profile-info span {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    word-break: break-all;
  }

  .muh-profile-edit {
    font-size: 12px;
    color: #fff;
    white-space: nowrap;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    text-decoration: none;
  }

  .muh-order-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid #f0f0f0;
  }

  .muh-order-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 4px;
    text-decoration: none;
    color: #333;
    border-right: 1px solid #f5f5f5;
  }

  .muh-order-item:last-child {
    border-right: 0;
  }

  .muh-order-item em {
    font-style: normal;
    font-size: 18px;
    font-weight: 700;
    color: #ee4d2d;
    line-height: 1.2;
  }

  .muh-order-item span {
    font-size: 10px;
    text-align: center;
    margin-top: 4px;
    line-height: 1.2;
  }

  .muh-section {
    padding: 10px 12px 4px;
  }

  .muh-section-title {
    font-size: 12px;
    color: #999;
    margin: 0 0 8px;
    font-weight: 600;
  }

  .muh-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }

  .muh-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 4px;
    text-decoration: none;
    color: #444;
    border-radius: 8px;
    position: relative;
    font-size: 11px;
    text-align: center;
  }

  .muh-item i {
    font-size: 22px;
    color: #ee4d2d;
    margin-bottom: 4px;
  }

  .muh-item.is-active {
    background: #fff0eb;
    color: #ee4d2d;
  }

  .muh-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 8px;
    background: #28a745;
    color: #fff;
  }

  .muh-seller {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px 14px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    position: relative;
    z-index: 1;
  }

  .muh-seller a {
    pointer-events: auto;
    position: relative;
    z-index: 2;
  }

  .muh-seller span {
    font-size: 13px;
    color: #666;
  }

  .muh-logout-wrap {
    padding: 12px 16px 16px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
  }

  .muh-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
    background: #fafafa;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
  }

  .muh-logout-btn i {
    font-size: 18px;
  }

  .muh-logout-btn:active,
  .muh-logout-btn:hover {
    background: #fff5f5;
    border-color: #ffc9c9;
    color: #d32f2f;
  }

  .muh-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    margin-bottom: 12px;
  }

  .muh-toolbar-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #ee4d2d;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .muh-toolbar-title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .muh-toolbar-logout {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    padding: 4px 2px;
    color: #888;
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
  }

  .muh-toolbar-logout i {
    font-size: 18px;
  }

  .muh-toolbar-logout:active,
  .muh-toolbar-logout:hover {
    color: #d32f2f;
  }

  .user-panel-section {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .user-panel-section .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .user-panel-section .order-item .order-header,
  .user-panel-section .order-card .order-header {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .user-panel-section .order-status {
    justify-content: flex-start;
    width: 100%;
  }

  .user-panel-section .order-item .order-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .user-panel-section .order-item .order-footer .btn {
    width: 100%;
    text-align: center;
  }

  .user-address-item {
    background: #fff;
  }

  .user-address-line {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 4px;
    padding-right: 28px;
  }

  .user-address-line .label {
    color: #888;
  }

  .user-address-default-badge {
    position: absolute;
    right: 36px;
    top: 10px;
  }

  .user-addresses-card .card-header .btn {
    white-space: nowrap;
  }

  .user-transaction-form .col-form-label {
    font-size: 13px;
  }
}

.mobile-account-menu-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary-color, #ee4d2d) 0%, #ff8c42 100%);
  color: #fff;
}

.mobile-account-menu-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
}

.mobile-account-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mobile-account-menu-user {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mobile-account-menu-user strong {
  font-size: 16px;
  line-height: 1.3;
}

.mobile-account-menu-user span {
  font-size: 12px;
  opacity: 0.9;
  word-break: break-all;
}

.mobile-account-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 8px 4px 4px;
}

.mobile-account-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 4px;
  text-decoration: none;
  color: #444;
  font-size: 11px;
  text-align: center;
  position: relative;
  border-radius: 8px;
  min-height: 72px;
}

.mobile-account-menu-item i {
  font-size: 22px;
  margin-bottom: 6px;
  color: var(--primary-color, #ee4d2d);
}

.mobile-account-menu-item.active {
  background: rgba(238, 77, 45, 0.08);
  color: var(--primary-color, #ee4d2d);
  font-weight: 600;
}

.mobile-account-menu-item .menu-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-style: normal;
  font-size: 9px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 8px;
  background: #28a745;
  color: #fff;
}

.mobile-account-menu-seller {
  padding: 12px 16px 14px;
  border-top: 1px solid #f0f0f0;
  text-align: center;
}

.mobile-account-menu-seller p {
  margin: 0 0 8px;
  font-size: 12px;
  color: #888;
}

/* 商品比較 */
.compare-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.compare-table {
  min-width: 560px;
}

.compare-label-col {
  min-width: 72px;
  white-space: nowrap;
}

.compare-product-img {
  max-width: 100px;
  max-height: 100px;
  object-fit: contain;
}

@media (max-width: 375px) {
  .mobile-account-menu-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .mobile-account-menu-item {
    min-height: 68px;
    font-size: 10px;
  }
}

/* 手機端快捷導航（已棄用，保留樣式兼容） */
.user-mobile-nav {
  background: #fff;
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.user-mobile-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border-bottom: 1px solid #f0f0f0;
}

.user-mobile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary-color, #ee4d2d);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.user-mobile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-mobile-greeting {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-mobile-greeting strong {
  font-size: 15px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-mobile-greeting span {
  font-size: 12px;
  color: #888;
}

.user-mobile-nav-scroll {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.user-mobile-nav-scroll::-webkit-scrollbar {
  display: none;
}

.user-mobile-nav-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: #666;
  font-size: 11px;
  background: #f7f7f7;
  transition: background 0.2s, color 0.2s;
}

.user-mobile-nav-item i {
  font-size: 20px;
  margin-bottom: 4px;
}

.user-mobile-nav-item.active,
.user-mobile-nav-item:active {
  background: rgba(238, 77, 45, 0.1);
  color: var(--primary-color, #ee4d2d);
}

/* 側邊欄 */
.user-sidebar .user-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #555;
  text-decoration: none;
  margin-bottom: 2px;
}

.user-sidebar .user-nav .nav-item.active,
.user-sidebar .user-nav .nav-item:hover {
  background: rgba(238, 77, 45, 0.08);
  color: var(--primary-color, #ee4d2d);
}

.user-sidebar .nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  padding: 12px 12px 6px;
  letter-spacing: 0.5px;
}

.user-avatar-large,
.user-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto;
}

.user-avatar-large img,
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder-large,
.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color, #ee4d2d);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}

/* 統計卡片 */
.stat-card,
.coupon-stat-card,
.quick-link-card {
  transition: box-shadow 0.2s;
}

.stat-card:hover,
.quick-link-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-size: 22px;
}

.stat-card .stat-icon.pending { background: #fff3e0; color: #f57c00; }
.stat-card .stat-icon.processing { background: #e3f2fd; color: #1976d2; }
.stat-card .stat-icon.shipped { background: #e8f5e9; color: #388e3c; }
.stat-card .stat-icon.review { background: #fce4ec; color: #c2185b; }

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: #888;
  margin-bottom: 8px;
}

.stat-link {
  font-size: 12px;
  color: var(--primary-color, #ee4d2d);
  text-decoration: none;
}

/* 訂單列表 */
.order-item,
.order-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f5f5f5;
}

.order-info {
  flex: 1 1 auto;
  min-width: 0;
}

.order-info .order-number,
.order-info .order-code,
.order-info .order-date {
  display: block;
  line-height: 1.4;
}

.order-info .order-number,
.order-info .order-code {
  font-weight: 600;
  word-break: break-all;
}

.order-info .order-date {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

/* 状态标签禁止被 flex 挤压（避免「已確認」等只显示一字） */
.order-status {
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: max-content;
  max-width: 100%;
  height: auto;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  overflow: visible;
}

/* 覆盖 aiz-core .badge 固定 18×18px（导致「已確認」等文字被裁切） */
.user-panel-section .order-status .badge,
.aiz-user-panel .order-status .badge,
.order-status .badge {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  height: auto !important;
  min-height: 26px;
  min-width: auto !important;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 12px !important;
  font-weight: 500;
  line-height: 1.35 !important;
  padding: 5px 10px !important;
  border-radius: 4px !important;
  box-sizing: border-box;
}

.user-panel-section .order-status .badge-warning,
.order-status .badge-warning {
  background-color: #ffc107 !important;
  color: #333 !important;
}

.user-panel-section .order-status .badge-info,
.order-status .badge-info {
  background-color: #17a2b8 !important;
  color: #fff !important;
}

.user-panel-section .order-status .badge-primary,
.order-status .badge-primary {
  background-color: #007bff !important;
  color: #fff !important;
}

.user-panel-section .order-status .badge-success,
.order-status .badge-success {
  background-color: #28a745 !important;
  color: #fff !important;
}

.user-panel-section .order-status .badge-danger,
.order-status .badge-danger {
  background-color: #dc3545 !important;
  color: #fff !important;
}

.order-products {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.product-thumb {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #eee;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.order-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.order-tabs,
.coupon-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid #dee2e6;
}

.order-tabs .nav-link,
.coupon-tabs .nav-link {
  white-space: nowrap;
  font-size: 13px;
  padding: 8px 12px;
}

.product-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
}

.product-item .product-image {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
}

.product-item .product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-item .product-info {
  flex: 1;
  min-width: 0;
}

.product-item .product-name {
  font-size: 14px;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quick-link-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.quick-link-card .icon-wrapper {
  font-size: 32px;
  color: var(--primary-color, #ee4d2d);
  margin-bottom: 8px;
}

@media (max-width: 991.98px) {
  .user-panel-section .aiz-user-panel {
    width: 100%;
    min-height: 200px;
  }

  .user-panel-section .aiz-titlebar h1,
  .user-panel-section .aiz-titlebar .h3,
  .user-panel-section .aiz-titlebar .h4 {
    font-size: 1.1rem;
  }

  .user-panel-section .table-responsive {
    font-size: 13px;
  }
}

/* 舊版側欄抽屜（profile / wallet 等仍用 user_panel） */
.new-template-wrapper .aiz-mobile-side-nav .collapse-sidebar {
  max-width: 320px;
}

@media (max-width: 768px) {
  .welcome-section .d-flex {
    flex-wrap: wrap;
  }

  .welcome-section .ml-auto {
    margin-left: 0 !important;
    margin-top: 10px;
    width: 100%;
  }

  .page-header .search-box {
    width: 100%;
    margin-top: 10px;
  }

  .page-header .d-flex {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .order-actions .btn {
    font-size: 12px;
  }
}
