/* General Body and Layout */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #f4f7f6; /* Light background for the whole page */
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #2c3e50; /* Dark blue header */
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
}

header p {
    margin: 0.5rem 0 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    display: flex;
    flex: 1; /* Allows main content to grow and take available space */
    padding: 0; /* Removed padding */
    max-width: none; /* Removed max-width for full width */
    margin: 20px; /* Adjusted margin for full width */
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
}

footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto; /* Pushes footer to the bottom */
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

footer a {
    color: #3498db;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    padding: 20px;
    background-color: #ecf0f1; /* Light grey for sidebar */
    border-right: 1px solid #ddd;
    box-sizing: border-box;
    flex-shrink: 0; /* Prevent sidebar from shrinking */
    border-radius: 8px 0 0 8px;
}

.sidebar h2 {
    color: #2c3e50;
    font-size: 1.6rem;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db; /* Blue accent */
    padding-bottom: 10px;
}

.search-section, .category-section, .popular-tools-section, .latest-tools-section {
    margin-bottom: 30px;
}

#searchInput {
    width: calc(100% - 20px);
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    border-color: #3498db;
    outline: none;
}

.region-toggle {
    display: flex;
    margin-bottom: 15px;
    border: 1px solid #3498db;
    border-radius: 5px;
    overflow: hidden;
}

.region-toggle a.button {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background-color: #f0f2f5;
    color: #333;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease, color 0.3s ease;
    text-align: center; /* 确保文本居中 */
    text-decoration: none; /* 移除下划线 */
}

.region-toggle a.button:hover {
    background-color: #e0e0e0;
}

.region-toggle a.button.active {
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

#category-filters {
    list-style: none;
    padding: 0;
    margin: 0;
}

#category-filters li {
    margin-bottom: 5px;
}

#category-filters a {
    display: block;
    width: 100%;
    padding: 10px 15px;
    text-align: left;
    background-color: transparent;
    box-sizing: border-box; /* Add this line to include padding in the width */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    color: #555;
    transition: background-color 0.3s ease, color 0.3s ease;
    text-decoration: none; /* 移除下划线 */
}

#category-filters a:hover {
    background-color: #e0e0e0;
}

#category-filters a.active { /* 如果需要激活样式，可以添加 */
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

.popular-tools-section h2, .latest-tools-section h2 {
    color: #2c3e50;
    font-size: 1.6rem;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.popular-tools-section ul, .latest-tools-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-tools-section li, .latest-tools-section li {
    margin-bottom: 8px;
}

.popular-tools-section a, .latest-tools-section a {
    text-decoration: none;
    color: #555;
    display: block;
    padding: 8px 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.popular-tools-section a:hover, .latest-tools-section a:hover {
    background-color: #e0e0e0;
    color: #2c3e50;
}

/* Ad Section Styles */
.ad-section {
    margin-bottom: 30px;
}

.ad-section h2 {
    color: #2c3e50;
    font-size: 1.6rem;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.ad-placeholder {
    background-color: #f0f2f5;
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    color: #777;
    font-size: 0.9rem;
}

.ad-placeholder img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin-top: 10px;
}

/* 404 Page Back Home Button */
.back-home {
    display: inline-block;
    background-color: #3498db;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.back-home:hover {
    background-color: #2980b9;
}

/* Tools Grid Container */
.tools-grid-container {
    flex: 1; /* Allows tool grid to take remaining space */
    padding: 20px;
}

.tools-grid-container h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

#tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Adjusted for 4 columns, smaller minmax */
    gap: 25px;
}

/* Tool Card Styles */
.tool-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    padding: 20px; /* Add padding to the card itself */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Push links to bottom */
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.tool-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align items to the top */
    margin-bottom: 10px;
}

.tool-name {
    margin: 0;
    font-size: 1.5rem; /* Larger font size for name */
    color: #3498db; /* Blue color for name */
    flex-grow: 1; /* Allow name to take available space */
}

.tool-logo {
    width: 60px; /* Larger logo size */
    height: 60px;
    border-radius: 8px;
    object-fit: contain;
    background-color: #f0f0f0;
    padding: 5px;
}

.tool-logo-placeholder {
    width: 60px;
    height: 60px;
    border: 2px solid red; /* Red border for placeholder */
    border-radius: 8px;
    flex-shrink: 0; /* Prevent shrinking */
}

.category {
    display: inline-block;
    background-color: #2ecc71; /* Green background for category */
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 10px; /* Space below category */
}

.tool-description {
    margin: 0 0 15px 0; /* Space below description */
    color: #555;
    font-size: 0.95rem;
    flex-grow: 1; /* Allow description to take available space */
}

.tool-card-links {
    display: flex;
    justify-content: space-between; /* Links left and right aligned */
    align-items: center;
    padding-top: 15px; /* Space above links */
    border-top: 1px solid #eee; /* Separator line */
}

.tool-card-links a {
    color: #3498db; /* Blue text for links */
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.tool-card-links a:hover {
    text-decoration: underline;
    color: #2980b9; /* Darker blue on hover */
}

/* Detail Page Specific Styles */
.detail-content-container {
    flex-grow: 1;
    padding: 0 20px; /* Adjusted padding */
}

.detail-container {
    /* max-width: 900px; */ /* Removed max-width to allow full width */
    margin: 2rem 0; /* Adjusted margin to remove horizontal auto */
    padding: 2rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 1rem;
}
.detail-header h1 {
    margin: 0;
    color: #2c3e50;
}
.detail-header .back-button {
    background-color: #95a5a6;
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
}
.detail-info-items {
    display: flex; /* Use flexbox for horizontal alignment */
    align-items: center; /* Vertically center items */
    /* Removed justify-content and gap to use auto margins */
    margin-bottom: 1rem;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
}

.category-region-group {
    display: flex;
    flex-direction: column; /* Stack category and region vertically */
}

.detail-info-items p {
    margin: 0; /* Remove default paragraph margin */
    margin-bottom: 10px; /* Add vertical spacing between category and region */
    display: flex; /* Keep strong and span on one line */
    align-items: center;
}

.detail-info-items p:last-child {
    margin-bottom: 0; /* Remove bottom margin for the last p in the group */
}

.detail-info-items strong {
    margin-right: 5px;
    color: #555;
}

.detail-info-items .category,
.detail-info-items .region {
    display: inline-block;
    background-color: #2ecc71; /* Green for category */
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.detail-info-items .region {
    background-color: #3498db; /* Blue for region */
}

.detail-info-items .category:hover,
.detail-info-items .region:hover {
    opacity: 0.9;
}

.category-region-group {
    display: flex;
    flex-direction: column; /* Stack category and region vertically */
    margin-right: auto; /* Push this group to the left */
}

.visit-website-button {
    display: flex; /* Use flex to center text */
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: #e74c3c; /* Red for visit button */
    color: white;
    width: 80px;
    height: 80px;
    padding: 0;
    border-radius: 50%;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    margin-bottom: 0;
    margin-left: auto;
    margin-right: auto;
}

.visit-website-button:hover {
    background-color: #c0392b; /* Darker red on hover */
    transform: translateY(-2px);
}

.tool-title-section {
    display: flex;
    align-items: center;
}

.tool-title-section .tool-logo {
    width: 60px;
    height: 60px;
    margin-right: 15px;
}

.description-section, .tutorial-section, .comment-section {
    margin-top: 2rem;
    border-top: 1px solid #eee;
    padding-top: 1.5rem;
}

.description-section h2, .tutorial-section h2, .comment-section h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.tool-description-content, .tutorial-content {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1.5rem;
    line-height: 1.8;
    color: #555;
}

.tool-description-content h1, .tool-description-content h2, .tool-description-content h3,
.tutorial-content h1, .tutorial-content h2, .tutorial-content h3 {
    color: #2c3e50;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.tool-description-content p, .tutorial-content p {
    margin-bottom: 1rem;
}

.tool-description-content ul, .tool-description-content ol,
.tutorial-content ul, .tutorial-content ol {
    margin-left: 20px;
    margin-bottom: 1rem;
}

.tool-description-content li, .tutorial-content li {
    margin-bottom: 0.5rem;
}

.tool-description-content code, .tutorial-content code {
    background-color: #e0e0e0;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.tool-description-content pre, .tutorial-content pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.tool-description-content pre code, .tutorial-content pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: 1rem;
}

/* Valine Comments Specific Styles */
#vcomments {
    margin-top: 1.5rem;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1.5rem;
}
