/*
 * common.css - global design system
 * A modern, minimal and consistent visual language
 * Covers design tokens, typography, navigation, forms, buttons, cards and the footer
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ========== reset ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Scripts toggle visibility with the hidden attribute. This rule keeps it
   working even for components whose class sets a display value. */
[hidden] {
    display: none !important;
}

/* ========== design tokens ========== */
:root {
    /* brand colours */
    --primary-color: #ef4444;
    --primary-hover: #dc2626;
    --primary-soft: rgba(239, 68, 68, 0.08);
    --secondary-color: #22c55e;
    --secondary-hover: #16a34a;

    /* neutral colours */
    --text-color: #0f172a;
    --light-text: #64748b;
    --border-color: #e2e8f0;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --page-bg: #f4f6f9;

    /* shape and shadow */
    --border-radius: 10px;
    --radius-lg: 16px;
    --box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.08);

    /* typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, 'Courier New', monospace;

    /* legacy variable names, kept for compatibility */
    --light-gray: #f8fafc;
    --light-bg: #f8fafc;
    --hover-color: #dc2626;
    --primary-dark: #dc2626;
    --primary-light: rgba(239, 68, 68, 0.08);
    --secondary-dark: #16a34a;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--page-bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ========== page header ========== */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 2.5rem;
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.logo h1 {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-color);
    white-space: nowrap;
}

.logo h1 span {
    color: var(--primary-color);
}

/* ========== navigation ========== */
nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    list-style: none;
}

nav ul li a {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--light-text);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}

nav ul li a i {
    font-size: 0.85rem;
    opacity: 0.9;
}

nav ul li a:hover {
    color: var(--text-color);
    background-color: var(--surface-muted);
}

nav ul li a.active {
    color: var(--primary-hover);
    background-color: var(--primary-soft);
    font-weight: 600;
}

/* ========== main content ========== */
main {
    max-width: 1200px;
    margin: 2.5rem auto;
    padding: 0 1.25rem;
}

.tool-section {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--box-shadow);
}

.tool-section h2 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-color);
}

.tool-section h2 i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.tool-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ========== form elements ========== */
select,
input,
textarea,
button {
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-color);
}

select,
input,
textarea {
    padding: 0.65rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus,
input:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

::placeholder {
    color: #94a3b8;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748b' width='18px' height='18px'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 15px;
    padding-right: 2.2rem;
    cursor: pointer;
}

input[type="radio"],
input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
    padding: 0;
    cursor: pointer;
}

/* ========== input groups ========== */
.input-group {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.input-group label {
    min-width: 140px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.input-group label i {
    color: var(--primary-color);
    margin-right: 0.35rem;
}

.input-group input,
.input-group select {
    flex: 1;
}

/* ========== buttons ========== */
button {
    cursor: pointer;
}

.input-group button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 1.15rem;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.input-group button:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.input-group button:active {
    transform: scale(0.98);
}

/* shared button classes */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1.15rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-secondary {
    background: var(--secondary-color);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-soft);
}

/* ========== results ========== */
.result-area {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.result-area pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
}

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.1rem 0.4rem;
}

/* ========== info cards ========== */
.info-section {
    margin-top: 1.75rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.info-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-lg);
}

.info-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-color);
}

.info-card h3 i {
    color: var(--primary-color);
    font-size: 0.95rem;
}

.info-card p {
    color: var(--light-text);
    line-height: 1.75;
    font-size: 0.93rem;
    margin-bottom: 0.75rem;
}

.info-card p:last-child {
    margin-bottom: 0;
}

/* ========== footer ========== */
footer {
    margin-top: 3rem;
    padding: 2.75rem 1.5rem;
    background: #0f172a;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.75rem;
    margin-bottom: 1.25rem;
}

.footer-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #ffffff;
}

footer p {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.footer-address {
    color: #64748b !important;
    font-size: 0.8rem !important;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

/* Legacy class: the filing number link. The new footer no longer uses it, kept for compatibility. */
.beian-link {
    text-decoration: none;
    color: inherit;
}

/* ========== toast ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast-message {
    display: flex;
    align-items: center;
    max-width: 320px;
    margin-bottom: 10px;
    padding: 12px 18px;
    background: #0f172a;
    color: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    opacity: 0;
    animation: fadeIn 0.3s, fadeOut 0.3s 2.7s;
    animation-fill-mode: forwards;
}

.toast-message i {
    margin-right: 10px;
    font-size: 15px;
}

.toast-message.info {
    background: #0f172a;
}

.toast-message.success {
    background: #059669;
}

.toast-message.warning {
    background: #d97706;
}

.toast-message.error {
    background: #dc2626;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-12px); }
}

/* ========== form validation states ========== */
.input-error {
    border-color: #ef4444 !important;
}

.input-hint {
    display: none;
    color: var(--light-text);
    font-size: 12px;
    margin-top: 5px;
    font-style: italic;
}

.input-group:hover .input-hint {
    display: block;
}

.input-error-message {
    display: none;
    color: #ef4444;
    font-size: 12px;
    margin-top: 5px;
}

.input-error + .input-error-message {
    display: block;
}

input:focus:invalid {
    border-color: #ef4444;
}

input:focus:valid {
    border-color: #22c55e;
}

/* ========== tooltips ========== */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 10;
}

[data-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
}

/* ========== shared content sections ==========
   Steps, features, comparison tables and chips shared by every tool page. The
   section shell and the FAQ list already live further down in this file. */
.seo-heading p {
    color: var(--light-text);
    font-size: 0.94rem;
    line-height: 1.7;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.step-card {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1.2rem;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.step-number {
    display: grid;
    place-items: center;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    color: #fff;
    background: var(--primary-color);
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 750;
}

.step-card h3,
.feature-card h3 {
    margin-bottom: 0.35rem;
    color: var(--text-color);
    font-size: 0.96rem;
}

.step-card p,
.feature-card p {
    color: var(--light-text);
    font-size: 0.86rem;
    line-height: 1.65;
}

.comparison-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.format-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.format-table th,
.format-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.format-table thead th {
    color: var(--text-color);
    background: var(--surface-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.015em;
}

.format-table tbody th {
    color: var(--text-color);
    font-weight: 700;
}

.format-table tbody td {
    color: var(--light-text);
}

.format-table tbody tr:last-child th,
.format-table tbody tr:last-child td {
    border-bottom: none;
}

.table-highlight {
    display: inline-block;
    padding: 0.14rem 0.45rem;
    color: #047857;
    background: #ecfdf5;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.feature-card {
    padding: 1.2rem;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.feature-card > i {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
    background: var(--primary-soft);
    border-radius: 10px;
}

.format-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.format-chips span {
    padding: 0.5rem 0.75rem;
    color: var(--light-text);
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.82rem;
}

.format-chips strong {
    color: var(--text-color);
}

.format-note {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin-top: 1rem;
    padding: 0.8rem 0.95rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--border-radius);
}

.format-note i {
    margin-top: 0.22rem;
    color: #d97706;
}

.format-note p {
    font-size: 0.84rem;
    line-height: 1.6;
}

/* ========== page header and tool title ==========
   The logo uses a plain element so every tool page can own the single h1. */
.site-title {
    color: var(--text-color);
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.site-title span {
    color: var(--primary-color);
}

.tool-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-size: 1.5rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.tool-title i {
    color: var(--primary-color);
    font-size: 0.9em;
}

.tool-intro {
    max-width: 760px;
    margin-bottom: 1.5rem;
    color: var(--light-text);
    font-size: 0.94rem;
    line-height: 1.7;
}

/* ========== sibling tool navigation ==========
   Each tool now lives on its own page, so this strip keeps the tools of one
   category one click away instead of sending visitors back to the hub. */
.tool-siblings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.45rem;
    background: #e9edf3;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.tool-siblings a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.6rem 0.9rem;
    color: var(--light-text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-siblings a:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.62);
}

.tool-siblings a.active {
    color: var(--primary-hover);
    background: #ffffff;
    border-color: var(--border-color);
    box-shadow: var(--box-shadow);
}

/* ========== category hub cards ========== */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.hub-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--box-shadow);
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.hub-card:hover {
    transform: translateY(-2px);
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: var(--shadow-lg);
}

.hub-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    font-size: 1rem;
}

.hub-card h3 i {
    color: var(--primary-color);
}

.hub-card p {
    color: var(--light-text);
    font-size: 0.85rem;
}

.hub-card span {
    margin-top: auto;
    color: var(--primary-color);
    font-size: 0.82rem;
    font-weight: 700;
}

/* ========== scrollbars ========== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* ========== responsive ========== */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }

    nav ul {
        gap: 0.35rem 0.5rem;
    }

    main {
        margin: 1.5rem auto;
    }

    .tool-section {
        padding: 1.25rem;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .input-group label {
        min-width: auto;
    }

    .info-section {
        grid-template-columns: 1fr;
    }

    .footer-links {
        gap: 1.25rem;
    }
}

/* ===== Shared FAQ section (used site-wide) ===== */
.seo-section {
    margin-top: 1.75rem;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--box-shadow);
}
.seo-heading {
    max-width: 760px;
    margin-bottom: 1.5rem;
}
.eyebrow {
    display: inline-block;
    margin-bottom: 0.35rem;
    color: var(--primary-hover);
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.seo-heading h2 {
    margin-bottom: 0.45rem;
    color: var(--text-color);
    font-size: 1.4rem;
    line-height: 1.35;
    letter-spacing: -0.015em;
}
.faq-list {
    border-top: 1px solid var(--border-color);
}
.faq-list details {
    border-bottom: 1px solid var(--border-color);
}
.faq-list summary {
    position: relative;
    padding: 1rem 2.25rem 1rem 0;
    color: var(--text-color);
    font-size: 0.94rem;
    font-weight: 650;
    list-style: none;
    cursor: pointer;
}
.faq-list summary::-webkit-details-marker {
    display: none;
}
.faq-list summary::after {
    content: '+';
    position: absolute;
    top: 50%;
    right: 0.3rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 500;
    transform: translateY(-50%);
}
.faq-list details[open] summary::after {
    content: '\2212';
}
.faq-list details p {
    max-width: 850px;
    padding: 0 2rem 1rem 0;
    color: var(--light-text);
    font-size: 0.88rem;
    line-height: 1.7;
}
.related-tools-copy {
    margin-top: 0.85rem;
    line-height: 1.7;
    color: var(--light-text);
}
@media (max-width: 768px) {
    .seo-section {
        padding: 1.25rem;
    }

    .steps-grid,
    .features-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .steps-grid,
    .features-grid {
        grid-template-columns: 1fr;
    }
}
