/* ============================================================
   collection.css — 海底基地养成系统样式 v1.0
   ============================================================ */

/* ---- 基地页面容器 ---- */
.base-page {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #0c4a6e 0%, #0369a1 30%, #075985 70%, #0c4a6e 100%);
  z-index: 100000;
  overflow-y: auto;
  display: none;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #fff;
}

.base-page.active {
  display: block;
  animation: baseFadeIn 0.3s ease;
}

@keyframes baseFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- 海底气泡装饰 ---- */
.base-bubbles {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.base-bubble {
  position: absolute;
  bottom: -20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  animation: bubbleUp linear infinite;
}

@keyframes bubbleUp {
  0% { transform: translateY(0) scale(1); opacity: 0.5; }
  100% { transform: translateY(-110vh) scale(0.5); opacity: 0; }
}

/* ---- 顶部栏 ---- */
.base-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(12, 74, 110, 0.95);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.base-header h2 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.base-close-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

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

.base-stars {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.4);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 16px;
}

.base-stars .star-icon { font-size: 18px; }

/* ---- Tab导航 ---- */
.base-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  position: sticky;
  top: 61px;
  background: rgba(12, 74, 110, 0.9);
  backdrop-filter: blur(10px);
  z-index: 9;
}

.base-tab {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.base-tab:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.base-tab.active {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #fff;
}

/* ---- 内容区 ---- */
.base-content {
  position: relative;
  z-index: 1;
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.base-panel {
  display: none;
}

.base-panel.active {
  display: block;
  animation: panelFadeIn 0.3s ease;
}

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

/* ---- 统计条 ---- */
.base-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.base-stat-card {
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
}

.base-stat-card .num {
  font-size: 24px;
  font-weight: 800;
  color: #fbbf24;
}

.base-stat-card .label {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}

/* ---- 队员墙 ---- */
.crew-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.crew-card {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  position: relative;
  transition: all 0.3s;
  cursor: pointer;
}

.crew-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.crew-card.locked {
  opacity: 0.6;
}

.crew-card.locked:hover {
  opacity: 0.8;
}

.crew-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  overflow: hidden;
  position: relative;
}

.crew-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.crew-card.locked .crew-avatar {
  filter: grayscale(1) brightness(0.5);
}

.crew-card.locked .crew-avatar::after {
  content: '🔒';
  position: absolute;
  font-size: 28px;
  filter: grayscale(0);
}

.crew-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.crew-role {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

.crew-progress {
  margin-top: 8px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.crew-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.crew-progress-text {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}

/* ---- 商店 ---- */
.shop-section {
  margin-bottom: 24px;
}

.shop-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-section-title .rarity-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 600;
}

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

.shop-item {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  transition: all 0.2s;
  position: relative;
}

.shop-item.owned {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
}

.shop-item:hover:not(.owned) {
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

.shop-item-emoji {
  font-size: 40px;
  margin-bottom: 8px;
  line-height: 1;
}

.shop-item-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.shop-item-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
  min-height: 16px;
}

.shop-item-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(251, 191, 36, 0.2);
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  color: #fbbf24;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.shop-item-price:hover:not(:disabled) {
  background: rgba(251, 191, 36, 0.35);
}

.shop-item-price:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shop-item.owned .shop-item-price {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.shop-item.active-vehicle {
  border-color: #0ea5e9;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

/* ---- 打卡 ---- */
.checkin-card {
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 20px;
}

.checkin-big-emoji {
  font-size: 60px;
  margin-bottom: 12px;
}

.checkin-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.checkin-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 16px;
}

.checkin-streak {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

.checkin-streak-item {
  text-align: center;
}

.checkin-streak-item .num {
  font-size: 28px;
  font-weight: 800;
  color: #fbbf24;
}

.checkin-streak-item .label {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.checkin-btn {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #78350f;
  border: none;
  padding: 14px 40px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.4);
  transition: all 0.2s;
}

.checkin-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.5);
}

.checkin-btn:disabled {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.5);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.checkin-bonus-info {
  margin-top: 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}

/* ---- 成就墙 ---- */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.achievement-card {
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  transition: all 0.2s;
}

.achievement-card.unlocked {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.4);
}

.achievement-emoji {
  font-size: 32px;
  margin-bottom: 8px;
  filter: grayscale(1) opacity(0.4);
}

.achievement-card.unlocked .achievement-emoji {
  filter: none;
}

.achievement-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}

.achievement-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

/* ---- 解锁弹窗 ---- */
.unlock-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.unlock-popup {
  background: linear-gradient(135deg, #0c4a6e, #0369a1);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  max-width: 340px;
  width: 90%;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.unlock-emoji {
  font-size: 80px;
  margin-bottom: 12px;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.unlock-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}

.unlock-name {
  font-size: 28px;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 8px;
}

.unlock-quote {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  font-style: italic;
  margin-bottom: 20px;
}

.unlock-btn {
  background: #fbbf24;
  color: #78350f;
  border: none;
  padding: 12px 32px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.unlock-btn:hover {
  background: #f59e0b;
  transform: scale(1.05);
}

/* ---- 基地入口按钮（在主页面上） ---- */
.base-enter-btn {
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border: 3px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  animation: floatBtn 3s ease-in-out infinite;
}

.base-enter-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 28px rgba(14, 165, 233, 0.6);
}

@keyframes floatBtn {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.base-enter-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ---- Toast提示 ---- */
.base-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  z-index: 300000;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- 响应式 ---- */
@media (max-width: 500px) {
  .crew-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .shop-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .crew-card { padding: 12px 8px; }
  .crew-avatar { width: 60px; height: 60px; font-size: 30px; }
  .base-content { padding: 12px; }
}
