/* ===== 创意项目平台 - Styles ===== */
:root {
  --primary: #667eea;
  --primary-dark: #5a6fd6;
  --gradient-start: #667eea;
  --gradient-end: #764ba2;
  --bg: #f5f7fb;
  --card-bg: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 24px rgba(102, 126, 234, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

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

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

/* ===== Header / Navbar ===== */
.navbar {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.navbar-brand {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.navbar-brand .logo-icon {
  font-size: 26px;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar-links a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
  cursor: pointer;
}

.navbar-links a:hover,
.navbar-links a.active {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.navbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  object-fit: cover;
  background: rgba(255,255,255,0.2);
}

.navbar-username {
  font-size: 14px;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-login {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

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

/* ===== Page Container ===== */
.page {
  display: none;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Home Page ===== */
.home-header {
  text-align: center;
  padding: 40px 0 10px;
}

.home-header h1 {
  font-size: 28px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.home-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* Search Bar */
.search-bar {
  display: flex;
  max-width: 500px;
  margin: 20px auto;
  background: var(--card-bg);
  border-radius: 25px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 20px;
  font-size: 14px;
  background: transparent;
}

.search-bar button {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  border: none;
  padding: 12px 24px;
  cursor: pointer;
  font-size: 14px;
  transition: opacity 0.2s;
}

.search-bar button:hover {
  opacity: 0.9;
}

/* Toolbar Card */
.toolbar-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 20px 12px;
  margin: 0 auto 24px;
  max-width: 700px;
}
.toolbar-card .search-bar {
  margin: 0 auto;
}

/* Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0 0;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.filter-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-tab.active {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  border-color: transparent;
}

/* Project Grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.project-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.project-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.project-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.project-card-author {
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-card-author .author-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}

/* ===== Badges & Tags ===== */
.tech-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  background: #eef2ff;
  color: var(--primary-dark);
  font-weight: 500;
}

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

.coop-badge.type-1 {
  background: #fef3c7;
  color: #d97706;
}

.coop-badge.type-2 {
  background: #dbeafe;
  color: #2563eb;
}

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

.status-badge.status-0 { background: #f3f4f6; color: #9ca3af; }
.status-badge.status-1 { background: #fef3c7; color: #d97706; }
.status-badge.status-2 { background: #fce7f3; color: #db2777; }
.status-badge.status-3 { background: #e0e7ff; color: #4338ca; }
.status-badge.status-4 { background: #d1fae5; color: #059669; }
.status-badge.status-5 { background: #dbeafe; color: #2563eb; }
.status-badge.status-6 { background: #d1fae5; color: #059669; }
.status-badge.status--1 { background: #fee2e2; color: #dc2626; }

/* ===== Progress Bar ===== */
.progress-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.progress-bar.stopped {
  text-align: center;
  color: #dc2626;
  font-weight: 600;
  font-size: 14px;
}
.progress-bar.draft {
  text-align: center;
  color: var(--text-light);
  font-weight: 500;
  font-size: 14px;
}
.progress-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 52px;
  position: relative;
  z-index: 1;
}
.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: #f3f4f6;
  border: 2px solid #e5e7eb;
  color: var(--text-light);
  transition: all 0.3s;
}
.step.done .step-dot {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
  font-size: 14px;
}
.step.active .step-dot {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}
.step.active.pulsing .step-dot {
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(102, 126, 234, 0.1); }
}
.step-label {
  font-size: 10px;
  color: var(--text-light);
  text-align: center;
  white-space: nowrap;
  font-weight: 500;
}
.step.active .step-label {
  color: var(--primary);
  font-weight: 600;
}
.step.done .step-label {
  color: #10b981;
}
.progress-line {
  flex: 0 0 auto;
  width: calc(100% / 5);
  height: 3px;
  background: #e5e7eb;
  align-self: center;
  margin: 0 -2px;
  z-index: 0;
  position: relative;
  top: -14px;
}
.progress-line.filled {
  background: #10b981;
}

/* ===== Stage Tabs ===== */
.stage-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.stage-tab {
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.stage-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.stage-tab.active {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  border-color: transparent;
  color: #fff;
}
.current-stage-label {
  font-size: 11px;
  color: var(--text-light);
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Message / Chat ===== */
.message-section {
  padding: 16px;
}
.message-panel {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.message-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px 0;
  scroll-behavior: smooth;
}
.msg-empty {
  text-align: center;
  color: var(--text-light);
  padding: 24px;
  font-size: 13px;
}
.msg-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: flex-start;
}
.msg-row.self {
  flex-direction: row-reverse;
}
.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.self-avatar {
  background: #eef2ff;
}
.admin-avatar {
  background: #fef3c7;
}
.msg-content-wrapper {
  max-width: 75%;
}
.msg-name {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 3px;
}
.msg-row.self .msg-name {
  text-align: right;
}
.msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg-bubble.self {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-bubble.admin {
  background: #f3f4f6;
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.msg-time {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 3px;
}
.msg-row.self .msg-time {
  text-align: right;
}
.message-input-area {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.message-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
  min-height: 40px;
  max-height: 100px;
}
.message-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ===== Unread Dot ===== */
.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  animation: pulse 2s infinite;
}

/* ===== Detail Page ===== */
.detail-container {
  max-width: 800px;
  margin: 0 auto;
}

.detail-header {
  margin-bottom: 24px;
}

.detail-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.detail-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.detail-section .section-icon {
  margin-right: 6px;
}

.detail-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.coop-info {
  background: #f0f4ff;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-primary);
  border-left: 3px solid var(--primary);
}

.coop-info .coop-label {
  font-weight: 600;
  margin-bottom: 4px;
}

.free-note {
  margin-top: 12px;
  padding: 12px 16px;
  background: #f0fdf4;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #059669;
  border-left: 3px solid #10b981;
}

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

/* ===== Create/Edit Page ===== */
.create-container {
  max-width: 640px;
  margin: 0 auto;
}

.create-container h2 {
  font-size: 22px;
  margin-bottom: 24px;
  text-align: center;
}

.form-group {
  margin-bottom: 20px;
}

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

.form-group label .required {
  color: #ef4444;
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--card-bg);
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.form-control::placeholder {
  color: var(--text-light);
}

/* Tech Stack Input */
.tag-input-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: var(--card-bg);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 44px;
  cursor: text;
  transition: border-color 0.2s;
}

.tag-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: #eef2ff;
  border-radius: 12px;
  font-size: 12px;
  color: var(--primary-dark);
}

.tag-item .tag-remove {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-light);
  line-height: 1;
}

.tag-item .tag-remove:hover {
  color: #ef4444;
}

.tag-input-field {
  border: none;
  outline: none;
  flex: 1;
  min-width: 80px;
  font-size: 14px;
  padding: 4px 0;
  background: transparent;
}

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

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

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

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
}

/* ===== User Center ===== */
.user-container {
  max-width: 640px;
  margin: 0 auto;
}

.user-profile {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.user-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
  border: 3px solid var(--primary);
}

.user-nickname {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.user-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 16px;
}

.user-stat {
  text-align: center;
}

.user-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.user-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.btn-logout {
  display: block;
  margin: 16px auto 0;
  padding: 8px 24px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #ef4444;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-logout:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.btn-explore {
  display: block;
  margin: 12px auto 0;
  padding: 8px 20px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-explore:hover {
  opacity: 0.9;
}

.user-projects-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

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

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 40px 32px 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

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

.modal-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.btn-wechat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #07c160;
  color: #fff;
  padding: 12px 32px;
  border-radius: 25px;
  border: none;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-wechat:hover {
  background: #06ad56;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
}

.btn-wechat .wechat-icon {
  font-size: 22px;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--card-bg);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  font-size: 14px;
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  max-width: 400px;
}

.toast.success {
  border-left: 3px solid #10b981;
}

.toast.error {
  border-left: 3px solid #ef4444;
}

.toast.info {
  border-left: 3px solid var(--primary);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.loading-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}

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

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

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

.empty-state p {
  font-size: 14px;
}

/* ===== Back Button ===== */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 20px;
  background: none;
  border: none;
  padding: 4px 0;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .navbar {
    padding: 0 12px;
  }
  
  .navbar-brand {
    font-size: 17px;
  }
  
  .navbar-links a {
    font-size: 13px;
    padding: 4px 10px;
  }
  
  .navbar-username {
    display: none;
  }
  
  .page {
    padding: 16px 12px 40px;
  }
  
  .home-header {
    padding: 24px 0 0;
  }
  
  .home-header h1 {
    font-size: 22px;
  }
  
  .project-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .detail-title {
    font-size: 20px;
  }
  
  .detail-section {
    padding: 16px;
  }
  
  .create-container h2 {
    font-size: 18px;
  }
  
  .user-avatar {
    width: 64px;
    height: 64px;
  }
  
  .user-stats {
    gap: 20px;
  }
  
  .modal {
    padding: 32px 20px 24px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1025px) {
  .project-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== Tech Stack Selector ===== */
.tech-stack-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-option {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.tech-option:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tech-option.selected {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  border-color: transparent;
}

/* ===== 合作模式选择 ===== */
.coop-options {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.coop-option {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.coop-option:hover {
  border-color: var(--primary);
}
.coop-option.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(102,126,234,0.08), rgba(118,75,162,0.08));
}
.coop-option-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.coop-option-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.coop-option.selected .coop-option-title {
  color: var(--primary);
}

/* ===== Footer ===== */
.hidden { display: none !important; }

.site-footer {
  background: #f8f9fa;
  border-top: 1px solid #e5e7eb;
  padding: 32px 20px 24px;
  margin-top: 40px;
}

.footer-content {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.footer-top {
  display: inline-block;
  text-align: left;
  margin-bottom: 16px;
}

.footer-brand {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.footer-links {
  display: flex;
  gap: 20px;
  justify-content: flex-start;
}

.footer-links a {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
}

.footer-links a:hover {
  text-decoration: underline;
}

.footer-legal {
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.8;
  margin-bottom: 12px;
}

.footer-copy {
  font-size: 12px;
  color: #c0c4cc;
}

/* ===== QR Code Login ===== */
.qr-login-area {
  text-align: center;
  margin: 16px 0;
}

.qr-login-area img {
  width: 160px;
  height: 160px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  padding: 8px;
  background: #fff;
}

.qr-login-hint {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 8px;
}

.qr-login-hint .highlight {
  color: var(--primary);
  font-weight: 500;
}

/* ===== 管理后台 ===== */
.admin-container {
  max-width: 800px;
  margin: 0 auto;
}
.admin-container h2 {
  margin: 16px 0;
  font-size: 22px;
}
.admin-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.admin-stat {
  flex: 1;
  min-width: 80px;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.admin-stat-num {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}
.admin-stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.admin-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.admin-filter-btn {
  padding: 6px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.admin-filter-btn.active {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  border-color: transparent;
}
.admin-project-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.admin-project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}
.admin-project-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-project-summary {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.4;
}
.admin-project-author {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 10px;
}
.admin-project-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.admin-action-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.admin-action-btn:hover {
  opacity: 0.8;
}
.admin-link {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
  cursor: pointer;
}
.admin-link:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* ===== 沟通面板 ===== */
.msg-section {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}
.msg-toggle-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: #f9fafb;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.2s;
}
.msg-toggle-header:hover {
  background: #f0f1f3;
}
.msg-toggle-label {
  flex: 1;
}
.detail-msg-panel {
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
.msg-loading {
  padding: 20px;
  text-align: center;
  color: #999;
  font-size: 13px;
}
.msg-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 20px 0;
}
.msg-row {
  display: flex;
  gap: 8px;
  max-width: 85%;
}
.msg-row.self {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-row.admin {
  align-self: flex-start;
}
.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.self-avatar {
  background: #dbeafe;
}
.admin-avatar {
  background: #fef3c7;
}
.msg-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.msg-name {
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 1px;
}
.msg-bubble {
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.msg-bubble.self {
  background: #dbeafe;
  color: #1e40af;
  border-bottom-right-radius: 4px;
}
.msg-bubble.admin {
  background: #f3f4f6;
  color: #374151;
  border-bottom-left-radius: 4px;
}
.msg-time {
  font-size: 11px;
  color: #d1d5db;
}
.msg-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}
.msg-input {
  flex: 1;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
  font-family: inherit;
}
.msg-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}
.msg-send-btn {
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  align-self: flex-end;
  white-space: nowrap;
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.msg-send-btn:hover {
  opacity: 0.9;
}
.msg-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== 阶段tab ===== */
.stage-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}
.stage-tabs::-webkit-scrollbar { display: none; }
.stage-tab {
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.stage-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.stage-tab:hover {
  border-color: var(--primary);
}

/* ===== 管理回复按钮 ===== */
.admin-msg-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #3b82f6;
  background: #fff;
  color: #3b82f6;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.admin-msg-btn:hover {
  background: #eff6ff;
}

.admin-del-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #ef4444;
  background: #fff;
  color: #ef4444;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  margin-left: auto;
}
.admin-del-btn:hover {
  background: #fef2f2;
}

/* ===== 宽弹窗 ===== */
.modal-wide {
  max-width: 520px;
  padding: 0;
}
.modal-wide .modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
}
.modal-wide .modal-title {
  padding: 16px 20px 12px;
  margin: 0;
  font-size: 16px;
}
.admin-reply-body {
  padding: 0;
}
.admin-reply-body .msg-list {
  max-height: 350px;
}

/* ===== 签名板 ===== */
.sign-modal-body {
  padding: 0 20px 20px;
}
.sign-hint {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 12px;
  text-align: center;
}
.sign-pad-wrapper {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  margin-bottom: 12px;
}
#signCanvas {
  display: block;
  width: 100%;
  height: 160px;
  cursor: crosshair;
  touch-action: none;
}
.sign-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ===== 签名状态 ===== */
.sign-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  border-radius: 10px;
  text-align: center;
  gap: 8px;
}
.sign-status.signed {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.sign-status.unsigned {
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.sign-status-icon {
  font-size: 28px;
}
.sign-preview {
  margin-top: 8px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  transition: box-shadow 0.2s;
}
.sign-preview:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.sign-img {
  max-height: 60px;
  display: block;
}

/* ===== 签名大图预览 ===== */
.sign-preview-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}
.sign-preview-modal {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 90vw;
  max-height: 80vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.sign-preview-modal img {
  max-width: 100%;
  max-height: 60vh;
  display: block;
}
.sign-preview-close {
  position: absolute;
  top: 8px;
  right: 14px;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  line-height: 1;
}
.sign-preview-close:hover {
  color: #111;
}

/* ===== 管理签名状态 ===== */
.admin-project-sign {
  margin-bottom: 8px;
}
