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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f0f4f0;
    min-height: 100vh;
}

/* 首页大图背景区域 */
.hero-section {
    position: relative;
    min-height: 45vh;
    background: url('/static/images/bg.jpg') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.6) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1200px;
    padding: 40px 20px;
}

.hero-header {
    text-align: center;
    padding: 30px 20px;
    color: white;
}

.hero-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    letter-spacing: 4px;
}

.hero-header p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* 标题行 - 3D框和文字并排 */
.hero-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
}

/* 首页圆形3D展示框 */
.hero-3d-logo {
    width: 260px;
    height: 260px;
    overflow: visible;
    flex-shrink: 0;
    position: relative;
}

.hero-3d-logo::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    background: #000000;
    z-index: 1;
    pointer-events: none;
    transform: translate(-50%, -50%);
}

#hero3dCanvas {
    position: relative;
    z-index: 2;
    background: transparent;
    width: 100%;
    height: 100%;
}

.hero-text {
    text-align: center;
}

/* 主内容区 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    padding-bottom: 40px;
}

/* 搜索区域 */
.search-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin: -30px auto 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    position: relative;
    z-index: 10;
    max-width: 900px;
}

.search-box {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #40916c;
}

.filter-select {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    background: white;
    cursor: pointer;
    min-width: 140px;
    transition: border-color 0.3s;
}

.filter-select:focus {
    outline: none;
    border-color: #40916c;
}

/* 植物网格 */
.plant-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 40px;
}

/* 植物卡片 */
.plant-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative;
}

.plant-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

/* 3D模型容器 */
.model3d-container {
    width: 100%;
    height: 220px;
    background: #e8f5e9;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.model3d-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.model3d-placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    color: #2d6a4f;
}

.loading-text {
    font-size: 0.9rem;
    font-weight: 500;
}

.load-model-hint {
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

/* 默认图片占位 */
.mushroom-image {
    width: 100%;
    height: 220px;
    background: #e8f5e9;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 3D浏览按钮 */
.view-3d-btn {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.view-3d-btn:hover {
    transform: scale(1.05);
}

/* 卡片3D操作栏 */
.plant-card-3d-bar {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    background: #f8faf8;
    border-top: 1px solid #e8f5e9;
    border-bottom: 1px solid #f0f0f0;
}

.card-3d-btn {
    flex: 1;
    padding: 7px 10px;
    border-radius: 8px;
    border: none;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.card-3d-btn.edit {
    background: linear-gradient(135deg, #ff9a3c 0%, #ff6b35 100%);
    color: white;
}

.card-3d-btn.edit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(255, 107, 53, 0.3);
}

.card-3d-btn.browse {
    background: linear-gradient(135deg, #40916c 0%, #2d6a4f 100%);
    color: white;
}

.card-3d-btn.browse:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(45, 106, 79, 0.3);
}

.plant-card-body {
    padding: 20px;
}

.plant-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.plant-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1b4332;
    line-height: 1.3;
    flex: 1;
}

.plant-card-exhibit {
    font-size: 0.7rem;
    color: #888;
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 10px;
    font-family: monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

.plant-card-scientific {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-bottom: 10px;
}

.plant-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.plant-card-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag-family {
    background: #e8f5e9;
    color: #2d6a4f;
}

.tag-organ {
    background: #e3f2fd;
    color: #1565c0;
}

.detail-tag.tag-organ {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 500;
}

.plant-card-desc {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.plant-card-region-inline {
    font-size: 0.75rem;
    color: #888;
    margin-left: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* 卡片操作栏 */
.plant-card-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    border-top: 1px solid #f0f0f0;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    color: #888;
    cursor: default;
}

.action-item svg {
    flex-shrink: 0;
}

.action-count {
    font-size: 0.8rem;
    color: #666;
}

.like-btn {
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.like-btn:hover {
    color: #e53935;
}

.like-btn.liked {
    color: #e53935;
}

.like-btn.liked .action-count {
    color: #e53935;
}

.view-3d-badge {
    cursor: pointer;
    color: #40916c;
    font-weight: 500;
    transition: all 0.2s;
}

.view-3d-badge:hover {
    color: #2d6a4f;
}

/* 详情页统计栏 */
.detail-stats-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f8faf8;
    border-radius: 10px;
    flex-wrap: wrap;
}

.detail-stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #555;
}

.detail-stat-label {
    font-size: 0.8rem;
    color: #888;
}

.detail-stat-value {
    font-weight: 600;
    color: #333;
}

.detail-view-3d-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #40916c 0%, #2d6a4f 100%);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.detail-view-3d-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

/* 无结果 */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.no-results h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #555;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 40px 0;
}

.page-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    background: #40916c;
    color: white;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.page-btn:hover:not(:disabled) {
    background: #2d6a4f;
    transform: translateY(-1px);
}

.page-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.page-info {
    font-size: 15px;
    color: #555;
    font-weight: 500;
}

/* 底部统计 */
.footer-stats {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 0.9rem;
    border-top: 1px solid #e0e0e0;
    margin-top: 20px;
}

.stats-divider {
    margin: 0 15px;
    color: #ccc;
}

/* 版权 */
.footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 0.8rem;
}

.footer-content p {
    margin-bottom: 4px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.4rem;
    color: #1b4332;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #555;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-home-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #c8e6c9;
    background: #f0f4f0;
    color: #2d6a4f;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.modal-home-btn:hover {
    background: #e8f5e9;
    border-color: #40916c;
}

.modal-body {
    padding: 24px;
}

/* 详情页内容 */
.detail-top {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.detail-image-wrap {
    flex: 0 0 320px;
    border-radius: 12px;
    overflow: hidden;
    background: #f0f4f0;
}

.detail-image-wrap img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}

.detail-info {
    flex: 1;
}

.detail-info-row {
    margin-bottom: 12px;
}

.detail-info-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 3px;
}

.detail-info-value {
    font-size: 1rem;
    color: #333;
    line-height: 1.4;
}

.detail-info-value.scientific {
    font-style: italic;
    color: #555;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 1.05rem;
    color: #2d6a4f;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e8f5e9;
}

.detail-section p {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.7;
}

/* 3D预览区域 */
.preview-3d-wrap {
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    background: #f8faf8;
    border: 1px solid #e0e8e0;
}

.preview-3d-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1b4332;
    color: white;
}

.preview-3d-label {
    font-size: 0.9rem;
    font-weight: 600;
}

.preview-3d-hint {
    font-size: 0.78rem;
    opacity: 0.8;
}

.preview-3d-frame {
    width: 100%;
    height: 420px;
    background: #e8f5e9;
    position: relative;
    transition: all 0.3s ease;
}

.preview-3d-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.preview-3d-frame.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 3000;
    border-radius: 0;
}

.preview-3d-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e8e0;
}

.preview-action-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    background: #40916c;
    color: white;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-action-btn:hover {
    background: #2d6a4f;
    transform: translateY(-1px);
}

.preview-action-btn.secondary {
    background: #f0f4f0;
    color: #2d6a4f;
    border: 1px solid #c8e6c9;
}

.preview-action-btn.secondary:hover {
    background: #e8f5e9;
}

/* 详情信息网格 */
.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: #f8faf8;
    border-radius: 12px;
}

/* 模态框预览专用 */
.modal-content.modal-preview {
    max-width: 900px;
}

/* 器官类型徽章 - 植物名称右侧 */
.plant-card-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.plant-card-organ-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    background: #e3f2fd;
    color: #1565c0;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 元数据编辑按钮 */
.card-3d-btn.meta {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card-3d-btn.meta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

/* 编辑模态框 */
.edit-modal .modal-content {
    max-width: 720px;
}

.edit-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.edit-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.edit-form-group.full-width {
    grid-column: 1 / -1;
}

.edit-form-group label {
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
}

.edit-form-group input,
.edit-form-group textarea,
.edit-form-group select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.edit-form-group input:focus,
.edit-form-group textarea:focus,
.edit-form-group select:focus {
    outline: none;
    border-color: #40916c;
}

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

.edit-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.edit-btn-cancel {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    background: #f0f0f0;
    color: #555;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-btn-cancel:hover {
    background: #e0e0e0;
}

.edit-btn-save {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #40916c 0%, #2d6a4f 100%);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

.edit-btn-ai {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-btn-ai:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.edit-btn-ai:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 卡片底部小操作按钮 */
.card-mini-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
    align-items: center;
}

.card-mini-btn {
    padding: 3px 8px;
    border-radius: 5px;
    border: none;
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: white;
    line-height: 1;
}

.card-mini-btn.edit-mini {
    background: linear-gradient(135deg, #ff9a3c 0%, #ff6b35 100%);
}

.card-mini-btn.edit-mini:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.3);
}

.card-mini-btn.browse-mini {
    background: linear-gradient(135deg, #40916c 0%, #2d6a4f 100%);
}

.card-mini-btn.browse-mini:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(45, 106, 79, 0.3);
}

.card-mini-btn.meta-mini {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-mini-btn.meta-mini:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

/* 回到首页浮动按钮 */
.back-to-home {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #40916c 0%, #2d6a4f 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.back-to-home:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.back-to-home svg {
    flex-shrink: 0;
}

/* ============ 响应式 ============ */

/* 平板端：2列布局 */
@media (max-width: 1200px) {
    .plant-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手机端：单列布局 */
@media (max-width: 768px) {
    .hero-title-row {
        flex-direction: column;
        gap: 15px;
    }

    .hero-3d-logo {
        width: 140px;
        height: 140px;
        order: -1;
    }

    .hero-3d-logo::before {
        width: 120px;
        height: 120px;
    }

    .hero-header h1 {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

    .hero-header p {
        font-size: 1rem;
    }

    .search-section {
        margin: -20px 10px 20px;
        padding: 16px;
    }

    .search-box {
        flex-direction: column;
    }

    .search-input, .filter-select {
        width: 100%;
    }

    .plant-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .plant-card-image {
        height: 200px;
    }

    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-height: 92vh;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-header h2 {
        font-size: 1.15rem;
    }

    .modal-body {
        padding: 16px 20px;
    }

    .detail-top {
        flex-direction: column;
    }

    .detail-image-wrap {
        flex: none;
        width: 100%;
    }

    .detail-image-wrap img {
        height: 220px;
    }

    .detail-info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }

    .preview-3d-frame {
        height: 280px;
    }

    .preview-3d-header {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }

    .preview-3d-actions {
        flex-direction: column;
    }

    .pagination {
        gap: 12px;
    }

    .page-btn {
        padding: 8px 16px;
        font-size: 14px;
    }

    .footer-stats {
        font-size: 0.8rem;
    }

    .edit-form-grid {
        grid-template-columns: 1fr;
    }

    .plant-card-title-wrap {
        flex-wrap: wrap;
    }

    .back-to-home {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}
