/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --primary: #1A56DB;
    --primary-dark: #1040B0;
    --accent: #0EA5E9;
    --success: #10B981;
    --warning: #F59E0B;
    --bg-page: #F0F4FF;
    --bg-card: #FFFFFF;
    --bg-input: #F8FAFF;
    --bg-result: #EEF6FF;
    --text-primary: #0F172A;
    --text-body: #334155;
    --text-muted: #64748B;
    --border: #DBEAFE;
    --shadow-sm: 0 1px 3px rgba(26, 86, 219, 0.08);
    --shadow-md: 0 4px 16px rgba(26, 86, 219, 0.12);
    --shadow-lg: 0 8px 32px rgba(26, 86, 219, 0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-pill: 50px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Sora', sans-serif;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Base Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Navbar */
nav.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #ffffff;
    box-shadow: var(--shadow-sm);
    height: 64px;
    display: flex;
    align-items: center;
}

nav.navbar .nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo-link {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-links a {
    color: var(--text-body);
    font-weight: 500;
}

.nav-item {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-sm);
    padding: 8px 0;
    min-width: 240px;
    z-index: 1000;
    border: 1px solid var(--border);
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-item:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--text-body);
    font-size: 14px;
    font-weight: 500;
}

.dropdown-menu a:hover {
    background: var(--bg-page);
    color: var(--primary);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

/* Breadcrumb */
.breadcrumb {
    padding: 16px 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--primary);
}

/* Two Column Layout */
.page-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    margin-bottom: 40px;
}

.main-content {
    min-width: 0;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar.sticky {
    position: sticky;
    top: 88px;
}

/* Cards & Widgets */
.card,
.tool-widget {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 24px;
}

/* Inputs */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-body);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    height: 48px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--bg-input);
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    padding: 0 16px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.number-box {
    width: 200px !important;
}

@media (max-width: 480px) {
    .input-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }

    .number-box {
        width: 100% !important;
    }
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.input-prefix,
.input-suffix {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    padding: 4px 8px;
    background: var(--border);
    border-radius: 4px;
}

.input-prefix {
    left: 8px;
}

.input-suffix {
    right: 8px;
}

input.has-prefix {
    padding-left: 48px;
}

input.has-suffix {
    padding-right: 48px;
}

/* Range Sliders */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    margin-top: 12px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

/* Result Cards */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.result-card {
    background: linear-gradient(135deg, #EEF6FF 0%, #DBEAFE 100%);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    position: relative;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.result-card:hover {
    transform: translateY(-2px);
}

.result-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.result-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: var(--text-muted);
}

.result-words {
    font-size: 0.875rem;
    color: var(--text-body);
    font-style: italic;
    margin-top: 8px;
    grid-column: 1 / -1;
    text-align: center;
    background: var(--bg-card);
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 24px;
    border-radius: var(--radius-pill);
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: scale(1.02);
}

.btn-secondary {
    background-color: white;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background-color: var(--bg-page);
}

.btn-icon,
.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: transparent;
    border: none;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover,
.icon-btn:hover {
    background-color: var(--bg-page);
    color: var(--primary);
}

/* Toggle Pills */
.toggle-group {
    display: inline-flex;
    background: var(--bg-input);
    border-radius: var(--radius-pill);
    padding: 4px;
    border: 1px solid var(--border);
}

.toggle-btn {
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Ad Slots */
.ad-slot {
    min-height: 90px;
    text-align: center;
    margin: 24px 0;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ad-slot::before {
    content: 'Advertisement';
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

/* Content Area */
.tool-content {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 32px;
    box-shadow: var(--shadow-md);
}

.intro {
    font-size: 1.125rem;
    color: var(--text-body);
    margin-bottom: 2rem;
}

.formula-block {
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    white-space: pre-wrap;
}

/* FAQ Accordion */
.faq-accordion .faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-question {
    width: 100%;
    text-align: left;
    padding: 16px 0;
    background: none;
    border: none;
    font-family: 'Sora', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-icon::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--primary);
    transition: transform 0.3s;
}

.faq-question[aria-expanded="true"] .faq-icon::after {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0;
    color: var(--text-body);
}

.faq-item.active .faq-answer {
    padding-bottom: 16px;
}

/* Related Tools */
.related-tools {
    margin-top: 48px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 16px;
}

.related-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.related-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.related-title {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.related-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Footer */
footer {
    background-color: #0F172A;
    color: white;
    padding: 64px 0 24px;
    margin-top: 64px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr repeat(4, 1fr);
    gap: 32px;
    margin-bottom: 48px;
}

.footer-col h3 {
    color: white;
    font-size: 1.125rem;
    margin-bottom: 24px;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col a {
    color: #94A3B8;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #1E293B;
    padding-top: 24px;
    text-align: center;
    color: #64748B;
    font-size: 0.875rem;
}

/* Helper Utilities */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 991px) {
    .page-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 16px;
        box-shadow: var(--shadow-md);
        gap: 16px;
        max-height: 80vh;
        overflow-y: auto;
    }

    .dropdown-menu {
        position: static;
        display: block;
        box-shadow: none;
        border: none;
        padding: 0 0 0 16px;
        min-width: auto;
    }

    .nav-item>a {
        font-weight: 700;
        color: var(--primary);
    }

    .nav-links.show {
        display: flex;
    }

    .mobile-menu-btn {
        display: block;
    }

    .card,
    .tool-widget,
    .tool-content {
        padding: 16px;
    }

    input[type="text"],
    input[type="number"],
    select,
    .btn {
        height: 44px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.25rem;
    }
}