/* 智能秤应用 - 全局样式 */

:root {
  --color-success: #4CAF50;
  --color-warning: #FFC107;
  --color-danger: #F44336;
  --color-primary: #2196F3;
  --color-info: #03A9F4;
  --bg-light: #f5f5f5;
  --bg-dark: #2c3e50;
  --text-dark: #333;
  --text-light: #fff;
  --border-color: #ddd;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Microsoft YaHei', Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  overflow-x: hidden;
}

/* 顶部状态栏 */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #667eea;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 16px;
  font-weight: bold;
}

.user-role {
  font-size: 12px;
  opacity: 0.9;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 主内容区域 */
.main-content {
  margin-top: 60px;
  min-height: calc(100vh - 120px);
  padding: 20px;
}

.page {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 底部导航栏 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: white;
  display: flex;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  color: #666;
  font-size: 12px;
  gap: 5px;
}

.nav-item:hover {
  background: var(--bg-light);
}

.nav-item.active {
  color: #667eea;
  background: linear-gradient(to top, rgba(102, 126, 234, 0.1), transparent);
}

.nav-icon {
  font-size: 24px;
}

/* 卡片样式 */
.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.card-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 15px;
  color: var(--text-dark);
}

/* 大按钮样式 */
.btn-large {
  min-height: 60px;
  font-size: 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: bold;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: white;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #F44336 0%, #da190b 100%);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.btn-warning {
  background: linear-gradient(135deg, #FFC107 0%, #ff9800 100%);
  color: white;
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.btn-info {
  background: linear-gradient(135deg, #03A9F4 0%, #0288d1 100%);
  color: white;
}

.btn-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(3, 169, 244, 0.4);
}

/* 功能入口卡片 */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.feature-card {
  background: white;
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.feature-card.blue {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.feature-card.green {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: white;
}

.feature-card.orange {
  background: linear-gradient(135deg, #FF9800 0%, #f57c00 100%);
  color: white;
}

.feature-card.gray {
  background: linear-gradient(135deg, #9E9E9E 0%, #757575 100%);
  color: white;
}

.feature-icon {
  font-size: 48px;
}

.feature-title {
  font-size: 24px;
  font-weight: bold;
}

/* 今日简报 */
.summary-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
}

/* 表单元素 */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.form-input {
  width: 100%;
  padding: 15px;
  font-size: 18px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: border-color 0.3s;
}

.form-input:focus {
  outline: none;
  border-color: #667eea;
}

.form-select {
  width: 100%;
  padding: 15px;
  font-size: 18px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

/* 仪表盘数字 */
.display-number {
  font-size: 72px;
  font-weight: bold;
  color: var(--color-primary);
  text-align: center;
  margin: 20px 0;
}

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 30px;
  background: #e0e0e0;
  border-radius: 15px;
  overflow: hidden;
  position: relative;
  margin: 20px 0;
}

.progress-fill {
  height: 100%;
  transition: width 0.3s, background-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.progress-fill.red {
  background: linear-gradient(90deg, #F44336, #da190b);
}

.progress-fill.green {
  background: linear-gradient(90deg, #4CAF50, #45a049);
}

.progress-fill.yellow {
  background: linear-gradient(90deg, #FFC107, #ff9800);
}

/* 表格样式 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

.data-table th,
.data-table td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: #f5f5f5;
  font-weight: bold;
  color: var(--text-dark);
}

.data-table tr:hover {
  background: var(--bg-light);
}

/* 模态框 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 24px;
  font-weight: bold;
}

.modal-close {
  font-size: 28px;
  cursor: pointer;
  color: #999;
  transition: color 0.3s;
}

.modal-close:hover {
  color: var(--color-danger);
}

/* Toast提示 */
.toast {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 15px 25px;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  z-index: 3000;
  animation: slideInRight 0.3s ease-out;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.toast.success {
  background: var(--color-success);
}

.toast.warning {
  background: var(--color-warning);
}

.toast.error {
  background: var(--color-danger);
}

.toast.info {
  background: var(--color-info);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 子Tab栏 */
.sub-tabs {
  display: flex;
  background: white;
  border-radius: 8px;
  padding: 5px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sub-tab {
  flex: 1;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s;
  font-weight: bold;
}

.sub-tab:hover {
  background: var(--bg-light);
}

.sub-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.sub-tab-content {
  display: none;
}

.sub-tab-content.active {
  display: block;
}

/* AI识别结果 */
.ai-result {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.3s;
}

.ai-result:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ai-result.selected {
  border: 3px solid var(--color-success);
  background: #e8f5e9;
}

.ai-rank {
  font-size: 24px;
  margin-right: 15px;
}

.ai-info {
  flex: 1;
}

.ai-name {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 5px;
}

.ai-price {
  font-size: 16px;
  color: #666;
}

.ai-confidence {
  font-size: 18px;
  font-weight: bold;
  color: var(--color-success);
}

/* 相机预览 */
.camera-preview {
  width: 100%;
  height: 200px;
  background: #000;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  margin-bottom: 15px;
  overflow: hidden;
}

.camera-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 照片缩略图 */
.photo-thumbnails {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 15px;
}

.photo-thumb {
  aspect-ratio: 1;
  background: #f0f0f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #999;
  overflow: hidden;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 长按按钮效果 */
.btn-long-press {
  position: relative;
  overflow: hidden;
}

.btn-long-press::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.3);
  transition: left 2s linear;
}

.btn-long-press.pressing::before {
  left: 0;
}

/* 响应式优化 */
@media (max-width: 1024px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
  
  .summary-stats {
    grid-template-columns: 1fr;
  }
  
  .display-number {
    font-size: 48px;
  }
}

/* 闪烁动画 */
@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.flash-red {
  animation: flash 0.5s infinite;
  background: var(--color-danger) !important;
}

/* 二维码容器 */
.qr-code-container {
  width: 200px;
  height: 200px;
  background: white;
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px auto;
  font-size: 14px;
  color: #666;
}

/* 小票样式 */
.receipt {
  background: white;
  padding: 20px;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.6;
  border: 1px dashed #ccc;
  max-width: 300px;
  margin: 0 auto;
}

.receipt-header {
  text-align: center;
  border-bottom: 1px dashed #ccc;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.receipt-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.receipt-total {
  border-top: 1px dashed #ccc;
  padding-top: 10px;
  margin-top: 10px;
  font-weight: bold;
  font-size: 16px;
}

/* ==================== 登录页面样式 ==================== */

.login-container {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  font-size: 80px;
  margin-bottom: 15px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.login-title {
  font-size: 32px;
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.login-subtitle {
  font-size: 16px;
  color: #666;
}

.login-tabs {
  display: flex;
  background: var(--bg-light);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 30px;
}

.login-tab {
  flex: 1;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s;
  font-weight: bold;
  font-size: 16px;
}

.login-tab:hover {
  background: white;
}

.login-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.login-tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.login-tab-content.active {
  display: block;
}

.login-input {
  font-size: 24px;
  text-align: center;
  letter-spacing: 8px;
  padding: 20px;
}

.login-hint {
  margin-top: 20px;
  padding: 15px;
  background: var(--bg-light);
  border-radius: 8px;
  font-size: 14px;
  color: #666;
}

.login-hint p {
  margin: 5px 0;
}

.card-scan-area,
.face-scan-area {
  text-align: center;
  margin-bottom: 20px;
}

.scan-icon {
  font-size: 80px;
  margin-bottom: 15px;
  animation: pulse 2s infinite;
}

.scan-text {
  font-size: 20px;
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.scan-hint {
  font-size: 14px;
  color: #999;
}

.login-footer {
  margin-top: 30px;
  text-align: center;
  font-size: 12px;
  color: #999;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.login-footer p {
  margin: 5px 0;
}
