/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #f0f2f5; --bg-card: #ffffff; --text: #1a1a2e; --text-secondary: #6b7280; --text-muted: #9ca3af;
    --primary: #2563eb; --primary-light: #3b82f6; --primary-dark: #1d4ed8; --primary-bg: rgba(37,99,235,0.1);
    --accent: #f59e0b; --border: #e5e7eb; --shadow: 0 2px 8px rgba(0,0,0,0.08); --shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 12px; --radius-sm: 8px; --max-width: 1200px;
    --header-bg: rgba(255,255,255,0.95); --hero-bg: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #1d4ed8 100%);
    --input-bg: #ffffff; --output-bg: #f8fafc; --code-bg: #1e293b; --code-text: #e2e8f0;
    --overlay: rgba(0,0,0,0.5); --modal-bg: #ffffff; --footer-bg: #1e293b; --footer-text: #94a3b8;
}
[data-theme="dark"] {
    --bg: #0f172a; --bg-card: #1e293b; --text: #e2e8f0; --text-secondary: #94a3b8; --text-muted: #64748b;
    --border: #334155; --shadow: 0 2px 8px rgba(0,0,0,0.3); --shadow-hover: 0 8px 24px rgba(0,0,0,0.4);
    --header-bg: rgba(15,23,42,0.95); --hero-bg: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e293b 100%);
    --input-bg: #334155; --output-bg: #1e293b; --code-bg: #0f172a; --code-text: #e2e8f0;
    --overlay: rgba(0,0,0,0.7); --modal-bg: #1e293b; --footer-bg: #0f172a; --footer-text: #64748b;
}
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
a { color: inherit; text-decoration: none; }

/* ===== Header ===== */
.header { position: sticky; top: 0; z-index: 100; background: var(--header-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: center; height: 60px; gap: 24px; }
.logo { font-size: 1.3rem; font-weight: 800; color: var(--primary); white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.lang-switcher { display: flex; gap: 4px; }
.lang-btn { padding: 5px 10px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); font-size: 0.78rem; font-weight: 600; cursor: pointer; border-radius: var(--radius-sm); text-decoration: none; font-family: inherit; transition: all 0.2s; }
.lang-btn:hover { color: var(--text); border-color: var(--primary); }
.lang-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.theme-toggle { background: none; border: none; font-size: 1.15rem; cursor: pointer; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text); transition: background 0.2s; }
.theme-toggle:hover { background: var(--border); }

/* ===== Breadcrumb ===== */
.breadcrumb { padding: 10px 0; font-size: 0.82rem; color: var(--text-secondary); background: var(--bg); border-bottom: 1px solid var(--border); }
.breadcrumb .container { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text-muted); }

/* ===== Hero ===== */
.hero { background: var(--hero-bg); padding: 60px 0 40px; text-align: center; color: white; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(ellipse at 30% 50%, rgba(255,255,255,0.05) 0%, transparent 50%), radial-gradient(ellipse at 70% 50%, rgba(255,255,255,0.03) 0%, transparent 50%); pointer-events: none; }
.hero h1 { font-size: 2.6rem; font-weight: 800; margin-bottom: 10px; position: relative; }
.hero-sub { font-size: 1.1rem; opacity: 0.9; margin-bottom: 24px; position: relative; }
.search-box { max-width: 440px; margin: 0 auto; position: relative; }
.search-input { width: 100%; padding: 12px 20px; border: none; border-radius: 50px; font-size: 0.95rem; background: rgba(255,255,255,0.15); color: white; backdrop-filter: blur(8px); outline: none; transition: background 0.3s; }
.search-input::placeholder { color: rgba(255,255,255,0.5); }
.search-input:focus { background: rgba(255,255,255,0.25); }
.popular-searches { margin-top: 14px; position: relative; }
.ps-label { font-size: 0.78rem; opacity: 0.7; margin-right: 6px; }
.search-tag { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); color: white; padding: 4px 12px; border-radius: 50px; font-size: 0.78rem; cursor: pointer; margin: 3px; transition: all 0.2s; font-family: inherit; }
.search-tag:hover { background: rgba(255,255,255,0.25); }
.trust-badges { display: flex; justify-content: center; gap: 20px; margin-top: 24px; flex-wrap: wrap; position: relative; }
.trust-badge { text-align: center; }
.trust-stat { display: block; font-size: 1.3rem; font-weight: 800; }
.trust-label { display: block; font-size: 0.72rem; opacity: 0.8; }
.trust-text { margin-top: 12px; font-size: 0.88rem; opacity: 0.85; position: relative; }

/* ===== Section Titles ===== */
.section-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 20px; padding-bottom: 8px; border-bottom: 2px solid var(--primary); display: inline-block; }

/* ===== Tools Grid ===== */
.tools-section { padding: 40px 0; }
.category-section { margin-bottom: 36px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.tool-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 16px; text-align: center; cursor: pointer; transition: all 0.25s ease; box-shadow: var(--shadow); position: relative; overflow: hidden; display: block; color: inherit; text-decoration: none; }
.tool-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--primary); transform: scaleX(0); transition: transform 0.3s ease; transform-origin: left; }
.tool-card:hover::after { transform: scaleX(1); }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--primary-light); }
.tool-card .card-icon { font-size: 2.2rem; margin-bottom: 10px; display: block; }
.tool-card h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.tool-card p { font-size: 0.8rem; color: var(--text-secondary); }
.badge-new { position: absolute; top: 8px; right: 8px; background: #ef4444; color: white; font-size: 0.62rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.badge-pop { position: absolute; top: 8px; right: 8px; font-size: 0.9rem; }

/* ===== Popular / New Sections ===== */
.popular-section { padding: 30px 0 10px; }
.popular-section .tools-grid .tool-card { border-color: var(--accent); }

/* ===== Tool Page ===== */
.tool-page { padding: 20px 0 40px; }
.back-btn { display: inline-block; background: var(--bg-card); border: 1px solid var(--border); padding: 8px 18px; border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 20px; transition: all 0.2s; cursor: pointer; text-decoration: none; }
.back-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.tool-header h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 4px; }
.tool-category { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 20px; }
.tool-category a:hover { color: var(--primary); }
.tool-function { margin-bottom: 30px; }
.tool-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.tool-panel h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.tool-panel .tool-desc { color: var(--text-secondary); margin-bottom: 20px; font-size: 0.9rem; }
.tool-loading { text-align: center; padding: 40px; color: var(--text-muted); }

/* ===== SEO Content ===== */
.seo-content { max-width: 760px; margin: 0 auto; }
.seo-content article h2 { font-size: 1.5rem; font-weight: 700; margin: 28px 0 12px; color: var(--text); }
.seo-content article p { margin-bottom: 14px; line-height: 1.8; color: var(--text-secondary); }
.features-list { list-style: none; margin: 12px 0 20px; }
.features-list li { padding: 8px 14px; margin-bottom: 8px; background: var(--primary-bg); border-radius: var(--radius-sm); border-left: 3px solid var(--primary); font-size: 0.9rem; color: var(--text); }
.features-list li strong { color: var(--primary-dark); }

/* ===== FAQ ===== */
.faq-section { margin: 20px 0; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; }
.faq-item summary { padding: 14px 18px; font-weight: 600; cursor: pointer; font-size: 0.92rem; color: var(--text); transition: background 0.2s; }
.faq-item summary:hover { background: var(--primary-bg); }
.faq-item[open] summary { border-bottom: 1px solid var(--border); }
.faq-item p { padding: 14px 18px; color: var(--text-secondary); font-size: 0.88rem; line-height: 1.7; }

/* ===== Related Tools ===== */
.related-section { padding: 30px 0; background: var(--bg); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.related-card { display: flex; align-items: center; gap: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; transition: all 0.2s; cursor: pointer; color: inherit; text-decoration: none; }
.related-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.related-icon { font-size: 1.6rem; }
.related-card h4 { font-size: 0.88rem; font-weight: 700; margin-bottom: 2px; }
.related-card p { font-size: 0.75rem; color: var(--text-secondary); }

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 0.85rem; color: var(--text); }
.form-group textarea, .form-group input[type="text"], .form-group input[type="number"], .form-group input[type="date"], .form-group input[type="datetime-local"], .form-group select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem; background: var(--input-bg); color: var(--text); transition: border-color 0.2s; outline: none; font-family: inherit; }
.form-group textarea { min-height: 100px; resize: vertical; }
.form-group textarea:focus, .form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border: none; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--text-secondary); color: white; }
.btn-success { background: #059669; color: white; }
.btn-success:hover { background: #047857; }
.output-box { background: var(--output-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-top: 14px; min-height: 44px; font-family: "SF Mono", "Fira Code", "Consolas", monospace; font-size: 0.85rem; white-space: pre-wrap; word-break: break-all; position: relative; }
.copy-btn { position: absolute; top: 6px; right: 6px; padding: 3px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px; font-size: 0.75rem; cursor: pointer; color: var(--text-secondary); transition: all 0.2s; font-family: inherit; }
.copy-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== Ad Container ===== */
.ad-container { display: flex; justify-content: center; padding: 10px 0; }

/* ===== Subscribe ===== */
.subscribe-section { text-align: center; padding: 40px 0; background: var(--primary-bg); }
.subscribe-desc { color: var(--text-secondary); margin-bottom: 20px; }
.subscribe-form { display: flex; gap: 8px; max-width: 420px; margin: 0 auto; }
.subscribe-form input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem; background: var(--input-bg); color: var(--text); outline: none; font-family: inherit; }
.subscribe-form input:focus { border-color: var(--primary); }

/* ===== Affiliate ===== */
.affiliate-section { padding: 30px 0; }
.affiliate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.affiliate-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: all 0.2s; }
.affiliate-card:hover { border-color: var(--primary); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.aff-icon { font-size: 2rem; }
.affiliate-card h4 { font-size: 1rem; font-weight: 700; }
.affiliate-card p { font-size: 0.82rem; color: var(--text-secondary); }

/* ===== Footer ===== */
.footer { background: var(--footer-bg); color: var(--footer-text); padding: 40px 0 0; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 30px; }
.footer-brand { max-width: 240px; }
.footer-logo { font-size: 1.2rem; font-weight: 800; display: block; margin-bottom: 6px; }
.footer-brand p { font-size: 0.82rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 30px; }
.footer-col h4 { font-size: 0.85rem; font-weight: 700; color: white; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.footer-col a { display: block; font-size: 0.82rem; color: var(--footer-text); margin-bottom: 6px; transition: color 0.2s; text-decoration: none; }
.footer-col a:hover { color: var(--primary-light); }
.footer-bottom { text-align: center; padding: 20px 0; margin-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.8rem; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    .hero-sub { font-size: 0.95rem; }
    .trust-badges { gap: 12px; }
    .trust-stat { font-size: 1rem; }
    .trust-label { font-size: 0.65rem; }
    .footer-inner { flex-direction: column; gap: 20px; }
    .footer-links { gap: 20px; }
    .subscribe-form { flex-direction: column; }
    .tool-header h1 { font-size: 1.4rem; }
    .seo-content article h2 { font-size: 1.2rem; }
    .related-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .related-grid { grid-template-columns: 1fr; }
    .tools-grid { grid-template-columns: 1fr 1fr; }
    .tool-card { padding: 16px 8px; }
    .tool-card .card-icon { font-size: 1.6rem; }
    .tool-card h3 { font-size: 0.82rem; }
    .tool-card p { font-size: 0.72rem; }
}
