/* 全局样式 */
:root {
    --primary-color: #4CAF50;
    --primary-light: #81C784;
    --primary-dark: #388E3C;
    --secondary-color: #FFC107;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f9f9f9;
    --card-bg: #fff;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}


.search-container {
    position: relative;
    width: 300px;
}

.search-input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background-color: var(--primary-dark);
}


/* 英雄区域 */
.hero {
    height: 80vh;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://www.xmhky.com/images/bg.jpg') center/cover no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    padding: 2rem;
    position: relative;
    background-color: #4caf50;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease-out;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
    animation: fadeInUp 1s ease-out 0.2s both;
}

.cta-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    animation: fadeInUp 1s ease-out 0.4s both;
}

.cta-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* 分类筛选区域 */
.categories {
    padding: 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.categories h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
    font-size: 2rem;
}

.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.filter-btn {
    padding: 0.7rem 1.5rem;
    border: 2px solid var(--primary-color);
    background-color: transparent;
    color: var(--primary-color);
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* 花卉展示区域 */
.flowers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.flower-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.flower-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.flower-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: var(--transition);
}

.flower-card:hover .flower-image {
    transform: scale(1.05);
}

.flower-info {
    padding: 1.5rem;
}

.flower-name {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.flower-scientific {
    font-style: italic;
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.flower-description {
    color: var(--text-color);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.flower-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
}

.flower-season {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.flower-color {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

/* 花卉详情模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    width: 90%;
    max-width: 900px;
    border-radius: 10px;
    overflow: hidden;
    animation: slideIn 0.4s ease-out;
}

.modal-header {
    position: relative;
    height: 400px;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
    background-color: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-body {
    padding: 2rem;
}

.modal-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.modal-scientific {
    font-style: italic;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.modal-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.detail-item {
    margin-bottom: 1rem;
}

.detail-label {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
}

.modal-description {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.modal-care {
    background-color: #f5f5f5;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.modal-care h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.care-tips {
    list-style-type: none;
}

.care-tips li {
    margin-bottom: 0.8rem;
    position: relative;
    padding-left: 1.5rem;
}

.care-tips li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}


/* 页脚 */
footer {
    background-color: #333;
    color: white;
    padding: 1rem 2rem;
    text-align: center;
}

.footer-bottom {
    color: #aaa;
}

/* 加载动画 */
.loading {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
}

/* 动画定义 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .hero h1 {
        font-size: 3rem;
    }

    .modal-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    .search-container {
        width: 200px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

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

    .flowers-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        padding: 1rem;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .modal-header {
        height: 300px;
    }

    .modal-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {

    .search-container {
        display: none;
    }

    .hero {
        height: 70vh;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .categories,
    .flowers-grid {
        padding: 1rem;
    }

    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .flowers-grid {
        grid-template-columns: 1fr;
    }

    .modal-header {
        height: 200px;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-title {
        font-size: 1.8rem;
    }
}
