/* 基础样式 */
:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --secondary: #2c3e50;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    --light-gray: #e9ecef;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 页眉 */
header {
    background-color: var(--secondary);
    color: white;
    padding: 30px 0;
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.site-desc {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* 导航 */
nav {
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

nav ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
}

nav li {
    position: relative;
}

nav a {
    display: block;
    padding: 15px 20px;
    color: var(--dark);
    text-decoration: none;
    transition: background-color 0.3s;
}

nav a:hover {
    background-color: var(--light);
}

.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 1;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    padding: 12px 16px;
}

/* 内容区域 */
.section-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-gray);
}

.category-title {
    font-size: 1.6rem;
    margin-bottom: 20px;
    color: var(--secondary);
}

/* 软件卡片 */
.software-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.software-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.software-header {
    padding: 15px 20px;
    background-color: var(--light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.software-header h3 {
    font-size: 1.3rem;
    color: var(--secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

/* 新增：软件图标容器 */
.software-icon-container {
    position: relative;
    background-color: #f5f5f5;
    border-bottom: 1px solid var(--light-gray);
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 修改分类标签样式 */
.category-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    z-index: 10;
}

.software-meta {
    padding: 10px 20px;
    background-color: #fcfcfc;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--gray);
}

.software-icon {
    width: 100%;
    height: 120px;
    object-fit: contain;
    background-color: #f5f5f5;
    padding: 10px;
    border-bottom: 1px solid var(--light-gray);
}

.software-desc {
    padding: 20px;
    font-size: 0.95rem;
    line-height: 1.7;
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    max-height: 100px; /* 4行高度 */
    transition: max-height 0.3s ease;
}

.software-desc.expanded {
    max-height: none;
}

.software-desc::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
    opacity: 1;
    transition: opacity 0.3s;
}

.software-desc.expanded::after {
    opacity: 0;
}

.toggle-desc {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 5px 0;
    font-size: 0.85rem;
    text-align: center;
    width: 100%;
    margin-top: 5px;
}

.toggle-desc:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* 首页下载按钮（绿色） */
.download-btn {
    display: block;
    background-color: var(--success);
    color: white;
    text-align: center;
    padding: 12px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s;
    margin-top: 10px;
    border-radius: 18px;
}

.download-btn:hover {
    background-color: #219653;
}

/* 后台专用下载按钮（蓝色） */
.admin-download-btn {
    display: inline-block;
    background-color: var(--primary);
    color: white;
    text-align: center;
    padding: 12px 0;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s;
    border: none;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    width: 100%;
    height: 42px; /* 与其他按钮统一高度（你也可以用 padding 控制） */
}

.admin-download-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

/* 新增：软件底部容器 */
.software-footer {
    margin-top: auto;
    padding: 0 20px 20px;
}

/* 软件编辑表单样式 */
.software-card form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.software-header .form-group,
.software-meta .form-group {
    margin-bottom: 5px;
}

.software-header .form-group input,
.software-header .form-group select {
    font-size: 1.1rem;
    font-weight: bold;
    height: auto;
}

.software-meta .form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.software-meta .form-group {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
}

.software-meta .form-group label {
    margin-bottom: 0;
    font-size: 0.9rem;
    white-space: nowrap;
}

.software-meta .form-group input {
    width: auto;
    padding: 3px 8px;
    font-size: 0.9rem;
}

.software-card textarea {
    resize: vertical;
    min-height: 100px;
    font-size: 0.95rem;
    line-height: 1.5;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.software-card input[type="url"] {
    font-size: 0.9rem;
    padding: 8px;
}

.btn {
    display: inline-block;
    padding: 12px 0;
    font-size: 0.9rem;
    border-radius: 18px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    width: 100%;
    border: none;
    height: 42px;
}


.btn-approve {
    background-color: var(--success);
    color: white;
}

.btn-approve:hover {
    background-color: #219653;
}

.btn-reject, .btn-delete {
    background-color: var(--danger);
    color: white;
}

.btn-reject:hover, .btn-delete:hover {
    background-color: #c0392b;
}

/* 表单样式 */
.submit-form, .login-box {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    max-width: 700px;
    margin: 0 auto 40px;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 5px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--secondary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.captcha-group {
    margin-top: 30px;
}

.captcha-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

#captcha-image {
    border: 1px solid #ddd;
    border-radius: 4px;
    height: 40px;
    cursor: pointer;
}

.refresh-btn {
    background-color: var(--light-gray);
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.refresh-btn:hover {
    background-color: #dee2e6;
}

.submit-btn, .login-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.3s;
    margin-top: 10px;
}

.submit-btn:hover, .login-btn:hover {
    background-color: var(--primary-dark);
}

/* 新增软件数量统计样式 */
.software-count {
    background-color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--secondary);
    display: flex;
    align-items: center;
}

.software-count p {
    margin: 0;
}

.software-count strong {
    color: var(--primary);
    font-size: 1.3rem;
    margin: 0 5px;
}

/* 警告信息 */
.alert {
    padding: 15px;
    margin-bottom: 25px;
    border-radius: 5px;
}

.alert-error {
    background-color: #fdecea;
    color: #e74c3c;
    border-left: 4px solid #e74c3c;
}

.alert-success {
    background-color: #e8f7f0;
    color: #27ae60;
    border-left: 4px solid #27ae60;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--gray);
}

.empty-state .btn {
    display: inline-block;
    background-color: var(--primary);
    color: white;
    padding: 10px 25px;
    text-decoration: none;
    border-radius: 5px;
}

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

/* 页脚 */
footer {
    background-color: var(--secondary);
    color: rgba(255, 255, 255, 0.7);
    padding: 30px 0;
    margin-top: 50px;
    text-align: center;
    font-size: 0.9rem;
}

footer p {
    margin: 5px 0;
}

/* 分类管理 */
.category-management {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.add-category {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--light-gray);
}

.add-category h3, .category-list h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--secondary);
}

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

.category-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--light-gray);
}

.category-list li:last-child {
    border-bottom: none;
}

.category-list .btn-delete {
    padding: 5px 10px;
    font-size: 0.85rem;
}

/* 站点设置 */
.site-settings {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    max-width: 700px;
    margin: 0 auto;
}

.site-settings h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--secondary);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--light-gray);
}

/* 新增：软件操作按钮容器 */
.software-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding: 0 20px 20px;
}

/* 修改下载按钮 */
.software-actions .admin-download-btn {
    padding: 8px 15px;
    font-size: 0.9rem;
    flex: 1;
    text-align: center;
    border-radius: 18px;
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
}

/* 修改操作按钮 */
.software-actions .btn {
    padding: 8px 15px;
    font-size: 0.9rem;
    flex: 1;
    text-align: center;
    border-radius: 18px;
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
}