/* ========================================
   Mobile Common Components
   全站移动端公共样式组件
   断点: 992px
   ======================================== */

/* ========================================
   1. 工具类
   ======================================== */

/* 移动端隐藏 */
@media (max-width: 992px) {
  .hide-mobile,
  .mobile-hide {
    display: none !important;
  }
}

/* PC端隐藏 */
@media (min-width: 993px) {
  .hide-desktop,
  .desktop-hide,
  .show-mobile-only {
    display: none !important;
  }
}

/* 移动端显示 */
@media (max-width: 992px) {
  .show-mobile {
    display: block !important;
  }
  .show-mobile-flex {
    display: flex !important;
  }
  .show-mobile-inline {
    display: inline-block !important;
  }
}

/* 移动端全宽 */
@media (max-width: 992px) {
  .mobile-full-width {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* 移动端文本居中 */
@media (max-width: 992px) {
  .mobile-text-center {
    text-align: center !important;
  }
}

/* 移动端内边距 */
@media (max-width: 992px) {
  .mobile-p-0 { padding: 0 !important; }
  .mobile-p-10 { padding: 10px !important; }
  .mobile-p-15 { padding: 15px !important; }
  .mobile-p-20 { padding: 20px !important; }
  .mobile-px-15 { padding-left: 15px !important; padding-right: 15px !important; }
  .mobile-py-20 { padding-top: 20px !important; padding-bottom: 20px !important; }
}

/* 移动端外边距 */
@media (max-width: 992px) {
  .mobile-m-0 { margin: 0 !important; }
  .mobile-mt-10 { margin-top: 10px !important; }
  .mobile-mt-20 { margin-top: 20px !important; }
  .mobile-mb-10 { margin-bottom: 10px !important; }
  .mobile-mb-20 { margin-bottom: 20px !important; }
}

/* ========================================
   2. 容器和布局
   ======================================== */

@media (max-width: 992px) {
  /* 通用容器 */
  .container,
  .content-wrapper,
  .page-content {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }

  /* Flex 列布局 */
  .mobile-flex-col {
    flex-direction: column !important;
  }

  /* 网格单列 */
  .mobile-grid-1 {
    grid-template-columns: 1fr !important;
  }

  /* 网格两列 */
  .mobile-grid-2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ========================================
   3. 表格转卡片组件
   ======================================== */

@media (max-width: 992px) {
  /* 隐藏表格，显示卡片 */
  .table-to-cards .data-table,
  .table-to-cards > table {
    display: none !important;
  }

  .table-to-cards .mobile-cards {
    display: block !important;
  }

  /* 移动端数据卡片 */
  .mobile-data-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
  }

  .mobile-data-card:last-child {
    margin-bottom: 0;
  }

  .mobile-data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .mobile-data-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    word-break: break-all;
  }

  .mobile-data-card-status {
    flex-shrink: 0;
    margin-left: 10px;
  }

  .mobile-data-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .mobile-data-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
  }

  .mobile-data-card-label {
    color: #64748b;
  }

  .mobile-data-card-value {
    color: #e2e8f0;
    text-align: right;
    word-break: break-all;
    max-width: 60%;
  }

  .mobile-data-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .mobile-data-card-actions .btn,
  .mobile-data-card-actions a {
    flex: 1;
    text-align: center;
  }
}

/* ========================================
   4. 状态徽章
   ======================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge.status-running,
.status-badge.status-active,
.status-badge.status-success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.status-badge.status-running::before,
.status-badge.status-active::before,
.status-badge.status-success::before {
  background: #10b981;
}

.status-badge.status-stopped,
.status-badge.status-inactive,
.status-badge.status-error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.status-badge.status-stopped::before,
.status-badge.status-inactive::before,
.status-badge.status-error::before {
  background: #ef4444;
}

.status-badge.status-pending,
.status-badge.status-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.status-badge.status-pending::before,
.status-badge.status-warning::before {
  background: #f59e0b;
}

.status-badge.status-expired {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}
.status-badge.status-expired::before {
  background: #9ca3af;
}

/* ========================================
   5. 按钮响应式
   ======================================== */

@media (max-width: 992px) {
  /* 移动端按钮最小高度 - 触摸友好 */
  .btn,
  button,
  input[type="submit"],
  input[type="button"] {
    min-height: 44px;
  }

  /* 移动端按钮组 */
  .btn-group-mobile {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .btn-group-mobile .btn,
  .btn-group-mobile button {
    width: 100%;
  }

  /* 移动端按钮行 */
  .btn-row-mobile {
    display: flex;
    gap: 10px;
  }

  .btn-row-mobile .btn,
  .btn-row-mobile button {
    flex: 1;
  }
}

/* 小型按钮 */
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 32px;
}

@media (max-width: 992px) {
  .btn-sm {
    min-height: 36px;
    padding: 8px 14px;
  }
}

/* ========================================
   6. 表单响应式
   ======================================== */

@media (max-width: 992px) {
  /* 表单组 */
  .form-group {
    margin-bottom: 16px;
  }

  /* 输入框 */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  textarea,
  select {
    width: 100%;
    min-height: 44px;
    font-size: 16px; /* 防止iOS缩放 */
  }

  /* 表单行转列 */
  .form-row,
  .form-inline {
    flex-direction: column;
  }

  .form-row > *,
  .form-inline > * {
    width: 100%;
    margin-bottom: 12px;
  }

  .form-row > *:last-child,
  .form-inline > *:last-child {
    margin-bottom: 0;
  }

  /* 标签 */
  .form-label,
  label {
    display: block;
    margin-bottom: 6px;
  }
}

/* ========================================
   7. 卡片响应式
   ======================================== */

@media (max-width: 992px) {
  /* 通用卡片 */
  .card {
    border-radius: 12px;
    padding: 16px;
  }

  /* 卡片网格 */
  .card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* 两列卡片网格 */
  .card-grid-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .card-grid-2 .card {
    padding: 12px;
  }
}

/* ========================================
   8. 弹窗/模态框响应式
   ======================================== */

@media (max-width: 992px) {
  .modal,
  .popup,
  .dialog {
    width: calc(100% - 30px) !important;
    max-width: 100% !important;
    margin: 15px;
    max-height: calc(100vh - 30px);
    overflow-y: auto;
  }

  .modal-content,
  .popup-content {
    padding: 20px 16px;
  }

  .modal-header,
  .popup-header {
    padding: 16px;
  }

  .modal-footer,
  .popup-footer {
    padding: 16px;
    flex-direction: column;
    gap: 10px;
  }

  .modal-footer .btn,
  .popup-footer .btn {
    width: 100%;
  }
}

/* ========================================
   9. 分页响应式
   ======================================== */

@media (max-width: 992px) {
  .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .pagination a,
  .pagination span {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* 隐藏部分页码 */
  .pagination .page-item:not(.active):not(.prev):not(.next):not(:first-child):not(:last-child) {
    display: none;
  }

  .pagination .page-item.active,
  .pagination .page-item.prev,
  .pagination .page-item.next,
  .pagination .page-item:first-child,
  .pagination .page-item:last-child {
    display: flex;
  }
}

/* ========================================
   10. 标签页响应式
   ======================================== */

@media (max-width: 992px) {
  .tabs,
  .tab-nav {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
  }

  .tabs::-webkit-scrollbar,
  .tab-nav::-webkit-scrollbar {
    display: none;
  }

  .tab,
  .tab-item {
    flex-shrink: 0;
    padding: 10px 16px;
    white-space: nowrap;
  }
}

/* ========================================
   11. 提示信息
   ======================================== */

.mobile-notice {
  display: none;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #fbbf24;
}

.mobile-notice svg {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: middle;
}

@media (max-width: 992px) {
  .mobile-notice {
    display: flex;
    align-items: center;
  }
}

/* ========================================
   12. 空状态
   ======================================== */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 500;
  color: #94a3b8;
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 14px;
  margin-bottom: 20px;
}

@media (max-width: 992px) {
  .empty-state {
    padding: 30px 15px;
  }

  .empty-state-icon {
    width: 48px;
    height: 48px;
  }
}

/* ========================================
   13. 加载状态
   ======================================== */

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 6, 18, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ========================================
   14. 滚动优化
   ======================================== */

@media (max-width: 992px) {
  /* 横向滚动容器 */
  .scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .scroll-x::-webkit-scrollbar {
    display: none;
  }

  /* 防止页面横向滚动 */
  html, body {
    overflow-x: hidden;
  }
}

/* ========================================
   15. 价格显示
   ======================================== */

.price-display {
  font-weight: 700;
}

.price-display .currency {
  font-size: 0.7em;
  font-weight: 500;
}

.price-display .amount {
  font-size: 1.2em;
}

.price-display .period {
  font-size: 0.65em;
  font-weight: 400;
  color: #64748b;
}

@media (max-width: 992px) {
  .price-display {
    font-size: 18px;
  }
}

/* ========================================
   16. 规格标签
   ======================================== */

.spec-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.spec-tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 4px;
  font-size: 12px;
  color: #a78bfa;
}

@media (max-width: 992px) {
  .spec-tag {
    padding: 3px 8px;
    font-size: 11px;
  }
}

/* ========================================
   移动端底部 - 隐藏产品服务等栏目
   ======================================== */
@media (max-width: 992px) {
  /* 隐藏产品服务、解决方案、行业资讯、公告通知、关于我们等栏目 */
  .mega-footer .footer-col {
    display: none !important;
  }

  /* 保留品牌栏目（logo、简介、社交链接） */
  .mega-footer .footer-brand-col {
    display: block !important;
  }

  /* 底部版权栏居中 */
  .mega-footer .footer-bottom {
    text-align: center !important;
  }

  .mega-footer .footer-bottom-inner {
    flex-direction: column !important;
    gap: 10px !important;
  }

  .mega-footer .footer-bottom-links {
    justify-content: center !important;
  }
}
