/* ==========================================
   钓鱼日记 - 主样式文件
   Mobile-first Design
   ========================================== */

:root {
  --primary: #2E7D32;
  --primary-light: #4CAF50;
  --primary-dark: #1B5E20;
  --secondary: #1565C0;
  --accent: #FF9800;
  --background: #F5F5F5;
  --surface: #FFFFFF;
  --text-primary: #212121;
  --text-secondary: #757575;
  --divider: #E0E0E0;
  --error: #F44336;
  --success: #4CAF50;
  --warning: #FF9800;
  --gold: #FFD700;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
}

/* 页面隐藏 */
.hidden {
  display: none !important;
}

/* ==========================================
   登录页
   ========================================== */

#login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

#login-page .logo {
  font-size: 64px;
  margin-bottom: 16px;
}

#login-page h1 {
  color: white;
  font-size: 28px;
  margin-bottom: 8px;
}

#login-page .subtitle {
  color: rgba(255,255,255,0.8);
  margin-bottom: 40px;
}

.login-form {
  width: 100%;
  max-width: 320px;
}

.login-form input {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
}

.login-form .code-input {
  display: flex;
  gap: 8px;
}

.login-form .code-input input {
  flex: 1;
  margin-bottom: 0;
}

.code-input .btn-secondary {
  padding: 14px 16px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  white-space: nowrap;
}

.login-form .btn-primary {
  width: 100%;
  padding: 16px;
  margin-top: 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================
   首页
   ========================================== */

.home-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 20px;
  color: white;
}

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

.user-info .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.user-details {
  flex: 1;
}

.nickname {
  display: block;
  font-size: 18px;
  font-weight: 600;
}

.level {
  display: block;
  font-size: 13px;
  opacity: 0.9;
}

.exp-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}

.exp-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.exp-text {
  position: absolute;
  right: 0;
  top: -18px;
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}

/* 统计卡片 */
.stats-cards {
  display: flex;
  padding: 16px;
  gap: 12px;
}

.stat-card {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

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

/* 操作按钮 */
.action-buttons {
  display: flex;
  padding: 0 16px;
  gap: 12px;
}

.action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.action-btn:active {
  transform: scale(0.95);
}

.action-btn .icon {
  font-size: 28px;
}

.action-btn span:last-child {
  font-size: 14px;
  font-weight: 500;
}

.action-btn.checkin .icon { color: var(--primary); }
.action-btn.add-fish .icon { color: var(--secondary); }
.action-btn.achievements .icon { color: var(--gold); }

/* 最近动态 */
.recent-section {
  padding: 20px 16px;
}

.recent-section h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.activity-list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 100px;
}

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

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--divider);
  padding: 8px 0;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 20px;
}

.nav-item span:last-child {
  font-size: 11px;
}

/* ==========================================
   弹窗
   ========================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-content.large {
  max-height: 90vh;
}

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

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

.close-btn {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
}

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

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--divider);
}

/* 表单元素 */
.form-group {
  margin-bottom: 16px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  font-size: 16px;
}

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

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.location-info,
.weather-info {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background: var(--background);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.location-info .label,
.weather-info .label {
  color: var(--text-secondary);
}

.equipment-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.equipment-options label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--background);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin: 16px 0;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:active {
  opacity: 0.9;
}

/* 成就网格 */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.achievement-card {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: var(--background);
  border-radius: var(--radius);
  text-align: center;
}

.achievement-card.earned {
  background: linear-gradient(135deg, #FFF9C4 0%, #FFECB3 100%);
}

.achievement-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.3;
}

.achievement-card.earned .achievement-icon {
  opacity: 1;
}

.achievement-name {
  font-size: 12px;
  color: var(--text-primary);
}

.achievement-card:not(.earned) {
  filter: grayscale(1);
}

/* 响应式调整 */
@media (max-width: 360px) {
  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}