body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

.container {
    width: 80%;
    max-width: 1200px; /* 增加最大宽度限制 */
    margin: 0 auto;
    padding: 20px 0;
}

header {
    background-color: #333;
    color: #fff;
    padding: 10px 0;
    border-bottom: 5px solid #007bff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px; /* 内部留白 */
}

header h1 {
    margin: 0;
    display: inline-block;
    font-size: 1.8em;
}

header h1 a {
    color: #fff;
    text-decoration: none;
}

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

nav ul li {
    display: inline;
    margin-left: 20px;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: #007bff;
}

main {
    padding: 20px 0;
    background-color: #fff;
    min-height: calc(100vh - 150px); /* 确保内容区撑开，减去 header/footer 高度 */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px; /* main 和 footer 之间的间距 */
}

main .container {
    padding: 20px; /* 内部留白 */
}

h2 {
    color: #007bff;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
}

/* Home Page Specifics */
.hero-section {
    text-align: center;
    padding: 50px 20px;
    background: linear-gradient(to right, #e0f2f7, #c1e4f4);
    border-radius: 8px;
    margin-bottom: 40px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.hero-section h2 {
    font-size: 2.5em;
    color: #0056b3;
    margin-bottom: 15px;
}

.hero-section p {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 20px;
}

.hero-section .btn {
    font-size: 1.1em;
    padding: 12px 25px;
}

.features-section {
    padding: 30px 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.features-section h3 {
    text-align: center;
    color: #007bff;
    margin-bottom: 25px;
    font-size: 1.8em;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.features-section ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.features-section ul li {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px 20px;
    width: 250px;
    text-align: center;
    font-size: 1em;
    color: #444;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

/* IPA Grid (Download Page) */
.ipa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.ipa-card {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.ipa-icon {
    width: 100px;
    height: 100px;
    border-radius: 15px;
    margin-bottom: 10px;
    object-fit: contain; /* 确保图标完整显示 */
}

.ipa-card h3 {
    font-size: 1.2em;
    margin: 10px 0;
    color: #333;
}

.ipa-card p {
    font-size: 0.9em;
    color: #666;
    margin: 5px 0;
}

.btn {
    display: inline-block;
    background-color: #007bff;
    color: #fff;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    margin-top: 10px;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: #0056b3;
}

.btn-primary {
    background-color: #007bff;
    color: #fff;
}
.btn-primary:hover {
    background-color: #0056b3;
}

.btn-success {
    background-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-warning {
    background-color: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

.pagination {
    text-align: center;
    margin-top: 20px;
}

.pagination button {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 8px 15px;
    margin: 0 5px;
    border-radius: 5px;
    cursor: pointer;
}

.pagination button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.pagination span {
    font-weight: bold;
    margin: 0 10px;
}

footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 10px 0;
    margin-top: 20px;
}

/* Admin Tools Page Styles */
.admin-section {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.admin-section h3 {
    color: #007bff;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: calc(100% - 22px);
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* 包含 padding 和 border */
}

.form-group input[type="file"] {
    padding: 5px 0;
}

.form-group input[type="checkbox"] {
    margin-right: 5px;
}

.status-message {
    margin-top: 10px;
    font-weight: bold;
}

.status-message.success {
    color: green;
}

.status-message.error {
    color: red;
}

.status-message.info {
    color: blue;
}

.error-message {
    color: red;
    margin-top: 10px;
}

hr {
    border: 0;
    height: 1px;
    background-color: #eee;
    margin: 30px 0;
}

/* IPA Detail Page */
.ipa-detail-container {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.ipa-detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.ipa-detail-icon {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    margin-right: 20px;
    object-fit: contain;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.ipa-detail-info {
    flex-grow: 1;
}

.ipa-detail-info h2 {
    margin: 0 0 10px 0;
    color: #333;
    text-align: left;
    font-size: 2.2em;
}

.ipa-detail-info p {
    margin: 5px 0;
    font-size: 1.1em;
    color: #555;
}

.ipa-detail-section {
    margin-bottom: 30px;
}

.ipa-detail-section h3 {
    color: #007bff;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.ipa-detail-section p {
    line-height: 1.6;
    color: #333;
}

.screenshot-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center; /* 居中显示 */
}

.screenshot-item {
    max-width: 200px; /* 控制截图最大宽度 */
    height: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.screenshot-item:hover {
    transform: scale(1.02);
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}

.back-link:hover {
    text-decoration: underline;
}

/* Screenshot Preview in Tools */
.screenshot-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    margin-bottom: 10px;
    border: 1px solid #eee;
    padding: 5px;
    border-radius: 4px;
    min-height: 50px; /* Prevent collapse when empty */
    align-items: center; /* Vertically align content */
    justify-content: flex-start; /* Default to left alignment */
}

.screenshot-preview img {
    max-width: 80px;
    height: auto;
    border-radius: 3px;
    vertical-align: middle;
}

/* Filters and Sort Group */
.filters-sort {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f0f8ff;
    border: 1px solid #e0f0ff;
    border-radius: 8px;
    align-items: center;
    justify-content: flex-start;
}

.filter-group, .sort-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filters-sort label {
    font-weight: bold;
    color: #555;
    white-space: nowrap; /* 防止标签换行 */
}

.filters-sort input[type="text"],
.filters-sort select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9em;
    flex-grow: 1; /* 允许输入框和选择框适当增长 */
    min-width: 120px; /* 最小宽度 */
}

.loading-message {
    text-align: center;
    font-size: 1.2em;
    color: #777;
    padding: 30px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 10px;
    }
    header .container {
        flex-direction: column;
        align-items: center;
    }
    nav {
        float: none;
        margin-top: 15px;
    }
    nav ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    nav ul li {
        margin: 0 10px 10px 10px;
    }

    .hero-section {
        padding: 30px 15px;
    }
    .hero-section h2 {
        font-size: 2em;
    }
    .hero-section p {
        font-size: 1em;
    }
    .features-section ul {
        flex-direction: column;
        align-items: center;
    }
    .features-section ul li {
        width: 90%;
    }

    .ipa-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .filters-sort {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-group, .sort-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 5px;
    }
    .filters-sort input[type="text"],
    .filters-sort select {
        width: 100%;
        min-width: unset;
    }

    .ipa-detail-header {
        flex-direction: column;
        text-align: center;
    }
    .ipa-detail-icon {
        margin: 0 0 15px 0;
    }
    .ipa-detail-info h2 {
        font-size: 1.8em;
        text-align: center;
    }
    .ipa-detail-info p {
        font-size: 1em;
    }
    .screenshot-gallery {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    .screenshot-item {
        max-width: 150px;
    }
    .admin-section {
        padding: 15px;
    }
    .admin-section h3 {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }
    nav ul li {
        margin: 0 5px 10px 5px;
        font-size: 0.9em;
    }
    .hero-section h2 {
        font-size: 1.8em;
    }
    .hero-section p {
        font-size: 0.9em;
    }
    .hero-section .btn {
        padding: 10px 20px;
        font-size: 1em;
    }
    .ipa-card {
        padding: 10px;
    }
    .ipa-icon {
        width: 80px;
        height: 80px;
    }
    .ipa-card h3 {
        font-size: 1em;
    }
    .ipa-detail-icon {
        width: 100px;
        height: 100px;
    }
    .ipa-detail-info h2 {
        font-size: 1.5em;
    }
    .ipa-detail-section h3 {
        font-size: 1.2em;
    }
}
