* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 400px;
}

.login-box h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
  font-size: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

.form-group .help-text {
  font-size: 12px;
  color: #999;
  margin-top: 5px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #f0f0f0;
  color: #666;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-logout {
  background: transparent;
  color: #999;
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
}

.btn-logout:hover {
  background: #f5f5f5;
  color: #666;
}

.header {
  background: white;
  padding: 20px 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 20px;
  color: #333;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-info span {
  color: #666;
  font-size: 14px;
}

.container {
  display: flex;
  min-height: calc(100vh - 70px);
}

.sidebar {
  width: 220px;
  background: #2d3748;
  padding: 20px 0;
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  margin-bottom: 5px;
}

.sidebar ul li a {
  display: block;
  padding: 12px 25px;
  color: #a0aec0;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s;
}

.sidebar ul li a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar ul li a.active {
  background: #667eea;
  color: white;
}

.main-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
  padding: 25px;
  margin-bottom: 25px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.card-header h2 {
  font-size: 18px;
  color: #333;
}

.badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge.success {
  background: #dcfce7;
  color: #16a34a;
}

.badge.warning {
  background: #fef3c7;
  color: #d97706;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
}

.table td img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state .icon {
  font-size: 60px;
  margin-bottom: 15px;
}

.empty-state p {
  color: #999;
  font-size: 14px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 450px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #666;
}

.modal-body {
  padding: 25px;
}

.modal-footer {
  padding: 20px 25px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.file-upload {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.file-upload:hover {
  border-color: #667eea;
  background: #f8faff;
}

.file-upload-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.file-upload input {
  display: none;
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
}

.thumbnail-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.thumbnail-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.thumbnail-item .delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.thumbnail-item:hover .delete-btn {
  opacity: 1;
}

.thumbnail-item .delete-btn:hover {
  background: #ef4444;
}

.qrcode-preview {
  text-align: center;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
}

.qrcode-preview .type-badge {
  display: inline-block;
  padding: 6px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 20px;
  font-size: 13px;
  margin-bottom: 20px;
}

.qrcode-preview img {
  max-width: 250px;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.qrcode-preview p {
  margin-top: 15px;
  color: #666;
  font-size: 14px;
}

.info-box {
  background: #f8fafc;
  border-left: 4px solid #667eea;
  padding: 20px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 20px;
}

.info-box h4 {
  margin-bottom: 15px;
  color: #333;
}

.info-box ul {
  list-style: none;
}

.info-box ul li {
  padding: 8px 0;
  color: #666;
  font-size: 14px;
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 25px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  z-index: 2000;
  animation: slideIn 0.3s ease;
}

.toast.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.loading {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 14px;
}

/* ==================== 小程序码管理 ==================== */
.card-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qrcode-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.qrcode-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.3s;
}

.qrcode-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.qrcode-card-body {
  display: flex;
  padding: 20px;
  gap: 20px;
  align-items: flex-start;
}

.qrcode-cover {
  flex-shrink: 0;
  width: 120px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
}

.qrcode-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qrcode-img {
  flex-shrink: 0;
  text-align: center;
}

.qrcode-img img {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.qrcode-actions {
  margin-top: 8px;
}

.qrcode-info {
  flex: 1;
  min-width: 0;
}

.qrcode-info h4 {
  font-size: 16px;
  color: #1f2937;
  margin-bottom: 6px;
}

.qrcode-url {
  font-size: 13px;
  color: #667eea;
  word-break: break-all;
  margin-bottom: 6px;
}

.qrcode-scene {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 4px;
}

.qrcode-scene code {
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #374151;
}

.qrcode-time {
  font-size: 12px;
  color: #9ca3af;
}

.qrcode-card-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

/* Modal 宽版 */
.modal-lg {
  max-width: 560px;
}

/* 封面图上传区域 */
.cover-upload-area {
  cursor: pointer;
}

.cover-preview {
  min-height: 120px;
  border: 2px dashed #ddd;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: all 0.3s;
}

.cover-preview:hover {
  border-color: #667eea;
  background: #f8faff;
}

.cover-placeholder {
  text-align: center;
  color: #9ca3af;
}

.cover-placeholder span {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}

.cover-placeholder p {
  font-size: 13px;
}

.required {
  color: #ef4444;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    padding: 10px 0;
  }
  
  .sidebar ul {
    display: flex;
    flex-wrap: wrap;
  }
  
  .sidebar ul li a {
    padding: 10px 15px;
    border-radius: 6px;
    margin: 5px;
  }
  
  .main-content {
    padding: 15px;
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .table {
    overflow-x: auto;
  }
}
