/* components.css - 卡片、仪表盘、图表、地图、按钮样式 */

/* === 定位栏 === */
.location-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(10, 25, 41, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 188, 212, 0.15);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--accent-cyan);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.icon-btn:active {
  transform: scale(0.92);
  background: var(--bg-card-hover);
}

.location-info {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.location-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.location-coords {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* === 城市快捷选择 === */
.city-chips {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.city-chips::-webkit-scrollbar { display: none; }

.city-chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(0, 188, 212, 0.2);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}
.city-chip:active { transform: scale(0.95); }
.city-chip.active {
  background: rgba(0, 188, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* === 主内容区 === */
.main-content {
  padding: 0 12px;
  max-width: 600px;
  margin: 0 auto;
}

/* === 卡片 === */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0, 188, 212, 0.06);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* === 徽章 === */
.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.rising {
  background: rgba(0, 230, 118, 0.15);
  color: var(--tide-rising);
}
.badge.falling {
  background: rgba(255, 112, 67, 0.15);
  color: var(--tide-falling);
}
.badge.highSlack {
  background: rgba(255, 213, 79, 0.15);
  color: var(--accent-gold);
}
.badge.lowSlack {
  background: rgba(122, 156, 198, 0.15);
  color: var(--text-secondary);
}

/* === 潮汐图表 === */
.chart-container {
  position: relative;
  width: 100%;
  height: 240px;
  border-radius: var(--radius-md);
  overflow: hidden;
}
#tide-chart {
  width: 100%;
  height: 100%;
  display: block;
}

.tide-info-row {
  display: flex;
  justify-content: space-around;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 188, 212, 0.08);
}
.tide-info-item {
  text-align: center;
}
.tide-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.tide-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* === 钓鱼概率仪表盘 === */
.score-card {
  text-align: center;
}
.gauge-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 8px auto;
}
#score-gauge {
  width: 100%;
  height: 100%;
}
.gauge-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.score-value {
  display: block;
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.score-rating {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

/* === 评分明细 === */
.score-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 188, 212, 0.08);
}
.score-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.score-item-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 48px;
}
.score-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.score-item-value {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 28px;
  text-align: right;
}

/* === 月相 === */
.moon-info {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* === 日出日落 === */
.sun-card { padding: 14px 16px; }
.sun-row {
  display: flex;
  justify-content: space-around;
}
.sun-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sun-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.sun-time {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* === 24小时时间线 === */
.timeline-container {
  display: flex;
  gap: 2px;
  height: 100px;
  align-items: flex-end;
  padding-top: 20px;
  padding-bottom: 22px;
}
.timeline-bar {
  flex: 1;
  min-width: 0;
  border-radius: 3px 3px 0 0;
  position: relative;
  transition: height 0.4s ease, background 0.3s ease;
  cursor: pointer;
}
.timeline-bar.current {
  box-shadow: 0 0 8px rgba(0, 188, 212, 0.6);
}
.timeline-bar::after {
  content: attr(data-hour);
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: var(--text-muted);
}
.timeline-bar:nth-child(3n+1)::after {
  content: attr(data-hour);
}
.timeline-bar:not(:nth-child(3n+1))::after {
  content: '';
}

/* === 地图弹层 === */
.map-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}
.map-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid rgba(0, 188, 212, 0.15);
}
.map-overlay-header h3 {
  font-size: 1rem;
  color: var(--text-primary);
}
#map-container {
  flex: 1;
  width: 100%;
}
.map-info {
  padding: 12px 16px;
  background: var(--bg-card);
  border-top: 1px solid rgba(0, 188, 212, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#map-coords {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* === 按钮 === */
.btn-primary {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
  color: var(--bg-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-primary:active { transform: scale(0.96); }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* === 加载提示 === */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  background: rgba(10, 25, 41, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 188, 212, 0.15);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* === Leaflet 地图标记 === */
.tide-marker {
  background: none;
  border: none;
}
.marker-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 188, 212, 0.6);
  border: 2px solid var(--bg-primary);
}
.marker-dot.user {
  background: var(--accent-gold);
  box-shadow: 0 0 10px rgba(255, 213, 79, 0.8);
}

/* === Leaflet 暗色主题 === */
.leaflet-popup-content-wrapper {
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 188, 212, 0.2);
}
.leaflet-popup-tip {
  background: var(--bg-card);
}

/* === 响应式 === */
@media (min-width: 768px) {
  .main-content { max-width: 700px; }
  .chart-container { height: 300px; }
  .gauge-container { width: 220px; height: 220px; }
  .score-value { font-size: 3.2rem; }
}

/* === 日期选择栏 === */
.date-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid rgba(0, 188, 212, 0.08);
}
.date-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(0, 188, 212, 0.1);
  color: var(--accent-cyan);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.date-nav-btn:active { transform: scale(0.9); }
.date-display {
  flex: 1;
  text-align: center;
  position: relative;
}
#date-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}
.date-picker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.date-today-btn {
  padding: 4px 12px;
  border: 1px solid rgba(0, 188, 212, 0.3);
  border-radius: 12px;
  background: transparent;
  color: var(--accent-cyan);
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.date-today-btn:active { transform: scale(0.95); }

/* === 卡片头部右侧 === */
.card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.source-badge {
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(76, 175, 80, 0.15);
  color: #66bb6a;
}

/* === 海况信息 === */
.sea-conditions {
  display: flex;
  justify-content: space-around;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 188, 212, 0.08);
}
.sea-cond-item { text-align: center; }
.sea-cond-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.sea-cond-value {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

/* === 鱼种推荐 === */
.fish-card { padding-bottom: 8px; }
.fish-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fish-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: rgba(0, 188, 212, 0.04);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 188, 212, 0.06);
  transition: var(--transition);
}
.fish-item:active { background: rgba(0, 188, 212, 0.08); }
.fish-emoji {
  font-size: 1.8rem;
  line-height: 1.2;
  flex-shrink: 0;
}
.fish-info { flex: 1; min-width: 0; }
.fish-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.fish-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}
.fish-match {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.fish-match-bar {
  width: 48px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.fish-match-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}
.fish-match-score {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.fish-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.fish-tip {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  margin-top: 2px;
  opacity: 0.8;
}

/* === 渔获记录 === */
.catch-card { padding-bottom: 8px; }
.catch-add-btn {
  padding: 5px 14px;
  border: 1px solid var(--accent-cyan);
  border-radius: 14px;
  background: rgba(0, 188, 212, 0.1);
  color: var(--accent-cyan);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.catch-add-btn:active { transform: scale(0.95); }
.catch-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.catch-stat-item {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  background: rgba(0, 188, 212, 0.04);
  border-radius: var(--radius-sm);
}
.catch-stat-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-gold);
}
.catch-stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}
.catch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.catch-list::-webkit-scrollbar { width: 4px; }
.catch-list::-webkit-scrollbar-thumb { background: rgba(0, 188, 212, 0.2); border-radius: 2px; }
.catch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 188, 212, 0.04);
}
.catch-item-info { flex: 1; min-width: 0; }
.catch-item-fish {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.catch-item-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.catch-item-delete {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(244, 67, 54, 0.1);
  color: #ef5350;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.catch-item-delete:active { transform: scale(0.9); }
.catch-empty {
  text-align: center;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* === 设置入口 === */
.settings-entry {
  text-align: center;
  padding: 8px 0 24px;
}
.settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: 1px solid rgba(0, 188, 212, 0.15);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}
.settings-btn:active { transform: scale(0.96); }

/* === 弹层通用 === */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1500;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-content {
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid rgba(0, 188, 212, 0.1);
}
.modal-header h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid rgba(0, 188, 212, 0.1);
}
.modal-footer button { flex: 1; }

/* === 表单 === */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(0, 188, 212, 0.15);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.1);
}
textarea.form-input { resize: vertical; }
select.form-input { cursor: pointer; }

/* === 按钮 === */
.btn-secondary {
  padding: 10px 24px;
  border: 1px solid rgba(0, 188, 212, 0.2);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:active { transform: scale(0.96); }

/* === 设置弹层 === */
.settings-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(0, 188, 212, 0.06);
}
.settings-section:last-child { border-bottom: none; }
.settings-section h4 {
  font-size: 0.95rem;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}
.settings-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 8px;
}
.settings-link-row { margin-bottom: 12px; }
.settings-link {
  color: var(--accent-cyan);
  font-size: 0.8rem;
  text-decoration: none;
}
.settings-btn-row {
  display: flex;
  gap: 10px;
}
.settings-btn-row button { flex: 1; }
.api-status {
  margin-top: 8px;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: none;
}
.api-status.success {
  display: block;
  background: rgba(76, 175, 80, 0.1);
  color: #66bb6a;
}
.api-status.error {
  display: block;
  background: rgba(244, 67, 54, 0.1);
  color: #ef5350;
}

@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
  .modal-content { border-radius: 20px; }
}
