/* =============================================
   Collection Page - 本草图鉴
   升级版：真实药材图片 + 国风水墨卡片
   ============================================= */

.collection-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.collection-title {
  font-size: 1rem;
  font-weight: 600;
}

/* Filters */
.collection-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.filter-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: #8B8B8B;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.filter-btn.active {
  background: var(--ink-dark);
  color: white;
  border-color: var(--ink-dark);
}

/* Collection Search */
.collection-search {
  margin-bottom: 10px;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: #2C2C2C;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
}

.search-input:focus {
  border-color: var(--ink-dark);
}

.search-input::placeholder {
  color: #B8B2A8;
}

/* Collection Grid — 三列网格 */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-bottom: 16px;
}

/* ===== 卡片基础 ===== */
.collection-card {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 6px 10px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

/* 解锁卡片 */
.collection-card.unlocked {
  border-color: var(--herb-green);
  box-shadow: 0 2px 10px rgba(107, 142, 78, 0.18);
}

.collection-card.unlocked:active {
  transform: scale(0.95);
}

/* 锁定卡片 */
.collection-card.locked {
  background: var(--ink-light);
  opacity: 0.6;
  filter: grayscale(0.3);
}

/* ===== 药材图片 ===== */
.collection-card .herb-image {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: contain;
  border: 2px solid var(--ink-light);
  box-shadow: 0 2px 8px var(--shadow);
  margin-bottom: 6px;
  background: var(--ink-light);
  display: block;
  flex-shrink: 0;
}

/* 锁定卡片图片模糊 */
.collection-card.locked .herb-image {
  filter: blur(5px) grayscale(0.5);
  opacity: 0.4;
}

/* ===== emoji回退 ===== */
.collection-card .herb-emoji {
  font-size: 1.8rem;
  display: block;
  text-align: center;
  margin-bottom: 4px;
  line-height: 1;
}

.collection-card.locked .herb-emoji {
  filter: grayscale(1);
  opacity: 0.4;
}

/* ===== 药材名称 ===== */
.collection-card .herb-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: #2C2C2C;
  text-align: center;
  line-height: 1.3;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-card.locked .herb-name {
  color: #B8B2A8;
}

/* ===== 拉丁学名 ===== */
.collection-card .herb-latin {
  font-size: 0.48rem;
  color: #B8B2A8;
  text-align: center;
  font-style: italic;
  line-height: 1.2;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

/* ===== 药性标签 ===== */
.collection-card .herb-nature {
  font-size: 0.55rem;
  padding: 2px 8px;
  border-radius: 8px;
  margin-top: 4px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.nature-cold {
  background: rgba(33, 150, 243, 0.12);
  color: #1565C0;
  border: 1px solid rgba(33, 150, 243, 0.2);
}

.nature-cool {
  background: rgba(33, 150, 243, 0.08);
  color: #1976D2;
  border: 1px solid rgba(33, 150, 243, 0.15);
}

.nature-neutral {
  background: rgba(255, 193, 7, 0.1);
  color: #F57F17;
  border: 1px solid rgba(255, 193, 7, 0.15);
}

.nature-warm {
  background: rgba(255, 87, 34, 0.1);
  color: #E65100;
  border: 1px solid rgba(255, 87, 34, 0.15);
}

.nature-hot {
  background: rgba(244, 67, 54, 0.1);
  color: #C62828;
  border: 1px solid rgba(244, 67, 54, 0.15);
}

/* ===== 锁定图标 ===== */
.collection-card .lock-icon {
  font-size: 1.5rem;
  opacity: 0.3;
  margin-top: 8px;
}

/* ===== 解锁状态国风底纹 ===== */
.collection-card.unlocked::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% 30%, rgba(107, 142, 78, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 20% 80%, rgba(201, 169, 110, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.collection-card > * {
  position: relative;
  z-index: 1;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  padding: 12px 24px;
  background: var(--ink-dark);
  color: var(--ink-paper);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 4px 16px var(--shadow-heavy);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(8px);
}

/* ===== 图片加载骨架屏 ===== */
.herb-image-loading {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(90deg,
    var(--ink-light) 25%,
    var(--ink-paper) 50%,
    var(--ink-light) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  margin-bottom: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
