/* ToolsPop.com - Main Stylesheet */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #667eea;
    --accent-color: #764ba2;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --border-color: #d1d5db;
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 50px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    font-size: 16px;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.4;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0.5rem 0; /* 进一步减少到 0.5rem */
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 2.3rem; /* 缩小三分之一：3.5rem → 2.3rem */
}

.header-left {
    flex: 1;
}

.header-center {
    flex: 2;
    text-align: center;
}

.header-center h1 {
    font-size: 1.1rem; /* 进一步缩小字体 */
    font-weight: 600;
    margin: 0;
    text-align: center;
    opacity: 0.95;
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.logo {
    font-size: 1.2rem; /* 进一步缩小到 1.2rem */
    font-weight: bold;
    color: white;
    text-decoration: none;
}

/* Disable hover effects in header */
.header a:hover,
.header-left a:hover,
.header-center a:hover {
    color: white;
    transform: none;
}

.language-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem; /* 进一步缩小字体 */
}

.language-switch select {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.2rem 0.4rem; /* 进一步缩小padding */
    border-radius: 4px;
    font-size: 0.75rem; /* 进一步缩小字体 */
}

.language-switch select option {
    background: white;
    color: #333;
    padding: 0.2rem 0.4rem;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 1rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero p {
    font-size: clamp(1rem, 3vw, 1.2rem);
    margin-bottom: 2rem;
    opacity: 0.95;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Search Styles */
.search-container {
    max-width: 600px;
    margin: 0 auto 2rem;
    position: relative;
}

.search-form {
    position: relative;
    display: flex;
}

.search-box {
    width: 100%;
    padding: 1rem 1.5rem;
    padding-right: 120px;
    font-size: 1.1rem;
    border: none;
    border-radius: var(--radius-xl);
    outline: none;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s ease;
    background: var(--bg-primary);
}

.search-box:focus {
    box-shadow: 0 4px 25px rgba(37, 99, 235, 0.2);
}

.search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.search-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-50%) scale(1.02);
}

/* Category Filter */
.category-filter {
    background: var(--bg-primary);
    margin: 1rem 0 0.5rem;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.category-filter .search-container {
    max-width: 500px;
    margin: 0 auto 1rem;
}

.category-filter .search-box {
    padding: 0.75rem 1rem;
    padding-right: 100px;
    font-size: 0.95rem;
}

.category-filter .search-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    right: 4px;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.category-tab {
    padding: 10px 20px;
    background: #f3f4f6;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.category-tab:hover {
    background: #e5e7eb;
    color: var(--text-primary);
    transform: translateY(-1px);
}

.category-tab.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

/* Tools Grid */
.tools-section {
    padding: 1rem 0 1.5rem;
}

.section-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-size: 2rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.tool-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    transition: left 0.5s ease;
}

.tool-detail-header {
    margin-bottom: 1rem;
}

.tool-detail-description {
    font-size: 0.95rem;
    color:#6b7280;
}


.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.tool-card:hover::before {
    left: 100%;
}

.tool-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    position: relative;
}

.tool-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0;
    color: var(--text-primary);
    line-height: 1.3;
    flex: 1;
    padding-right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-title i {
    font-size: 1.1rem;
    color: var(--primary-color);
    width: 20px;
    display: inline-flex;
    justify-content: center;
}

.tool-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.tool-description {
    color: #5a6b83;
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    opacity: 1;
}

.tool-url {
    font-size: 0.8rem;
    color: #6b7280;
    word-break: break-all;
    opacity: 1;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.no-results p {
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* Description Section */
.description-section {
    background: var(--bg-primary);
    padding: 1.5rem 0;
    margin-top: 1rem;
    text-align: center;
}

.site-description {
    max-width: 800px;
    margin: 0 auto;
}

.site-description p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

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

.footer-links a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    position: relative;
}

.footer-links a:hover {
    color: #60a5fa;
}

.footer-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -3px;
    left: 0;
    background-color: #60a5fa;
    transition: width 0.3s ease;
}

.footer-links a:hover::after {
    width: 100%;
}

.contact-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.contact-info a {
    color: #60a5fa;
    font-weight: 500;
    transition: color 0.3s ease;
}

.contact-info a:hover {
    color: #93c5fd;
}

/* Loading States */
.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading.active {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 0 24px;
    }
    
    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.25rem;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 3rem 0;
    }
    
    .hero h1 {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }
    
    .hero p {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }
    
    .search-box {
        font-size: 1rem;
        padding: 0.9rem 1.2rem;
        padding-right: 110px;
    }
    
    .search-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 1rem;
    }
    
    .category-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 10px;
        scrollbar-width: thin;
    }
    
    .category-tabs::-webkit-scrollbar {
        height: 4px;
    }
    
    .category-tabs::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }
    
    .category-tabs::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 2px;
    }
    
    .category-tab {
        flex-shrink: 0;
        font-size: 0.85rem;
    }
    
    .header-content {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem 0; /* 缩小移动端padding */
        min-height: 40px; /* 从60px缩小到40px */
    }

    .header-left {
        flex: 0 0 auto;
        order: 1;
    }

    .header-center {
        flex: 1;
        order: 2;
        min-width: 0;
        text-align: left;
        margin-left: 1rem;
    }

    .header-center h1 {
        font-size: 0.9rem; /* 移动端进一步缩小 */
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-right {
        flex: 0 0 auto;
        order: 3;
    }
    
    .language-switch {
        font-size: 0.8rem;
    }

    .language-switch span {
        display: none;
    }

    .language-switch select {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .language-switch select option {
        background: white;
        color: #333;
        padding: 6px 8px;
    }
    
    /* Footer 中等屏幕响应式 */
    .footer-links {
        gap: 1.5rem;
    }
    
    .footer-links a {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .hero {
        padding: 2.5rem 0;
    }
    
    .tool-card {
        padding: 1.25rem;
    }
    
    .tool-header {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .tool-title {
        font-size: 1.1rem;
        padding-right: 0.5rem;
        flex: 1;
        gap: 0.4rem;
    }
    
    .tool-title i {
        font-size: 1rem;
        width: 18px;
    }
    
    .tool-category {
        flex-shrink: 0;
        align-self: flex-start;
    }
    
    .search-container,
    .category-filter .search-container {
        margin: 0 auto 1.5rem;
    }
    
    .search-box {
        padding: 0.8rem 1rem;
        padding-right: 100px;
        font-size: 0.95rem;
    }
    
    .search-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        right: 4px;
    }
    
    .category-filter {
        padding: 1rem;
        margin: 0.75rem 0 0.5rem;
    }

    .category-filter .search-container {
        margin: 0 0 0.75rem;
    }

    .category-filter .search-box {
        padding: 0.6rem 0.8rem;
        padding-right: 90px;
        font-size: 0.9rem;
    }

    .category-filter .search-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        right: 3px;
    }
    
    .category-tab {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    /* Footer响应式 */
    .footer-links {
        gap: 1rem;
        flex-direction: column;
        align-items: center;
    }
    
    .footer-links a {
        font-size: 0.9rem;
    }

    /* 超小屏幕header优化 */
    .header-center h1 {
        font-size: 0.8rem; /* 超小屏幕进一步缩小 */
    }

    .header-content {
        padding: 0.4rem 0; /* 缩小padding */
        min-height: 35px; /* 从50px缩小到35px */
    }

    .logo {
        font-size: 1rem; /* 从1.5rem缩小到1rem */
    }

    .description-section {
        padding: 1.25rem 0;
        margin-top: 0.75rem;
    }

    .site-description p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus Styles for Accessibility */
.search-box:focus,
.category-tab:focus,
.tool-card:focus,
button:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
        --shadow-md: 0 4px 8px rgba(0,0,0,0.3);
        --shadow-lg: 0 8px 16px rgba(0,0,0,0.3);
    }
}

/* Print Styles */
@media print {
    .header,
    .hero,
    .category-filter,
    .footer {
        display: none;
    }
    
    .tool-card {
        box-shadow: none;
        border: 1px solid #ccc;
        margin-bottom: 1rem;
        break-inside: avoid;
    }
}
