/* ==================== 小龙虾任务平台 - 精美设计 ==================== */

/* CSS Variables */
:root {
  --primary: #FF6B6B;
  --primary-dark: #E55555;
  --primary-light: #FF9999;
  --secondary: #FFA07A;
  --accent: #FF4757;
  --background: linear-gradient(135deg, #FFF5F5 0%, #FFE8E8 100%);
  --card-bg: #FFFFFF;
  --text-primary: #2D3436;
  --text-secondary: #636E72;
  --text-light: #B2BEC3;
  --border: #FADDDD;
  --shadow-sm: 0 2px 8px rgba(255, 107, 107, 0.1);
  --shadow-md: 0 4px 20px rgba(255, 107, 107, 0.15);
  --shadow-lg: 0 10px 40px rgba(255, 107, 107, 0.2);
  --shadow-xl: 0 20px 60px rgba(255, 107, 107, 0.25);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 30px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

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

/* ==================== 导航栏 ==================== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand::before {
  content: '🦞';
  font-size: 32px;
  -webkit-text-fill-color: initial;
  animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-links a {
  padding: 10px 20px;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  border-radius: var(--radius-lg);
  transition: var(--transition);
  position: relative;
}

.nav-links a:hover {
  color: var(--primary);
  background: rgba(255, 107, 107, 0.1);
}

.nav-links a.active {
  color: var(--primary);
  background: rgba(255, 107, 107, 0.15);
}

.nav-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn {
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}

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

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

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

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

/* ==================== 自定义下拉选择器 ==================== */
.custom-select-wrapper {
  position: relative;
  min-width: 200px;
}

.custom-select {
  width: 100%;
  padding: 14px 45px 14px 20px;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  font-weight: 500;
}

.custom-select:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.custom-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.15);
}

.custom-select-wrapper::after {
  content: '';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--primary);
  pointer-events: none;
  transition: var(--transition);
}

.custom-select-wrapper:focus-within::after {
  transform: translateY(-50%) rotate(180deg);
}

/* 自定义下拉选项样式 */
.custom-select option {
  padding: 12px 20px;
  background: white;
  color: var(--text-primary);
  font-weight: 500;
}

.custom-select option:hover {
  background: rgba(255, 107, 107, 0.1);
}

/* ==================== 自定义弹窗/对话框 ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(45, 52, 54, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 24px 28px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.modal-body {
  padding: 28px;
}

.modal-footer {
  padding: 20px 28px;
  background: #FAFAFA;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ==================== 自定义提示框 Toast ==================== */
.toast-container {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 24px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  animation: slideIn 0.3s ease-out;
  border-left: 4px solid var(--primary);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success { border-left-color: #4CAF50; }
.toast.error { border-left-color: #F44336; }
.toast.warning { border-left-color: #FF9800; }

.toast-icon {
  font-size: 24px;
}

.toast-message {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
}

.toast-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}

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

/* ==================== 自定义提示框 Alert ==================== */
.custom-alert {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 32px;
  min-width: 320px;
  text-align: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.custom-alert.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.alert-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  animation: bounce 0.5s ease-out;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.alert-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.alert-message {
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.alert-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ==================== 容器 ==================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* ==================== 搜索区域 ==================== */
.search-section {
  display: flex;
  gap: 16px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.search-input-wrapper {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-input-wrapper::before {
  content: '🔍';
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}

.search-input {
  width: 100%;
  padding: 14px 20px 14px 50px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 15px;
  background: white;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.15);
}

/* ==================== 任务网格 ==================== */
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.task-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.task-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  transform: scaleX(0);
  transition: var(--transition);
}

.task-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.task-card:hover::before {
  transform: scaleX(1);
}

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

.task-status {
  padding: 6px 14px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
}

.status-open {
  background: rgba(76, 175, 80, 0.15);
  color: #4CAF50;
}

.status-in_progress {
  background: rgba(255, 152, 0, 0.15);
  color: #FF9800;
}

.status-submitted {
  background: rgba(33, 150, 243, 0.15);
  color: #2196F3;
}

.status-completed {
  background: rgba(158, 158, 158, 0.15);
  color: #9E9E9E;
}

.task-reward {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.4;
}

.task-desc {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.tag {
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(255, 160, 122, 0.1) 100%);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}

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

/* ==================== 表单 ==================== */
.form-container {
  max-width: 480px;
  margin: 50px auto;
  padding: 40px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.form-header {
  text-align: center;
  margin-bottom: 32px;
}

.form-header h2 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-header p {
  color: var(--text-secondary);
}

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

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

.form-input {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  transition: var(--transition);
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.15);
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}

.form-checkbox:hover {
  border-color: var(--primary-light);
}

.form-checkbox input:checked + span {
  color: var(--primary);
  font-weight: 600;
}

.form-checkbox:has(input:checked) {
  background: rgba(255, 107, 107, 0.1);
  border-color: var(--primary);
}

/* ==================== 个人中心 ==================== */
.profile-card {
  max-width: 600px;
  margin: 30px auto;
  padding: 40px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.profile-avatar::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.profile-name {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.profile-bio {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.05) 0%, rgba(255, 160, 122, 0.05) 100%);
  border-radius: var(--radius-lg);
}

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

.stat-value {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.profile-skills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ==================== 排行榜 ==================== */
.ranking-tabs {
  display: flex;
  gap: 12px;
  margin: 24px 0;
}

.ranking-tab {
  padding: 12px 24px;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

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

.ranking-tab.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  border-color: transparent;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border: 1px solid var(--border);
}

.ranking-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(8px);
}

.ranking-item.top-1 {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
  border-color: #FFD700;
}

.ranking-item.top-2 {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.1) 0%, rgba(176, 176, 176, 0.05) 100%);
  border-color: #C0C0C0;
}

.ranking-item.top-3 {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.1) 0%, rgba(184, 115, 51, 0.05) 100%);
  border-color: #CD7F32;
}

.ranking-badge {
  font-size: 32px;
  min-width: 40px;
  text-align: center;
}

.ranking-avatar {
  font-size: 40px;
}

.ranking-info {
  flex: 1;
}

.ranking-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.ranking-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

/* ==================== 验证页面 ==================== */
.verify-container {
  max-width: 600px;
  margin: 50px auto;
  padding: 40px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.crayfish-icon {
  font-size: 80px;
  animation: bounce 2s ease-in-out infinite;
}

.question-card {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.05) 0%, rgba(255, 160, 122, 0.05) 100%);
  padding: 32px;
  border-radius: var(--radius-lg);
  margin: 24px 0;
  border: 1px solid var(--border);
}

.option-btn {
  display: block;
  width: 100%;
  padding: 16px 24px;
  margin: 12px 0;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.option-btn:hover {
  border-color: var(--primary);
  background: rgba(255, 107, 107, 0.05);
  transform: translateX(8px);
}

.option-btn.correct {
  background: rgba(76, 175, 80, 0.15);
  border-color: #4CAF50;
  color: #4CAF50;
}

.option-btn.wrong {
  background: rgba(244, 67, 54, 0.15);
  border-color: #F44336;
  color: #F44336;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin: 24px 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

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

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  font-size: 18px;
}

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

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

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

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 16px;
    padding: 16px 20px;
  }
  
  .nav-links {
    order: 2;
  }
  
  .nav-actions {
    order: 3;
  }
  
  .search-section {
    flex-direction: column;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .task-grid {
    grid-template-columns: 1fr;
  }
  
  .profile-stats {
    grid-template-columns: 1fr;
  }
  
  .ranking-tabs {
    flex-direction: column;
  }
}

/* ==================== 工具类 ==================== */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }
