/* Base reset & typography */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --max-width: 640px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-top: 2rem;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.subheadline {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Form */
.tool-form {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 3rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea { resize: vertical; }

.btn-primary {
    display: block;
    width: 100%;
    padding: 0.9rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    padding: 0.65rem 1.25rem;
    background: var(--bg-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover { background: var(--border); }

.btn-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.95rem;
}

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

.secure-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* How it works */
.how-it-works {
    margin-bottom: 3rem;
}

.how-it-works h2 {
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.steps {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.step {
    text-align: center;
    flex: 1;
    max-width: 180px;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.step p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* FAQ */
.faq { margin-bottom: 3rem; }

.faq h2 {
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.5rem;
}

summary {
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
}

details p {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Result page */
.result-section {
    text-align: center;
    padding-top: 3rem;
}

.result-section h1 {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
}

.result-box {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: left;
    white-space: pre-wrap;
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.download-section {
    text-align: center;
    margin-bottom: 2rem;
}

.btn-download {
    display: inline-block;
    font-size: 1.2rem;
    padding: 1rem 2.5rem;
    text-decoration: none;
}

.download-hint {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-preview {
    margin-bottom: 1.5rem;
}

.result-preview summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.result-preview summary:hover {
    color: var(--primary);
}

/* Loading */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 1.5rem auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* Example output */
.example-section { margin-bottom: 3rem; }
.example-section h2 { text-align: center; font-size: 1.4rem; margin-bottom: 0.75rem; }
.example-intro { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.example-box {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    white-space: pre-wrap;
    font-size: 0.85rem;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    color: var(--text-muted);
}

/* Trust bar */
.trust { margin-bottom: 3rem; }
.trust-items {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    text-align: center;
}
.trust-item {
    flex: 1;
    max-width: 160px;
}
.trust-item strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}
.trust-item span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Comparison table */
.comparison { margin-bottom: 3rem; }
.comparison h2 { text-align: center; font-size: 1.4rem; margin-bottom: 1.5rem; }
.compare-table { display: flex; gap: 1rem; }
.compare-col {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.compare-col h3 { font-size: 1rem; margin-bottom: 0.75rem; }
.compare-col ul { list-style: none; padding: 0; }
.compare-col li {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.35rem 0;
    padding-left: 1.5rem;
    position: relative;
}
.compare-them li::before { content: "✗"; position: absolute; left: 0; color: #ef4444; }
.compare-us li::before { content: "✓"; position: absolute; left: 0; color: #22c55e; font-weight: 700; }
.compare-us { border-color: var(--primary); background: rgba(37, 99, 235, 0.03); }

/* Related tools (pSEO internal links) */
.related-tools { margin-bottom: 3rem; }
.related-tools h2 { text-align: center; font-size: 1.4rem; margin-bottom: 1rem; }
.related-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}
.related-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}
.related-link:hover { border-color: var(--primary); color: var(--primary); }

/* Consent checkbox */
.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.4;
    cursor: pointer;
}
.consent-label input[type="checkbox"] {
    margin-top: 0.15rem;
    flex-shrink: 0;
    width: auto;
}
.consent-label a { color: var(--primary); }

/* Legal pages */
.legal-page { padding-top: 2rem; }
.legal-page h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.legal-page h2 { font-size: 1.2rem; margin-top: 2rem; margin-bottom: 0.75rem; }
.legal-page p, .legal-page li { font-size: 0.9rem; color: var(--text-muted); line-height: 1.7; }
.legal-page ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.legal-page a { color: var(--primary); }
.legal-updated { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 1.5rem; }
.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.85rem;
}
.legal-table th, .legal-table td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
    color: var(--text-muted);
}
.legal-table th {
    background: var(--bg-alt);
    font-weight: 600;
    color: var(--text);
}
.back-link { margin-top: 3rem; }

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.footer-links { margin-top: 0.5rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 480px) {
    .hero h1 { font-size: 1.5rem; }
    .steps { flex-direction: column; align-items: center; }
    .trust-items { flex-direction: column; align-items: center; }
    .tool-form { padding: 1.25rem; }
    .compare-table { flex-direction: column; }
}
