/* ===== 全局样式 ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== 登录页 ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

/* 登录页底部备案号（固定悬挂在页面底部） */
.icp-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
}

.icp-footer a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}

.icp-footer a:hover,
.icp-footer a:active {
  color: #fff;
  text-decoration: underline;
}

.login-card .logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-card .logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: 20px;
  font-size: 36px;
  margin-bottom: 16px;
  box-shadow: 0 8px 16px rgba(37,99,235,0.3);
}

.login-card h1 {
  font-size: 22px;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.login-card .subtitle {
  font-size: 14px;
  color: var(--gray-400);
}

/* ===== 表单组件 ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--gray-800);
  background: #fff;
  transition: all 0.2s;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-outline {
  background: #fff;
  border: 2px solid var(--gray-200);
  color: var(--gray-700);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  z-index: 9999;
  transition: transform 0.3s ease;
  max-width: 90%;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast-success {
  background: var(--success);
  color: #fff;
}

.toast-error {
  background: var(--danger);
  color: #fff;
}

.toast-info {
  background: var(--primary);
  color: #fff;
}

/* ===== Staff 页面 ===== */
.staff-page {
  min-height: 100vh;
  background: var(--gray-50);
}

.header {
  background: linear-gradient(135deg, #1e40af, #2563eb);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header h2 {
  font-size: 18px;
  font-weight: 700;
}

.header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header .user-name {
  font-size: 14px;
  opacity: 0.9;
}

.header .btn-logout {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

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

.staff-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

.form-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.form-card h3 {
  font-size: 16px;
  color: var(--gray-700);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gray-100);
}

/* ===== 图片上传 ===== */
.photo-upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--gray-50);
}

.photo-upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.photo-upload-area .upload-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.photo-upload-area .upload-text {
  font-size: 15px;
  color: var(--gray-500);
}

.photo-upload-area .upload-hint {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 4px;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--gray-200);
}

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

.photo-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(220,38,38,0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.photo-item .remove-btn:hover {
  background: var(--danger);
}

/* 处置结果选择 */
.disposition-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.disposition-option {
  position: relative;
  cursor: pointer;
}

.disposition-option input {
  position: absolute;
  opacity: 0;
}

.disposition-option .option-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-500);
  transition: all 0.2s;
  text-align: center;
}

.disposition-option input:checked + .option-box {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.disposition-option .option-box.return-icon {
  border-color: var(--gray-200);
}

.disposition-option input:checked + .option-box.return-icon {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}

.disposition-option .option-box.temp-icon {
  border-color: var(--gray-200);
}

.disposition-option input:checked + .option-box.temp-icon {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}

/* ===== Admin 页面 ===== */
.admin-page {
  min-height: 100vh;
  background: var(--gray-50);
}

.admin-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

.filter-bar {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.filter-bar h3 {
  font-size: 16px;
  color: var(--gray-700);
  margin-bottom: 16px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.filter-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-actions .btn {
  flex: 1;
  min-width: 120px;
}

/* 表格 */
.records-table-wrap {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
}

.records-table th {
  background: var(--gray-100);
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-600);
  white-space: nowrap;
  border-bottom: 2px solid var(--gray-200);
}

.records-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.records-table tr:hover {
  background: var(--gray-50);
}

.records-table .photo-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.records-table .photo-thumb {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--gray-200);
  transition: transform 0.2s;
}

.records-table .photo-thumb:hover {
  transform: scale(1.1);
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.tag-return {
  background: var(--danger-light);
  color: var(--danger);
}

.tag-temp {
  background: var(--success-light);
  color: var(--success);
}

.tag-admin {
  background: var(--primary-light);
  color: var(--primary);
}

.tag-staff {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* 用户管理操作按钮 */
.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.btn-link:hover {
  background: var(--primary-light);
}

.btn-link.danger {
  color: var(--danger);
}

.btn-link.danger:hover {
  background: var(--danger-light);
}

/* 用户表格内边距紧凑一些 */
.user-table th,
.user-table td {
  padding: 10px 12px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* 移动端表格卡片化 */
@media (max-width: 768px) {
  .records-table-wrap {
    background: transparent;
    box-shadow: none;
  }

  .records-table thead {
    display: none;
  }

  .records-table,
  .records-table tbody,
  .records-table tr,
  .records-table td {
    display: block;
    width: 100%;
  }

  .records-table tr {
    background: #fff;
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 8px 0;
    box-shadow: var(--shadow-sm);
  }

  .records-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
  }

  .records-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--gray-500);
    font-size: 13px;
    flex-shrink: 0;
    margin-right: 12px;
  }

  .records-table td[data-label="车辆照片"] {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* 灯箱 */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.lightbox.show {
  display: flex;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
}

.lightbox .close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* 设置弹窗 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 18px;
  margin-bottom: 20px;
  color: var(--gray-800);
}

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

.stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 120px;
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-card .stat-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

.stat-card.return .stat-num {
  color: var(--danger);
}

.stat-card.temp .stat-num {
  color: var(--success);
}

/* ===== 秩序员记录查询弹窗 ===== */
.records-modal {
  max-width: 560px;
  display: flex;
  flex-direction: column;
}

.records-search {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.records-search .form-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 15px;
}

.records-search .form-select {
  width: 120px;
  flex-shrink: 0;
  padding: 10px 30px 10px 12px;
  font-size: 14px;
}

.records-summary {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 10px;
}

.record-list {
  flex: 1;
  overflow-y: auto;
  max-height: 55vh;
  min-height: 120px;
}

.record-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.record-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

.record-card-head .record-plate {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: 1px;
}

.record-card-body .record-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  padding: 3px 0;
}

.record-card-body .record-meta span {
  color: var(--gray-400);
  flex-shrink: 0;
}

.record-card-body .record-meta b {
  color: var(--gray-700);
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

.record-photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--gray-200);
}

.photo-thumb-sm {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--gray-200);
  transition: transform 0.2s;
}

.photo-thumb-sm:hover {
  transform: scale(1.08);
}

/* 加载动画 */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-overlay.show {
  display: flex;
}

.loading-overlay .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
