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

:root {
  --primary-color: #4CAF50;
  --primary-hover: #45a049;
  --danger-color: #f44336;
  --text-color: #333;
  --text-secondary: #666;
  --bg-color: #f5f5f5;
  --card-bg: #ffffff;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.6;
  min-height: 100vh;
}

.header {
  background: var(--card-bg);
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  flex-direction: column;
}

.logo {
  font-size: 28px;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 4px;
}

.slogan {
  font-size: 14px;
  color: var(--text-secondary);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.3s;
}

.btn-icon:hover {
  background: var(--bg-color);
}

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-color);
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px;
}

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

.section-header h2 {
  font-size: 22px;
}

.section-actions {
  display: flex;
  gap: 10px;
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  min-height: 300px;
}

.module-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
  box-shadow: var(--shadow);
}

.module-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

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

.module-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-color);
}

.module-version {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.module-description {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.3;
  max-height: 36px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.module-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-small.primary {
  background: var(--primary-color);
  color: white;
}

.btn-small.danger {
  background: var(--danger-color);
  color: white;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 80px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--text-color);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-large {
  max-width: 900px;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger-color);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.store-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.store-content {
  min-height: 400px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.module-store-item {
  background: var(--bg-color);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.module-info h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.module-info p {
  font-size: 13px;
  color: var(--text-secondary);
}

.module-ui {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
}

.input-group input,
.input-group textarea {
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  background: var(--card-bg);
  color: var(--text-color);
}

.input-group textarea {
  resize: vertical;
  min-height: 100px;
}

.file-upload {
  border: 2px dashed var(--border-color);
  padding: 30px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.file-upload:hover {
  border-color: var(--primary-color);
  background: rgba(76, 175, 80, 0.05);
}

.output-area {
  background: var(--bg-color);
  padding: 16px;
  border-radius: 8px;
  margin-top: 16px;
}

.output-item {
  margin-bottom: 12px;
}

.output-item:last-child {
  margin-bottom: 0;
}

.output-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.btn-execute {
  width: 100%;
  padding: 14px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 16px;
}

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

.btn-execute:disabled {
  background: var(--text-secondary);
  cursor: not-allowed;
}

.footer {
  text-align: center;
  padding: 30px;
  color: var(--text-secondary);
  font-size: 13px;
}

.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--text-color);
  color: var(--card-bg);
  padding: 14px 24px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

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

@media (max-width: 768px) {
  .header {
    padding: 15px;
  }

  .logo {
    font-size: 22px;
  }

  .slogan {
    font-size: 12px;
  }

  .main-content {
    padding: 15px;
  }

  .modules-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .modal-content {
    width: 95%;
    max-height: 90vh;
  }
}
