/* 主样式文件 */
:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #f9c74f;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --success-color: #4caf50;
    --danger-color: #f44336;
}

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

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

/* 导航栏样式 */
.navbar {
    background-color: var(--primary-color) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 36px;
    color: yellow !important;
}

.navbar-nav .nav-link {
    color: white !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--accent-color) !important;
    transform: translateY(-2px);
}

.search-form {
    max-width: 400px;
}

.search-input {
    border-radius: 20px 0 0 20px;
    border: none;
    padding: 0.5rem 1rem;
}

.search-btn {
    border-radius: 0 20px 20px 0;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background-color: var(--accent-color);
    color: var(--text-color);
}

/* 卡片样式 */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: auto; /* 内容超出max-height时显示滚动条 */
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    /* 关键：最小高度保证基础尺寸，最大高度限制上限 */
    min-height: 100px; /* 内容为空时，card至少100px高 */
    max-height: 500px; /* 内容过多时，card最高500px，超出部分滚动 */
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.card-img-top {
    height: 180px;
    object-fit: cover;
    background-color: #e9ecef;
}

.card-body {
    flex: 1;
    padding: 1rem;
}
.card-head-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: blue;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3); /* 加轻微阴影，避免和背景融合 */
}
.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3); /* 加轻微阴影，避免和背景融合 */
}

.card-text {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 软件详情页的完整描述 */
.software-description {
    /* 完全重置所有可能导致截断的样式 */
    display: block !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    -webkit-box-direction: unset !important;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: pre-wrap !important;
    max-height: none !important;
    line-height: 1.6 !important;
    font-size: 1rem !important;
    color: #333 !important;
    margin-bottom: 1rem !important;
}

/* 确保父容器不会限制高度 */
.card-body {
    max-height: none !important;
    overflow: visible !important;
}

/* 确保卡片本身不会限制高度 */
.card {
    max-height: none !important;
    overflow: visible !important;
}

.card-footer {
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

/* 按钮样式 */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: 20px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    border-radius: 20px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 分类标签 */
.category-badge {
    background-color: var(--accent-color);
    color: var(--text-color);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 500;
}

/* 统计信息 */
.stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #666;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* 首页样式 */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* 热门软件区域 */
.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--accent-color);
    display: inline-block;
}

.section { 
    margin-bottom: 3rem;
}

/* 软件详情页样式 */
.software-header {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.software-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.software-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 1rem;
    opacity: 0.9;
}

.software-images {
    margin-bottom: 2rem;
}

.software-images img {
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    object-fit: cover;
}

.download-links {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.download-link-item {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
    gap: 0.75rem;
}

.download-link-item:last-child {
    border-bottom: none;
}

.download-link-item:hover {
    background-color: #f8f9fa;
    transform: translateX(5px);
}

.download-link-info {
    flex-grow: 1;
    min-width: 0;
}

.download-link-info h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary-color);
    word-break: normal;
}

.download-link-info p {
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
    color: #444;
    word-break: break-all;
    white-space: pre-wrap;
    line-height: 1.4;
    background-color: rgba(0, 0, 0, 0.03);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

/* 确保下载按钮始终可见且对齐 */
.download-link-item a.btn,
.download-link-item button.btn {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0.25rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .download-link-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .download-link-item a.btn,
    .download-link-item button.btn {
        align-self: stretch;
        text-align: center;
        margin-top: 0.5rem;
    }
    
    .download-link-info p {
        font-size: 0.85rem;
    }
}

/* 评论区样式 */
.comments-section {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.comment-date {
    font-size: 0.8rem;
    color: #999;
}

.comment-content {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
}

/* 后台管理样式 */
.admin-sidebar {
    background-color: var(--primary-color);
    color: white;
    min-height: 100vh;
    padding: 1rem;
}

.admin-sidebar h3 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-nav {
    list-style: none;
    padding: 0;
}

.admin-nav li {
    margin-bottom: 0.5rem;
}

.admin-nav a {
    color: white;
    text-decoration: none;
    padding: 0.75rem 1rem;
    display: block;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.admin-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.admin-nav a.active {
    background-color: var(--secondary-color);
    font-weight: 500;
}

.admin-content {
    padding: 2rem;
    background-color: var(--light-bg);
}

.admin-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.admin-card h4 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 600;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    display: block;
}

.form-control {
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.75rem;
    width: 100%;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 111, 165, 0.25);
    outline: none;
}

.form-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

/* 页脚样式 */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer h5 {
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.footer ul {
    list-style: none;
    padding: 0;
}

.footer ul li {
    margin-bottom: 0.5rem;
}

.footer ul li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.footer ul li a:hover {
    color: var(--accent-color);
    padding-left: 5px;
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .card-img-top {
        height: 150px;
    }
    
    .software-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .download-link-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .admin-sidebar {
        min-height: auto;
        margin-bottom: 1rem;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* 加载状态 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    margin-left: 10px;
    animation: spin 1s linear infinite;
}

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