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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --max-width: 900px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* === Header/Nav === */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}
.logo:hover { text-decoration: none; }

nav ul {
    display: flex;
    list-style: none;
    gap: 4px;
    flex-wrap: wrap;
}

nav ul a {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: all 0.2s;
}
nav ul a:hover, nav ul a.active {
    background: var(--primary);
    color: white;
    text-decoration: none;
}

/* === Main === */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 20px 60px;
}

/* === Hero === */
.hero {
    text-align: center;
    margin-bottom: 32px;
}
.hero h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
    line-height: 1.3;
}
.hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* === Tool Section === */
.tool-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 48px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
}
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.input-stats {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === Buttons Grid === */
.buttons-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
    justify-content: center;
}

.btn {
    padding: 10px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    color: var(--text-muted);
}
.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.output-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn-copy {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-copy:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-clear { color: #ef4444; border-color: #fecaca; }
.btn-clear:hover { background: #fef2f2; }

.btn-swap { color: var(--text-muted); }
.btn-swap:hover { border-color: var(--primary); color: var(--primary); }

/* === Converter Cards === */
.converters-list {
    margin-bottom: 48px;
}
.converters-list > h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}
.converters-list > p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.converter-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s;
    color: var(--text);
}
.card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    transform: translateY(-2px);
}
.card h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--primary);
}
.card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.card .example {
    display: block;
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--bg);
    padding: 6px 10px;
    border-radius: 4px;
    color: var(--text);
}

/* === SEO Content === */
.seo-content {
    margin-bottom: 48px;
}
.seo-content h2 {
    font-size: 1.35rem;
    margin-top: 32px;
    margin-bottom: 12px;
}
.seo-content p, .seo-content li {
    color: var(--text-muted);
    margin-bottom: 8px;
}
.seo-content ul {
    padding-left: 24px;
    margin-bottom: 16px;
}

.reference-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}
.reference-table th, .reference-table td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
    font-size: 0.9rem;
}
.reference-table th {
    background: var(--bg);
    font-weight: 600;
}
.reference-table td:first-child {
    font-family: monospace;
    font-weight: 600;
}

/* === FAQ === */
.faq {
    margin-bottom: 48px;
}
.faq h2 {
    font-size: 1.35rem;
    margin-bottom: 16px;
}
details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}
summary {
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
}
summary:hover { color: var(--primary); }
details p {
    padding: 0 18px 14px;
    color: var(--text-muted);
}

/* === Footer === */
footer {
    text-align: center;
    padding: 24px 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}
footer p { margin-bottom: 6px; }

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.input-area, .output-area {
    margin-bottom: 20px;
}

/* === Mobile === */
@media (max-width: 600px) {
    .hero h1 { font-size: 1.35rem; }
    .buttons-grid { gap: 6px; }
    .btn { padding: 8px 12px; font-size: 0.8rem; }
    .converter-cards { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    nav { gap: 12px; }
}
