/**
 * H5移动端公共样式
 * 参考Web端的深色主题设计
 */

/* ==================== CSS变量 ==================== */
:root {
  --primary-color: #1890ff;
  --success-color: #52c41a;
  --danger-color: #f5222d;
  --warning-color: #faad14;
  
  --bg-color: #2c3e50;
  --card-bg: #34495e;
  --header-bg: #040824;
  
  --text-color: #ecf0f1;
  --text-secondary: #95a5a6;
  --text-muted: #7f8c8d;
  
  --border-color: #465669;
  --divider-color: #3d566e;
  
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ==================== 基础重置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 阻止iOS橡皮筋效果 */
body {
  overscroll-behavior: none;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

/* ==================== 布局容器 ==================== */
.page-container {
  width: 100%;
  min-height: 100vh;
  padding-bottom: 60px; /* 为底部导航留出空间 */
  background-color: var(--bg-color);
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--header-bg);
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.page-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--text-color);
}

.page-content {
  padding: 15px;
}

/* ==================== 底部Tab导航 ==================== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background-color: var(--card-bg);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  color: var(--text-secondary);
  transition: color 0.3s;
  cursor: pointer;
}

.tab-item.active {
  color: var(--primary-color);
}

.tab-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

.tab-label {
  font-size: 11px;
  white-space: nowrap;
}

/* ==================== 卡片组件 ==================== */
.card {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--text-color);
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ==================== 按钮组件 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
  cursor: pointer;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary-color);
  color: #fff;
}

.btn-primary:disabled {
  background-color: #52a0d9;
  cursor: not-allowed;
}

.btn-success {
  background-color: var(--success-color);
  color: #fff;
}

.btn-danger {
  background-color: var(--danger-color);
  color: #fff;
}

.btn-warning {
  background-color: var(--warning-color);
  color: #fff;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-block {
  width: 100%;
  display: flex;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}

/* ==================== 表单组件 ==================== */
.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-color);
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-input:focus {
  border-color: var(--primary-color);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* ==================== 列表组件 ==================== */
.list {
  background-color: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
}

.list-item {
  padding: 15px;
  border-bottom: 1px solid var(--divider-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.2s;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:active {
  background-color: var(--bg-color);
}

.list-item-content {
  flex: 1;
}

.list-item-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

.list-item-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.list-item-extra {
  margin-left: 10px;
  color: var(--text-muted);
}

/* ==================== 标签组件 ==================== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.tag-primary {
  background-color: rgba(24, 144, 255, 0.2);
  color: var(--primary-color);
}

.tag-success {
  background-color: rgba(82, 196, 26, 0.2);
  color: var(--success-color);
}

.tag-danger {
  background-color: rgba(245, 34, 45, 0.2);
  color: var(--danger-color);
}

.tag-warning {
  background-color: rgba(250, 173, 20, 0.2);
  color: var(--warning-color);
}

/* ==================== 加载动画 ==================== */
.h5-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.h5-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.h5-loading-text {
  margin-top: 12px;
  color: var(--text-color);
  font-size: 14px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== Toast提示 ==================== */
.h5-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 10000;
  max-width: 80%;
  text-align: center;
  pointer-events: none;
}

.h5-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ==================== 确认对话框 ==================== */
.h5-confirm-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.h5-confirm-dialog {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  width: 85%;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
}

.h5-confirm-title {
  font-size: 17px;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: center;
  color: var(--text-color);
}

.h5-confirm-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.5;
}

.h5-confirm-buttons {
  display: flex;
  gap: 10px;
}

.h5-confirm-btn {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s;
}

.h5-confirm-cancel {
  background-color: var(--bg-color);
  color: var(--text-secondary);
}

.h5-confirm-ok {
  background-color: var(--primary-color);
  color: #fff;
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 15px;
  margin-bottom: 20px;
}

/* ==================== 状态指示器 ==================== */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-online {
  background-color: var(--success-color);
  box-shadow: 0 0 6px var(--success-color);
}

.status-offline {
  background-color: var(--text-muted);
}

.status-busy {
  background-color: var(--primary-color);
  box-shadow: 0 0 6px var(--primary-color);
}

/* ==================== 响应式适配 ==================== */
@media screen and (max-width: 375px) {
  html {
    font-size: 13px;
  }
}

@media screen and (min-width: 414px) {
  html {
    font-size: 15px;
  }
}

/* ==================== 工具类 ==================== */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.mt-10 {
  margin-top: 10px;
}

.mb-10 {
  margin-bottom: 10px;
}

.ml-10 {
  margin-left: 10px;
}

.mr-10 {
  margin-right: 10px;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-1 {
  flex: 1;
}

.hidden {
  display: none !important;
}
