/** pages/wiki/index.wxss **/
.wiki-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #F4F6F0;
  position: relative;
  overflow: hidden;
}

.wiki-scroll-area {
  flex: 1;
  overflow-y: hidden; /* Scroll-view handles overflow */
  box-sizing: border-box;
}

/* Scroll-view inner content padding wrapper if needed, 
   but we can apply padding to children or use a wrapper view inside.
   Usually easier to apply padding to the items or a wrapper inside scroll-view. */

.search-section {
    padding: 24rpx 40rpx 0;
    margin-bottom: 32rpx;
}

.search-box-card {
    background: #fff;
    border-radius: 40rpx;
    padding: 16rpx 20rpx;
    box-shadow: 0 8rpx 24rpx rgba(85, 139, 47, 0.08); /* Green-tinted shadow */
}

/* Override TDesign Search */
.search-input-bg {
    background: #F4F6F0 !important; /* Light green-grey */
    border-radius: 32rpx !important;
    height: 80rpx !important;
}
.t-search__input-container {
    height: 80rpx !important;
}

/* Category Scroll */
.category-scroll {
    display: flex;
    white-space: nowrap;
    padding-left: 40rpx;
    margin-bottom: 40rpx;
    height: 88rpx; 
    width: 100%;
    box-sizing: border-box;
}

/* Hide scrollbar for webkit */
.category-scroll::-webkit-scrollbar {
  display: none;
}

.category-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 28rpx;
    height: 72rpx;
    background: #fff;
    border-radius: 36rpx;
    margin-right: 16rpx;
    font-size: 26rpx;
    color: #546E7A;
    font-weight: 600;
    box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.04);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    flex-shrink: 0;
    border: 2rpx solid transparent; /* Reserve border space */
}

.category-item:active {
    transform: scale(0.95);
}

.category-item.active {
    background: linear-gradient(135deg, #558B2F, #689F38);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6rpx 20rpx rgba(85, 139, 47, 0.3);
    border-color: #558B2F;
    transform: scale(1.02);
}

.wiki-list {
  display: flex;
  flex-direction: column;
  gap: 32rpx;
  padding: 0 40rpx;
}

.wiki-card {
  background: white;
  padding: 32rpx;
  border-radius: 48rpx;
  display: flex;
  align-items: center;
  gap: 36rpx;
  box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.03);
  transition: transform 0.1s;
}

.wiki-card:active {
    transform: scale(0.98);
}

.wiki-image {
  width: 140rpx; height: 140rpx;
  border-radius: 36rpx;
  overflow: hidden;
  box-shadow: 0 8rpx 20rpx rgba(0,0,0,0.1);
  flex-shrink: 0;
  background: #f0f0f0;
  position: relative;
}

.fav-icon-box {
  position: absolute;
  top: 10rpx;
  right: 10rpx;
  width: 56rpx;
  height: 56rpx;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.1);
}

.fav-icon-box:active {
  transform: scale(0.9);
  transition: transform 0.1s;
}
.wiki-image image { width: 100%; height: 100%; display: block; }
.wiki-image-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
}

.wiki-info { flex: 1; min-width: 0; }

.wiki-top { margin-bottom: 12rpx; }
.wiki-name { font-size: 34rpx; font-weight: 700; color: var(--text-main); display: block; margin-bottom: 4rpx; }
.scientific-name { font-size: 24rpx; color: #90A4AE; font-style: italic; font-family: serif; display: block; }

.tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8rpx; 
}

/* Loading Footer */
.loading-footer {
    padding: 40rpx;
    display: flex;
    justify-content: center;
    align-items: center;
}

.no-more-text {
    font-size: 24rpx;
    color: #CCC;
}

.empty-state {
    padding: 80rpx 0;
    text-align: center;
    color: #999;
    font-size: 28rpx;
}

/* Floating Action Buttons */
.floating-btns {
    position: fixed;
    bottom: 48rpx;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    gap: 24rpx;
    z-index: 11600;
}

.floating-btn {
    color: white;
    padding: 18rpx 28rpx;
    border-radius: 48rpx;
    display: flex;
    align-items: center;
    gap: 8rpx;
    font-size: 26rpx;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s ease;
    backdrop-filter: blur(12px);
}

.floating-btn:active {
    transform: scale(0.92);
}

.scan-btn {
    background: rgba(85, 139, 47, 0.92);
    box-shadow: 0 8rpx 28rpx rgba(85, 139, 47, 0.35);
}

.chat-btn {
    background: linear-gradient(135deg, rgba(21,101,192,0.92), rgba(25,118,210,0.92));
    box-shadow: 0 8rpx 28rpx rgba(21, 101, 192, 0.3);
}

.btn-emoji {
    font-size: 32rpx;
    line-height: 1;
}

/* Popup Styles */
.popup-content {
  background: white;
  border-radius: 48rpx 48rpx 0 0;
  padding: 48rpx 40rpx;
  padding-bottom: calc(48rpx + env(safe-area-inset-bottom));
}

.popup-header {
  text-align: center;
  margin-bottom: 16rpx;
}

.popup-title {
  font-size: 40rpx;
  font-weight: 800;
  background: linear-gradient(120deg, #33691E, #689F38);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.popup-subtitle {
  font-size: 26rpx;
  color: #9CA3AF;
  text-align: center;
  display: block;
  margin-bottom: 48rpx;
}

.upload-options-grid {
  display: flex;
  gap: 32rpx;
  justify-content: center;
  margin-bottom: 48rpx;
}

.upload-opt-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20rpx;
  background: #F4F6F0;
  border-radius: 32rpx;
  padding: 40rpx 24rpx;
  transition: all 0.2s;
}

.upload-opt-item:active {
  transform: scale(0.96);
  background: #F0F7EB;
}

.opt-icon-circle {
  width: 112rpx;
  height: 112rpx;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8rpx 24rpx rgba(0,0,0,0.06);
}

.upload-opt-item text {
  font-size: 28rpx;
  font-weight: 600;
  color: #374151;
}

.popup-footer {
  display: flex;
  justify-content: center;
  padding-top: 8rpx;
}

.popup-footer .cancel-btn {
  width: 100%;
  height: 88rpx;
  line-height: 88rpx;
  text-align: center;
  font-size: 32rpx;
  font-weight: 600;
  color: #6B7280;
  background: #F3F4F6;
  border-radius: 44rpx;
  border: none;
}

.popup-footer .cancel-btn:active {
  background: #E5E7EB;
}
