/* style.css - 设备报修系统样式文件（移动端优化） */

/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

/* 容器样式 */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 15px;
}

/* 卡片样式 */
.card {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  gap: 8px;
  width: 100%;
  margin-bottom: 12px;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:active {
  background-color: #0069d9;
  transform: scale(0.98);
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:active {
  background-color: #5a6268;
  transform: scale(0.98);
}

.btn-success {
  background-color: #28a745;
  color: white;
}

.btn-success:active {
  background-color: #218838;
  transform: scale(0.98);
}

/* 表单样式 */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #495057;
  font-size: 15px;
}

.form-input {
  width: 100%;
  padding: 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.15s ease-in-out;
  background-color: #f9f9f9;
}

.form-input:focus {
  outline: none;
  border-color: #007bff;
}

.form-textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.15s ease-in-out;
  background-color: #f9f9f9;
}

.form-textarea:focus {
  outline: none;
  border-color: #007bff;
}

/* 网格布局 */
.grid {
  display: grid;
  gap: 16px;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* 故障类型选择 */
.fault-types {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.fault-type {
  flex: 1;
  min-width: calc(50% - 6px);
  padding: 16px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #f8f9fa;
}

.fault-type:active {
  border-color: #007bff;
  background-color: #007bff;
  color: white;
}

.fault-type.active {
  border-color: #007bff;
  background-color: #007bff;
  color: white;
}

.fault-type-icon {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

/* 图片上传 */
.photo-uploader {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.photo-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  background-color: rgba(255, 0, 0, 0.8);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
}

.photo-add {
  width: 100px;
  height: 100px;
  border: 2px dashed #ddd;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #f8f9fa;
}

.photo-add:active {
  border-color: #007bff;
  background-color: #e7f3ff;
}

.photo-add-icon {
  font-size: 28px;
  color: #ccc;
  margin-bottom: 4px;
}

.photo-add-text {
  font-size: 12px;
  color: #999;
}

/* 导航栏 */
.navbar {
  background-color: #007bff;
  color: white;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-container {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
}

.navbar-brand {
  font-size: 18px;
  font-weight: bold;
  color: white;
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  gap: 16px;
  list-style: none;
}

.nav-link {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.nav-link.active {
  color: white;
  border-bottom: 2px solid white;
  padding-bottom: 4px;
}

/* 扫码区域 */
.scan-container {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 30px 15px;
  text-align: center;
  background-color: #f8f9fa;
}

.scan-video {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 8px;
  margin: 20px auto;
  display: block;
}

.scan-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 15px solid rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  pointer-events: none;
}

/* 记录列表 */
.records-list {
  margin-top: 20px;
}

.record-item {
  background-color: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.record-id {
  font-weight: bold;
  color: #007bff;
  font-size: 14px;
}

.record-status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-pending {
  background-color: #fff3cd;
  color: #856404;
}

.status-processing {
  background-color: #cce7ff;
  color: #004085;
}

.status-completed {
  background-color: #d4edda;
  color: #155724;
}

.status-cancelled {
  background-color: #f8d7da;
  color: #721c24;
}

/* 成功页面 */
.success-container {
  max-width: 100%;
  margin: 40px auto;
  text-align: center;
  background-color: white;
  border-radius: 12px;
  padding: 40px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.success-icon {
  font-size: 60px;
  color: #28a745;
  margin-bottom: 20px;
}

.success-title {
  font-size: 20px;
  font-weight: bold;
  color: #28a745;
  margin-bottom: 16px;
}

.success-message {
  font-size: 15px;
  color: #6c757d;
  margin-bottom: 30px;
  line-height: 1.6;
}

/* 加载动画 */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading-spinner {
  border: 4px solid rgba(0, 123, 255, 0.3);
  border-radius: 50%;
  border-top: 4px solid #007bff;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

/* 错误提示 */
.error-message {
  background-color: #f8d7da;
  color: #721c24;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  border-left: 4px solid #dc3545;
  font-size: 14px;
}

/* 成功提示 */
.success-message {
  background-color: #d4edda;
  color: #155724;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  border-left: 4px solid #28a745;
  font-size: 14px;
}

/* 标题样式 */
h1 {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

h2 {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 16px;
}

/* 通用样式 */
p {
  margin-bottom: 12px;
  color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 12px;
  }
  
  .card {
    padding: 16px;
  }
  
  .navbar-container {
    flex-direction: column;
    gap: 10px;
    padding: 0 12px;
  }
  
  .navbar-nav {
    width: 100%;
    justify-content: space-around;
  }
  
  .fault-types {
    justify-content: space-between;
  }
  
  .fault-type {
    flex: 1 1 calc(50% - 6px);
    padding: 12px;
  }
  
  .photo-item,
  .photo-add {
    width: 90px;
    height: 90px;
  }
  
  .btn {
    padding: 12px 20px;
    font-size: 15px;
  }
  
  h1 {
    font-size: 22px;
  }
  
  h2 {
    font-size: 16px;
  }
}
