:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --glass: rgba(255, 255, 255, 0.7);
    --preview-font-size: 22px;
}

.dark-theme {
    --primary-color: #6366f1;
    --primary-hover: #818cf8;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5);
    --glass: rgba(30, 41, 59, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.5;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header & Theme Toggle */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary-color), #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#themeToggle {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 4rem;
}

.hero h1,
.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.gradient-text {
    background: linear-gradient(to right, var(--primary-color), #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    text-align: justify;
    hyphens: auto;
    word-break: break-word;
}

.input-wrapper {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

#textInput {
    width: 100%;
    padding: 1.5rem 2rem;
    font-size: 1.25rem;
    border-radius: 1rem;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-main);
    outline: none;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#textInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.actions {
    margin-top: 1.5rem;
}

#copyAllBtn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#copyAllBtn:hover {
    background: var(--primary-hover);
}

/* Navigation & Search */
.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.categories {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: none;
    /* Firefox */
}

.categories::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari */
}

.nav-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 1.25rem;
    border-radius: 2rem;
    white-space: nowrap;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

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

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

.search-container {
    position: relative;
    min-width: 250px;
}

.search-container input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border-radius: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

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

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Controls Bar */
.controls-bar {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.font-size-control label {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.font-size-control input[type="range"] {
    flex: 1;
    cursor: pointer;
}

#fontSizeValue {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 45px;
}

/* Results Section */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.font-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.font-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.font-info {
    flex: 1;
    margin-right: 1rem;
}

.font-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.font-preview {
    font-size: var(--preview-font-size);
    word-break: break-all;
    transition: font-size 0.1s ease;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.copy-btn.success {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

/* Info Sections */
.info-section {
    margin-bottom: 3rem;
    padding: 3rem;
    background: var(--card-bg);
    border-radius: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.1);
}

.info-section h2 {
    font-size: 1.85rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.info-section h3 {
    font-size: 1.35rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.info-section p {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
    line-height: 1.7;
    text-align: justify;
    hyphens: auto;
    word-break: break-word;
}

.info-section ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.info-section li {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.how-it-works {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-top: 2.5rem;
}

.step {
    text-align: center;
}

.step h3 {
    margin-top: 1rem;
    font-size: 1.25rem;
}

.step-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), #ec4899);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

/* Use Cases & Benefits */
.use-cases h3,
.benefits-grid h3 {
    color: var(--text-main);
    font-size: 1.2rem;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
}

.benefit-item {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.benefit-item h3 {
    margin-top: 0;
}

/* FAQ */
.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item h3 {
    font-size: 1.15rem;
    color: var(--text-main);
    margin-top: 0;
}

/* Final CTA */
.final-cta {
    background: linear-gradient(135deg, var(--card-bg), var(--bg-color));
    padding: 4rem 2rem;
    border-radius: 2rem;
    border: 2px dashed var(--border-color);
}

.final-cta h2 {
    font-size: 2rem;
}

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

.footer-links {
    margin: 1.5rem 0;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin: 0 1rem;
    font-size: 0.9rem;
}

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

/* Responsive */
@media (max-width: 850px) {
    .nav-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        min-width: auto;
    }
}

@media (max-width: 640px) {

    .hero h1,
    .hero h2 {
        font-size: 1.8rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .info-section {
        padding: 1.5rem;
    }
}