/* Global Reset & Typography */
:root {
    --primary-color: #0f172a;
    --secondary-color: #334155;
    --accent-color: #2563eb;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 8px;
    --container-width: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    /* Remove tap highlight on mobile */
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

a {
    text-decoration: none;
    color: var(--accent-color);
    transition: color 0.2s;
}

a:hover {
    color: #1d4ed8;
}

ul {
    list-style: none;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
    position: relative;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    z-index: 1001;
    /* Ensure logo is above mobile menu background */
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--secondary-color);
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--accent-color);
}

.hamburger {
    display: none;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    z-index: 1001;
    /* Ensure hamburger is above mobile menu background */
    padding: 10px;
    /* Larger touch target */
}

/* Ad Box Styles */
/* Ad Box Styles */
.ad-container {
    display: flex;
    justify-content: center;
    margin: 30px auto;
    width: 100%;
}

.ad-box {
    width: 300px;
    height: 250px;
    background-color: #f1f5f9;
    border: 1px dashed #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 100%;
    /* Prevent overflow on very small screens */
}

/* Hero Section */
.hero {
    background: linear-gradient(to right, #1e293b, #0f172a);
    color: var(--white);
    padding: 60px 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero p {
    font-size: 1.1rem;
    color: #cbd5e1;
    max-width: 700px;
    margin: 0 auto;
}

/* Tools Section */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px auto;
}

.tool-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.tool-card h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px;
    /* Larger for touch inputs */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    background: #fff;
}

.input-group input:focus,
.input-group select:focus {
    outline: 2px solid var(--accent-color);
    border-color: transparent;
}

.btn-calc {
    width: 100%;
    padding: 14px;
    /* Larger touch target */
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
    font-size: 1rem;
}

.btn-calc:hover {
    background-color: #1d4ed8;
}

.result-area {
    margin-top: 20px;
    padding: 15px;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    text-align: center;
    color: #166534;
    font-weight: 600;
    display: none;
}

/* Content Area */
.content-area {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    margin: 40px auto;
    box-shadow: var(--shadow);
    overflow: hidden;
    /* Ensure nothing spills out */
}

.article-content {
    max-width: 900px;
    margin: 0 auto;
}

.article-content h2 {
    font-size: 2rem;
    margin: 30px 0 15px;
    color: var(--primary-color);
    line-height: 1.3;
}

.article-content h3 {
    font-size: 1.5rem;
    margin: 25px 0 10px;
    color: var(--secondary-color);
}

.article-content p {
    margin-bottom: 1.5rem;
    color: #475569;
}

.article-content ul {
    list-style: disc;
    padding-left: 20px;
    margin-bottom: 1.5rem;
    color: #475569;
}

.article-content li {
    margin-bottom: 8px;
}

/* Tables - Responsive Wrapper */
.table-wrapper,
/* Ensure divs with overflow from HTML still work, but apply general rule for tables */
div[style*="overflow-x:auto"] {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 600px;
    /* Force scroll on small screens */
}

th,
td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
    white-space: nowrap;
    /* Prevent awkward wrapping in dense tables */
}

th {
    background-color: #f1f5f9;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: #f8fafc;
}

/* FAQ */
.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.faq-question {
    background: #f8fafc;
    padding: 15px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.faq-question::after {
    content: '+';
    font-size: 1.2rem;
}

.faq-item.active .faq-question::after {
    content: '-';
}

.faq-answer {
    padding: 0 15px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    background: white;
}

.faq-item.active .faq-answer {
    padding: 15px;
    max-height: 1000px;
    /* increased to handle long content */
}

/* Internal Links Grid */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.link-card {
    display: block;
    padding: 15px;
    background: #f1f5f9;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 500;
    color: var(--primary-color);
}

.link-card:hover {
    background: #e2e8f0;
    color: var(--accent-color);
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: #94a3b8;
    padding: 60px 0 20px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h3 {
    color: var(--white);
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col a {
    color: #94a3b8;
}

.footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 20px;
    text-align: center;
    font-size: 0.9rem;
}

/* Forms */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 150px;
    margin-bottom: 15px;
    font-family: inherit;
    font-size: 1rem;
}

/* TABLET RESPONSIVENESS (768px break point) */
@media (max-width: 900px) {
    .container {
        padding: 0 15px;
        /* Reduce padding slightly */
    }

    .navbar {
        padding: 15px 0;
    }

    .hamburger {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        /* Slide off screen */
        height: 100vh;
        width: 250px;
        background-color: var(--white);
        flex-direction: column;
        padding: 80px 20px 20px;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        z-index: 1000;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        font-size: 1.1rem;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-color);
        display: block;
    }
}

/* MOBILE RESPONSIVENESS (480px break point) */
@media (max-width: 480px) {
    .hero {
        padding: 40px 0;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        /* Stack tools */
    }

    .content-area {
        padding: 20px;
        /* Reduce padding on mobile card */
    }

    .article-content h2 {
        font-size: 1.5rem;
    }

    .article-content h3 {
        font-size: 1.2rem;
    }

    .ad-box {
        width: 100%;
        max-width: 300px;
        /* Ensure 300px ads fit but also shrink if needed */
        height: 250px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        /* Stack footer cols */
        gap: 30px;
        text-align: center;
    }
}

/* =========================================
   New Optimizations (Internal Linking & UX)
   ========================================= */

/* 1. Internal Linking Hub (Welcome Section) */
.welcome-hub {
    padding: 2rem;
    text-align: center;
    background: #f8fafc;
    border-radius: var(--radius);
    margin: 2rem auto;
    max-width: 900px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.welcome-hub h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.welcome-hub p {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

.hub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.hub-links a {
    text-decoration: none;
    color: white;
    padding: 12px 24px;
    border-radius: 5px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.hub-links a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
}

/* 2. Responsive Table Container (Enhanced) */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

/* 3. CTA Banners */
.cta-banner {
    border-radius: var(--radius);
    margin: 40px 0;
    position: relative;
    overflow: hidden;
}

.cta-banner h3 {
    margin-top: 0 !important;
    /* Override potential article h3 margins */
    margin-bottom: 10px;
}

.cta-banner a,
.cta-banner button {
    transition: opacity 0.2s;
}

.cta-banner a:hover,
.cta-banner button:hover {
    opacity: 0.9;
}