/* CSS VARIABLES & RESET */
:root {
    --primary: #00d09c;
    /* Groww Green */
    --primary-hover: #00b386;
    --dark: #44475b;
    --gray: #7c7e8c;
    --light-bg: #f3f6f9;
    /* Softer background */
    --white: #ffffff;
    --border: #eef2f5;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Soft shadow */
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--light-bg);
    color: var(--dark);
    margin: 0;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s, background-color 0.2s;
}

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

/* LAYOUT */
header {
    background: var(--white);
    padding: 0.5rem 0;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 1100;
    min-height: 75px; /* Prevent CLS by reserving header space */
}

.brand {
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--primary);
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.brand span {
    color: var(--dark);
}

.brand picture {
    display: block;
    line-height: 0;
    width: 133px;
    height: 74px;
}

.brand img {
    width: 133px;
    height: 74px;
    border-radius: 4px;
    vertical-align: middle;
    aspect-ratio: 133 / 74;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    contain: layout style; /* Prevent CLS from child elements */
}

/* GRID SYSTEM */
.page-grid {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 3rem;
}

.page-grid.full-width {
    grid-template-columns: 1fr;
}

/* TOOL CARDS */
.tool-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

/* Inner Calculator Layout */
.calc-inner-grid {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
}

.calc-inputs {
    flex: 1;
    min-width: 300px;
}

.calc-results {
    flex: 0.8;
    min-width: 280px;
}

/* INPUTS & SLIDERS */
.input-group {
    margin-bottom: 2.5rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    font-weight: 600;
    color: var(--dark);
    font-size: 1rem;
}

/* New Input Style: Input looks like text, unit inside */
.input-wrapper {
    background: #f0f3f7;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    font-weight: 700;
    color: var(--primary);
    width: 140px;
}

.input-wrapper input {
    background: transparent;
    border: none;
    outline: none;
    text-align: right;
    width: 100%;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    padding: 0 5px;
}

.range-wrapper {
    position: relative;
    height: 6px;
    margin-top: 15px;
    display: flex;
    align-items: center;
}

/* Custom Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #eef2f5;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    margin: 0;
    padding: 0;
    /* We will use a linear-gradient in JS to fill the progress */
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 24px;
    width: 24px;
    background: var(--white);
    border: 4px solid var(--primary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    margin-top: 0px;
    /* Center relative to track height (4px) */
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* RESULTS SECTION */
.calc-results {
    text-align: center;
}

.result-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--gray);
}

.result-row strong {
    color: var(--dark);
    font-size: 1.1rem;
}

.total-value-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #ecfdf5;
    /* Light green tint */
    border-radius: 12px;
    border: 1px solid #d1fae5;
}

.total-value-label {
    font-size: 0.9rem;
    color: var(--gray);
    display: block;
    margin-bottom: 0.5rem;
}

.total-value-amount {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

/* SIDEBAR & ARTICLE */
h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.5rem;
    margin-top: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

h3 {
    font-size: 1.2rem;
    color: var(--dark);
}

p,
li {
    color: var(--gray);
    font-size: 1.05rem;
}

.sidebar-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.sidebar-title {
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1rem;
}

.sidebar-link {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    color: var(--dark);
    font-weight: 500;
}

.sidebar-link:hover {
    color: var(--primary);
    padding-left: 5px;
}

.sidebar-link:last-child {
    border: none;
}

footer {
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
    color: var(--gray);
    background: var(--white);
}

.footer-links {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--dark);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-sep {
    margin: 0 0.5rem;
    color: var(--gray);
}

.btn-default {
    background: var(--white);
    color: var(--dark);
    padding: 12px 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
}

/* RESPONSIVE */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0, 208, 156, 0.3);
}

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

.btn-secondary {
    background: var(--dark);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(68, 71, 91, 0.2);
}

.btn-secondary:hover {
    background: #363849;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--dark);
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

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

.btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* TEXTAREA STYLING - for encoders/formatters */
.textarea-wrapper {
    width: 100%;
    margin-bottom: 1rem;
}

.textarea-wrapper label {
    display: block;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.textarea-wrapper textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.95rem;
    color: var(--dark);
    resize: vertical;
    min-height: 140px;
    line-height: 1.5;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.textarea-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 208, 156, 0.15);
}

.textarea-wrapper textarea[readonly] {
    background: #f8fafc;
    cursor: default;
}

.textarea-wrapper textarea::placeholder {
    color: var(--gray);
}

/* SELECT STYLING - for converters */
.select-wrapper {
    width: 100%;
    margin-top: 8px;
}

.select-wrapper select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    font-size: 1rem;
    font-weight: 500;
    color: var(--dark);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237c7e8c' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 208, 156, 0.15);
}

/* CONVERTER INPUT - number inputs for converters */
.converter-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.converter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 208, 156, 0.15);
}

.converter-input[readonly] {
    background: #f8fafc;
    cursor: default;
}

/* CONVERTER GRID LAYOUT */
.converter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.converter-col label {
    display: block;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

/* FORMULA BOX */
.formula-box {
    background: #f1f5f9;
    padding: 16px 20px;
    border-radius: 10px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.95rem;
    margin: 1rem 0;
    border: 1px solid var(--border);
    overflow-x: auto;
}

.formula-box.warning {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* RESULT DISPLAY BOX */
.result-box {
    background: #ecfdf5;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #d1fae5;
    margin-top: 1.5rem;
}

.result-box .result-label {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 0.3rem;
}

.result-box .result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* FAQ SECTION */
.faq-section {
    margin-top: 2rem;
}

.faq-section h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

/* HEADER WITH NAVIGATION */
header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-nav {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0;
    margin: 0;
    padding: 0;
}

.nav-menu>li {
    position: relative;
}

.nav-menu>li>a {
    display: block;
    padding: 1.2rem 1.5rem;
    color: var(--dark);
    font-weight: 600;
    transition: color 0.2s;
}

.nav-menu>li>a:hover {
    color: var(--primary);
}

/* Dropdown menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    min-width: 240px;
    box-shadow: var(--shadow);
    border-radius: 8px;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    border: 1px solid var(--border);
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.7rem 1.2rem;
    color: var(--dark);
    transition: color 0.2s, background-color 0.2s;
}

.dropdown-menu a:hover {
    background: #f8fafc;
    color: var(--primary);
    padding-left: 1.5rem;
}

/* ADVERTISEMENT SLOT */
.ad-slot {
    margin-bottom: 1.5rem;
}

.ad-label {
    font-size: 0.75rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    text-align: center;
}

.ad-container {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-container>* {
    max-width: 100%;
    height: auto;
}

/* INFO CARD - AD SIZE (300x250) */
.info-card-ad-size {
    width: 300px;
    height: 278px;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.info-card-ad-size .sidebar-title {
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.info-card-ad-size .info-content {
    flex: 1;
    overflow-y: auto;
}

.info-card-ad-size .info-content p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.info-card-ad-size .info-content p strong {
    color: var(--primary);
    display: block;
    margin-bottom: 0.3rem;
}

@media (max-width: 900px) {
    .page-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .calc-inner-grid {
        flex-direction: column;
        gap: 3rem;
    }

    .calc-results {
        width: 100%;
    }

    .converter-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    /* Mobile navigation - simplified for now */
    header .container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    /* Reduce logo size on mobile */
    .brand img {
        max-width: 120px;
    }

    .main-nav {
        width: 100%;
        margin-top: 1rem;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
    }

    .nav-menu>li>a {
        padding: 0.8rem 0;
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        padding-left: 1rem;
        background: transparent;
    }

    /* Info card responsive */
    .info-card-ad-size {
        width: 100%;
        height: auto;
        min-height: 200px;
    }
}

/* NAVBAR & MEGA MENU STYLES */
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    contain: none; /* Override .container's contain:layout to allow fixed positioning in mega-menu */
}



@media (min-width: 768px) {
    .brand img {
        max-width: 133px;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1003;
    /* Ensure above everything */
    margin-left: auto;
    /* Push to right just in case */
    position: relative;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--dark);
    transition: 0.3s;
}

.mobile-menu-toggle[aria-expanded="true"] {
    /* Keep flow position, just style it */
    position: relative;
    top: auto;
    right: auto;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 0;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

@media (min-width: 900px) {
    .mobile-menu-toggle {
        display: none !important;
    }
}

/* Main Navigation */
.main-nav {
    display: none;
}

@media (min-width: 900px) {
    .main-nav {
        display: block;
        flex: 1;
    }
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-menu>li>a {
    font-weight: 500;
    color: var(--dark);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: color 0.2s, background-color 0.2s;
}

.nav-menu>li>a:hover {
    background: var(--light-bg);
    color: var(--primary);
}

.arrow {
    font-size: 0.8em;
    margin-left: 4px;
}

/* Dropdown Menus (Regular) */
.dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 1000;
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--dark);
    font-size: 0.95rem;
    transition: 0.15s;
}

.dropdown-menu a:hover {
    background: var(--light-bg);
    color: var(--primary);
}

/* Mega Menu (Full Width) */
.mega-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Invisible bridge to prevent flickering */
.mega-dropdown::after,
.dropdown::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 50px;
    /* Covers gap to bottom of header */
    background: transparent;
    z-index: 10;
}

/* Full-width dropdown background, content centered in container */
.mega-menu {
    position: fixed;
    inset: calc(var(--header-height, 75px) - 10px) 0 auto 0;
    margin: 0;
    background: var(--white);
    border-bottom: 2px solid var(--border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    padding: 1.5rem 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 998;
    max-height: calc(100vh - var(--header-height, 75px));
    overflow: visible;
}

.mega-dropdown:hover .mega-menu,
.mega-dropdown:focus-within .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Compact dropdown (1-2 columns) */
.mega-menu[data-columns="1"],
.mega-menu[data-columns="2"] {
    position: absolute;
    left: 0 !important;
    right: auto !important;
    width: auto;
    min-width: 280px;
    max-width: 400px;
    top: 100%;
    padding: 1rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* Arrow pointer */
.mega-menu[data-columns="1"]::before,
.mega-menu[data-columns="2"]::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 24px;
    width: 14px;
    height: 14px;
    background: var(--white);
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
    transform: rotate(45deg);
}

/* Adjust inner grid for compact */
.mega-menu[data-columns="1"] .mega-menu-inner {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 1rem;
}

.mega-menu[data-columns="2"] .mega-menu-inner {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.mega-menu[data-columns="1"] .mega-menu-inner,
.mega-menu[data-columns="2"] .mega-menu-inner {
    width: auto;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}

/* Remove border from single column */
.mega-menu[data-columns="1"] .mega-column {
    border-right: none;
    padding-right: 0;
}

.mega-menu-inner {
    width: calc(100% - 40px);
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    box-sizing: border-box;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mega-column {
    border-right: 1px dashed var(--border);
    padding-right: 2rem;
    box-sizing: border-box;
    min-width: 0; /* Prevent grid blowout */
}

.mega-column:last-child:not(.popular-column) {
    border-right: none;
    padding-right: 0;
}

.mega-column h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray);
    margin: 0 0 1.25rem 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mega-column a {
    display: block;
    padding: 0.65rem 0.75rem;
    color: var(--dark);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.mega-column a:hover {
    background: var(--light-bg);
    color: var(--primary);
    padding-left: 1.25rem;
    transform: translateX(4px);
}

.popular-column {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    padding: 1rem;
    border-radius: 12px;
    border: 2px solid #d1fae5;
    box-shadow: 0 4px 12px rgba(0, 208, 156, 0.08);
    box-sizing: border-box;
    margin-right: 0;
}

.popular-column h4 {
    color: var(--primary);
    font-size: 0.85rem;
}

.popular-column a {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 208, 156, 0.1);
}

.popular-column a:hover {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 208, 156, 0.15);
}

/* Search Container */
.search-container {
    position: relative;
    margin-left: auto;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    pointer-events: none;
    z-index: 2;
    /* Ensure above input */
}

#navSearch {
    width: 200px;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--light-bg);
    font-size: 0.9rem;
    color: var(--dark);
    transition: border-color 0.2s, box-shadow 0.2s;
}

#navSearch:focus {
    outline: none;
    width: 280px;
    background: var(--white);
    border-color: var(--primary);
    /* box-shadow: 0 0 0 3px rgba(0, 208, 156, 0.1); */
    /* Removed shadow per feedback */
}

.search-results {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 360px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.05);
    max-height: 450px;
    overflow-y: auto;
    display: none;
    z-index: 1002;
    padding: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.search-results.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: searchFadeIn 0.2s ease forwards;
}

@keyframes searchFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-result-item {
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
}

.search-result-item:last-child {
    margin-bottom: 0;
}

.search-result-item:hover,
.search-result-item[aria-selected="true"] {
    background: #f0fdf9;
    /* Very light primary tint */
    border-color: rgba(0, 208, 156, 0.2);
    transform: translateX(4px);
}

.search-result-name {
    font-weight: 700;
    color: var(--dark);
    font-size: 1rem;
    margin-bottom: 2px;
}

.search-result-category {
    font-size: 0.75rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    background: rgba(0, 208, 156, 0.1);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    align-self: flex-start;
}

.search-no-results {
    padding: 2rem;
    text-align: center;
    color: var(--gray);
    font-weight: 500;
}

/* Mobile Navigation Styles */
@media (max-width: 899px) {
    .main-nav {
        position: fixed;
        top: 75px;
        /* Start below header */
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--white);
        padding: 20px;
        /* Remove top padding */
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 1000;
        height: calc(100vh - 75px);
        border-top: 1px solid var(--border);
    }

    .main-nav.active {
        display: block;
        transform: translateX(0);
    }

    .nav-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .nav-menu>li {
        border-bottom: 1px solid var(--border);
    }

    .nav-menu>li>a {
        display: block;
        padding: 1rem;
        font-size: 1.1rem;
    }

    .dropdown-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .dropdown-menu,
    .mega-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        padding: 0 0 0 1rem;
        background: transparent;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s;
    }

    .dropdown.active .dropdown-menu,
    .mega-dropdown.active .mega-menu {
        max-height: 1000px;
        padding: 0.5rem 0 0.5rem 1rem;
    }

    .mega-menu-inner {
        display: block;
        padding: 0;
    }

    .mega-column {
        border-right: none;
        padding-right: 0;
        margin-bottom: 1.5rem;
    }

    .popular-column {
        background: var(--light-bg);
    }

    .search-container {
        margin: 1rem 0;
        padding: 1rem;
        background: var(--light-bg);
        border-radius: 8px;
    }

    .search-icon {
        left: 28px;
    }


    #navSearch {
        width: 100%;
    }

    #navSearch:focus {
        width: 100%;
    }

    .search-results {
        right: auto;
        left: 0;
        width: 100%;
        min-width: unset;
        position: absolute;
        /* Changed from static to absolute to sit over menu */
        top: 100%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border: 1px solid var(--border);
        border-top: none;
        border-radius: 0 0 8px 8px;
        animation: none;
        opacity: 1;
        transform: none;
        z-index: 1002;
        background: var(--white);
    }
}

/* RELATED TOOLS SECTION (Bottom of Page) */
.related-tools-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related-tools-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--dark);
}

.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.related-tool-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.related-tool-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 208, 156, 0.15);
    transform: translateY(-2px);
}

.related-tool-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dark);
}

.related-tool-card:hover .related-tool-name {
    color: var(--primary);
}

/* Pillar link card - slightly different style */
.related-tool-card--pillar {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 2px solid #d1fae5;
}

.related-tool-card--pillar .related-tool-name {
    color: var(--primary);
    font-weight: 700;
}

.related-tool-card--pillar:hover {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

/* PILLAR PAGE STYLES */
.pillar-page {
    max-width: 100%;
}

.tools-grid-section {
    margin-bottom: 2.5rem;
}

.tools-grid-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    margin-top: 0;
    color: var(--dark);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.tools-grid .tool-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dark);
    box-shadow: none;
    margin-bottom: 0;
    transition: all 0.2s ease;
}

.tools-grid .tool-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 208, 156, 0.15);
    transform: translateY(-2px);
}

@media (max-width: 900px) {
    .related-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .related-tools-grid {
        grid-template-columns: 1fr;
    }

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