/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #2563EB;
    --primary-hover: #1d4ed8;
    --accent: #10B981;
    --accent-hover: #059669;
    --bg-color: #F9FAFB;
    --card-bg: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #E5E7EB;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 20px -5px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

a { text-decoration: none; color: var(--primary); }
a:hover { color: var(--primary-hover); }
iframe { border: none; max-width: 100%; }
img { max-width: 100%; height: auto; }

/* =========================================
   2. CONTAINERS & TYPOGRAPHY
   ========================================= */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 4rem 0; }
h1, h2, h3, h4 { color: var(--text-main); line-height: 1.2; }
h1 { font-size: 2.5rem; font-weight: 800; }
h2 { font-size: 1.75rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { color: var(--text-muted); }

/* =========================================
   3. HEADER & NAV
   ========================================= */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.logo a {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--primary);
}
.nav-links {
    display: flex;
    gap: 1.25rem;
    font-weight: 500;
    font-size: 0.95rem;
}
.nav-links a { color: var(--text-main); transition: color 0.2s; }
.nav-links a:hover { color: var(--primary); }
.search-nav input {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-color);
    outline: none;
    font-family: inherit;
    font-size: 0.875rem;
}
.search-nav input:focus { border-color: var(--primary); }

.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-main);
}

/* =========================================
   4. BUTTONS
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

/* =========================================
   5. GRID LAYOUTS
   ========================================= */
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }

/* =========================================
   6. CARDS
   ========================================= */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.card h3 { margin-bottom: 0.5rem; }
.card p { font-size: 0.9rem; margin: 0; }

.card-icon {
    width: 48px;
    height: 48px;
    background: #EFF6FF;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Category cards */
.category-card {
    text-align: center;
    padding: 2rem 1.5rem;
}
.category-card .card-icon {
    margin: 0 auto 1rem;
    width: 56px;
    height: 56px;
    font-size: 1.75rem;
}
.category-card h3 { font-size: 1rem; }

/* Tool cards */
.tool-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    text-align: left;
    color: var(--text-main);
}
.tool-card .card-icon { flex-shrink: 0; }
.tool-card h3 { font-size: 1rem; margin-bottom: 0.25rem; color: var(--text-main); }
.tool-card p { font-size: 0.85rem; }

/* =========================================
   7. HERO SECTION
   ========================================= */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}
.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}
.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}
.hero-search {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 0.5rem;
}
.hero-search input {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}
.hero-search input:focus { border-color: var(--primary); }

/* =========================================
   8. SECTIONS
   ========================================= */
.section-title {
    text-align: center;
    margin-bottom: 2.5rem;
}
.section-title h2 { margin-bottom: 0.5rem; }
.section-title p { font-size: 1rem; }

.section-alt {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* Benefits grid */
.benefit-card {
    text-align: center;
    padding: 2rem;
}
.benefit-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}
.benefit-card p { font-size: 0.9rem; }
.benefit-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

/* How it works */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    text-align: center;
}
.step-item .step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0 auto 1rem;
}
.step-item h3 { margin-bottom: 0.5rem; }
.step-item p { font-size: 0.9rem; }

/* =========================================
   9. TOOL PAGE LAYOUT
   ========================================= */
.tool-layout {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}
.tool-workspace {
    background: var(--card-bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    min-height: 250px;
}
.tool-sidebar {
    position: sticky;
    top: 5rem;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

/* FAQ */
.faq-item {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 0;
}
.faq-item h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.faq-item p { font-size: 0.9rem; margin: 0; }

/* Related tools */
.related-tools { margin-top: 2rem; }
.related-tools h3 { margin-bottom: 1rem; }
.related-link {
    display: block;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
}
.related-link:hover { background: var(--bg-color); color: var(--primary); }

/* =========================================
   10. AD PLACEHOLDERS & AD CONTAINERS (live ads)
   ========================================= */

/* Original ad placeholder styling */
.ad-placeholder {
    background: var(--bg-color);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ad-banner-top {
    width: 100%;
    height: 90px;
    margin: 1rem 0;
}
.ad-between-sections {
    width: 100%;
    height: 90px;
    margin: 2rem 0;
}
.ad-sidebar-placeholder {
    width: 100%;
    min-height: 600px;
}
.ad-inline {
    width: 100%;
    height: 250px;
    margin: 2rem 0;
}

/* Legacy ad containers */
.desktop-ad { display: flex; justify-content: center; width: 100%; overflow: hidden; margin: 2rem 0; min-height: 90px; }
.mobile-ad { display: none; width: 100%; min-height: 250px; }

/* Generic ad wrapper — centres content, adds breathing room */
.ad-container {
    margin: 30px 0;
    text-align: center;
    overflow: hidden;
}

/* Native banner (responsive, full-width) */
.ad-native {
    width: 100%;
    min-height: 80px;
}

/* Sidebar 160x600 sticky ad */
.ad-sidebar-slot {
    width: 160px;
    min-height: 600px;
    margin: 0 auto;
}
.sidebar-ad {
    position: sticky;
    top: 80px;
}

/* When ad loads, remove placeholder visual styling */
.ad-placeholder.ad-loaded {
    background: transparent;
    border: none;
    color: transparent;
    font-size: 0;
    text-transform: none;
    letter-spacing: normal;
}

/* Ensure sidebar ad wrapper doesn't break tool layout */
.tool-sidebar .sidebar-ad {
    margin-bottom: 1.5rem;
}

/* =========================================
   11. FOOTER
   ========================================= */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 3rem 0 2rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-col h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-main);
}
.footer-col a {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}
.footer-col a:hover { color: var(--primary); }
.footer-col p {
    font-size: 0.875rem;
    color: var(--text-muted);
}
.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =========================================
   12. FORMS
   ========================================= */
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}
.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
}
.form-input:focus { border-color: var(--primary); }
textarea.form-input { min-height: 120px; resize: vertical; }

/* =========================================
   13. UTILITY CLASSES
   ========================================= */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* =========================================
   14. RESPONSIVE
   ========================================= */
@media screen and (max-width: 1024px) {
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .tool-layout { grid-template-columns: 1fr; }
    .tool-layout aside { display: none; }
    .sidebar-ad { position: static; }
}

@media screen and (max-width: 768px) {
    .grid-5 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .steps-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .hero h1 { font-size: 2rem; }
    .section { padding: 2.5rem 0; }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
}

@media screen and (max-width: 600px) {
    .header .container { flex-wrap: wrap; }
    .nav-links { display: none; }
    .nav-links.active {
        display: flex;
        flex-direction: column;
        width: 100%;
        order: 3;
        gap: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border);
    }
    .search-nav { display: none; }
    .mobile-menu-btn { display: block; }
    .grid-5, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .hero-search { flex-direction: column; }
    .tool-workspace { padding: 2rem 1rem; }

    /* Ads: reduce margin on mobile */
    .ad-container { margin: 20px 0; }

    /* Ad swaps */
    .desktop-ad { display: none !important; }
    .mobile-ad { display: flex !important; justify-content: center; margin: 1.5rem 0; overflow: hidden; }
    .ad-banner-top, .ad-between-sections { height: 250px; }
}
