* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f2f2f7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-container {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 414px;
  margin: 0 auto;
  background: #ffffff;
  overflow: hidden;
}

.app-header {
  background: #007AFF;
  color: white;
  padding: 20px;
  text-align: center;
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
}

.app-content {
  flex: 1;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

.scan-area {
  text-align: center;
}

.scan-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.8;
}

.scan-area h2 {
  font-size: 1.8rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 10px;
}

.scan-area p {
  font-size: 1rem;
  color: #86868b;
  margin-bottom: 0;
  line-height: 1.5;
}

.scan-btn {
  background: #007AFF;
  color: white;
  border: none;
  padding: 24px 60px;
  border-radius: 30px;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
  min-width: 200px;
}

.scan-btn:hover {
  background: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

.scan-btn:active {
  transform: translateY(0);
}

/* 简洁的扫描按钮样式 */

/* 扫码界面样式 */
.scanner-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.scanner-header {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
}

.scanner-title {
  font-size: 1.1rem;
  font-weight: 500;
}

.close-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

#scanner-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 模态框样式 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
}

.user-info {
  margin-bottom: 20px;
}

.user-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.user-info-item:last-child {
  border-bottom: none;
}

.user-info-label {
  font-weight: 500;
  color: #666;
  min-width: 80px;
}

.user-info-value {
  color: #333;
  text-align: right;
  flex: 1;
  margin-left: 10px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions .primary-btn,
.modal-actions .secondary-btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.secondary-btn {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
}

.secondary-btn:hover {
  background: #e5e5e5;
}

.result-content {
  text-align: center;
  padding: 20px 0;
}

.result-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.result-message {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 8px;
}

.result-detail {
  font-size: 0.9rem;
  color: #666;
}

/* 深色模式下的模态框 */
@media (prefers-color-scheme: dark) {
  .modal-content {
    background: #1c1c1e;
  }
  
  .user-info-label {
    color: #8e8e93;
  }
  
  .user-info-value {
    color: #ffffff;
  }
  
  .user-info-item {
    border-bottom-color: #2c2c2e;
  }
  
  .secondary-btn {
    background: #2c2c2e;
    color: #8e8e93;
    border-color: #3a3a3c;
  }
  
  .secondary-btn:hover {
    background: #3a3a3c;
  }
  
  .result-message {
    color: #ffffff;
  }
  
  .result-detail {
    color: #8e8e93;
  }
}



/* 响应式设计 */
@media (max-width: 414px) {
  .app-container {
    max-width: 100%;
  }
  
  .app-content {
    padding: 30px 15px;
  }
  
  .scan-icon {
    font-size: 3.5rem;
  }
  
  .scan-area h2 {
    font-size: 1.6rem;
  }
  
  .scan-area p {
    font-size: 0.9rem;
  }
  
  .scan-btn {
    padding: 20px 50px;
    font-size: 1.2rem;
    min-width: 180px;
  }
}

/* 加载状态样式 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.loading-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px 30px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 280px;
  width: 90%;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007AFF;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.loading-subtitle {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.4;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  body {
    background: #1c1c1e;
  }
  
  .app-container {
    background: #000000;
  }
  
  .scan-area h2 {
    color: #ffffff;
  }
  
  .scan-area p {
    color: #8e8e93;
  }
  
  .loading-content {
    background: rgba(28, 28, 30, 0.95);
  }
  
  .loading-text {
    color: #ffffff;
  }
  
  .loading-subtitle {
    color: #8e8e93;
  }
  
  .loading-spinner {
    border-color: #3a3a3c;
    border-top-color: #007AFF;
  }
}

/* 底部刷新按钮样式 */
.bottom-actions {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.refresh-btn {
  background: rgba(0, 122, 255, 0.9);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
  backdrop-filter: blur(10px);
  min-width: 120px;
  justify-content: center;
}

.refresh-btn:hover {
  background: rgba(0, 122, 255, 1);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4);
}

.refresh-btn:active {
  transform: translateY(0);
}

.refresh-btn:disabled {
  background: rgba(0, 122, 255, 0.5);
  cursor: not-allowed;
  transform: none;
}

.refresh-icon {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.refresh-btn:not(:disabled):hover .refresh-icon {
  transform: rotate(180deg);
}

.refresh-text {
  font-size: 0.85rem;
}

/* 深色模式下的刷新按钮 */
@media (prefers-color-scheme: dark) {
  .refresh-btn {
    background: rgba(0, 122, 255, 0.8);
  }
  
  .refresh-btn:hover {
    background: rgba(0, 122, 255, 0.9);
  }
  
  .refresh-btn:disabled {
    background: rgba(0, 122, 255, 0.4);
  }
}
