/* ========================================
   RESPONSIVE LAYOUT SYSTEM
   Mobile-first responsive design
   ======================================== */

body {
    font-family: 'Roboto', Arial, sans-serif;
    background: #f7fafd;
    margin: 0;
    padding: 0;
    color: #222;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden; /* Prevent horizontal scroll */
    /* Add SVG background pattern for tools/functions */
    background-image:
      url('data:image/svg+xml;utf8,<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg"><g opacity="0.05"><rect x="10" y="10" width="24" height="24" rx="6" fill="%231976d2"/><circle cx="90" cy="30" r="12" fill="%2343a047"/><rect x="60" y="80" width="32" height="12" rx="6" fill="%23e53935"/><path d="M30 90 Q40 100 50 90" stroke="%23ffb300" stroke-width="4" fill="none"/><rect x="80" y="60" width="18" height="18" rx="4" fill="%23fbc02d"/><circle cx="30" cy="80" r="8" fill="%231976d2"/></g></svg>');
    background-repeat: repeat;
    background-size: 220px 220px;
}

/* Reset and box-sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Bootstrap-style margin utility classes for icon spacing */
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; }

/* Icon spacing in all contexts */
i + *:not(i),
.fas + *:not(i):not(.fas):not(.far):not(.fab),
.far + *:not(i):not(.fas):not(.far):not(.fab),
.fab + *:not(i):not(.fas):not(.far):not(.fab) {
    margin-left: 0.3rem;
}

/* Icon spacing when icon comes first in labels, buttons, etc. */
label i,
button i,
.btn i,
.tool-btn i,
h1 i, h2 i, h3 i, h4 i, h5 i, h6 i {
    margin-right: 0.5rem;
}

/* Specific spacing for common FontAwesome icon patterns */
.fas.fa-calculator,
.fas.fa-venus-mars,
.fas.fa-birthday-cake,
.fas.fa-weight,
.fas.fa-ruler-vertical,
.fas.fa-flask,
.fas.fa-percentage,
.fas.fa-running,
.fas.fa-redo,
.fas.fa-chart-line {
    margin-right: 0.5rem;
}

/* Ensure icons in flex containers are properly spaced */
.flex, .d-flex, [style*="display: flex"] {
    align-items: center;
}

.flex > i,
.d-flex > i,
[style*="display: flex"] > i {
    margin-right: 0.5rem;
}

/* Mobile-first form and input styling */
input, textarea, select, button {
    font-size: 16px; /* Prevent zoom on iOS */
    font-family: inherit;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    input, textarea, select {
        width: 100%;
        min-height: 44px; /* Touch-friendly size */
        padding: 12px 16px;
        border-radius: 8px;
        border: 1px solid #ddd;
        font-size: 16px;
    }
    
    button, .btn, .tool-btn {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 8px;
        cursor: pointer;
        border: none;
        background: #1976d2;
        color: white;
        width: 100%;
        margin: 8px 0;
        touch-action: manipulation; /* Improve touch response */
    }
}

/* Container System */
.container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
    width: 100%;
}

/* Mobile-first responsive containers */
@media (max-width: 480px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    .container {
        padding-left: 24px;
        padding-right: 24px;
    }
}

@media (min-width: 993px) {
    .container {
        padding-left: 30px;
        padding-right: 30px;
    }
}

/* Header Section */
header {
    background: #1976d2;
    color: #fff;
    padding: 16px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    header {
        padding: 20px 0;
    }
}
/* ========================================
   NAVIGATION SYSTEM - MOBILE FIRST
   ======================================== */

/* Navigation Container */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    position: relative;
    z-index: 1001;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Logo Styling */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

@media (min-width: 768px) {
    .logo {
        font-size: 2rem;
    }
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1001;
    min-height: 50px;
    width: 100%;
}

.logo {
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (min-width: 768px) {
    .logo {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }
}

@media (min-width: 992px) {
    .logo {
        font-size: 2rem;
    }
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    min-height: 44px; /* Touch-friendly */
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Navigation Links */
.nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1002;
    padding: 0;
    margin: 0;
    list-style: none;
    border-radius: 0 0 12px 12px;
    max-height: 80vh;
    overflow-y: auto;
    margin-top: 8px;
}

.nav-links.active {
    display: flex;
}

/* Dropdown Content Base Styles */
.dropdown-content {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li {
    border-bottom: 1px solid #f0f0f0;
}

.nav-links li:last-child {
    border-bottom: none;
}

.nav-links a {
    color: #333;
    text-decoration: none;
    padding: 16px 20px;
    font-weight: 500;
    transition: all 0.2s;
    display: block;
    font-size: 1rem;
}

.nav-links a:hover {
    color: #1976d2;
    background-color: #f8f9fa;
}

/* Mobile Navigation (up to 1023px) */
@media (max-width: 1023px) {
    .menu-toggle {
        display: block;
        z-index: 1003;
    }
    
    .nav-links {
        display: none;
        background: #fff !important;
        color: #333 !important;
        border: 1px solid #e0e0e0;
        z-index: 1002;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-top: 8px;
    }
    
    .nav-links.active {
        display: flex;
        z-index: 1002;
    }
    
    .nav-links a {
        color: #333 !important;
        text-decoration: none;
        padding: 16px 20px;
        font-weight: 500;
        display: block;
        font-size: 1rem;
        background: transparent !important;
        border: none !important;
        position: relative;
        z-index: 1003;
    }
    
    .nav-links a:hover,
    .nav-links a:focus {
        color: #1976d2 !important;
        background-color: #f8f9fa !important;
    }
    
    /* Ensure mobile navigation text is always visible */
    .nav-links * {
        color: inherit !important;
    }
}

/* Desktop Navigation */
@media (min-width: 1024px) {
    .menu-toggle {
        display: none;
    }
    
    .nav-links {
        display: flex;
        flex-direction: row;
        position: static;
        background: none;
        box-shadow: none;
        padding: 0;
        border-radius: 0;
        max-height: none;
        overflow: visible;
        gap: 0.5rem;
        align-items: center;
    }
    
    .nav-links li {
        border-bottom: none;
    }
    
    .nav-links a {
        color: #fff;
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    .nav-links a:hover {
        color: #90caf9;
        background-color: transparent;
    }
}

/* Mobile dropdown functionality */
@media (max-width: 1023px) {
    /* Ensure all mobile navigation text is visible */
    .nav-links li {
        background: #fff !important;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        z-index: 1003;
    }
    
    .nav-links li:last-child {
        border-bottom: none;
    }
    
    .nav-dropdown > .dropdown-content {
        position: static;
        display: none;
        background: #f8f9fa !important;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        margin: 0;
        z-index: 1004;
    }
    
    .nav-dropdown.mobile-open > .dropdown-content {
        display: block;
        z-index: 1004;
    }
    
    .nav-dropdown > .dropdown-content a {
        padding: 12px 40px;
        color: #555 !important;
        font-size: 0.9rem;
        border-bottom: 1px solid #e9ecef;
        background: transparent !important;
        position: relative;
        z-index: 1005;
    }
    
    .nav-dropdown > .dropdown-content a:hover {
        background-color: #e9ecef !important;
        color: #1976d2 !important;
    }
}

@media (min-width: 1200px) {
    .nav-links a {
        padding: 12px 20px;
        font-size: 1rem;
    }
}
/* ========================================
   HERO SECTION - RESPONSIVE
   ======================================== */

.hero {
    text-align: center;
    padding: 30px 0 24px 0;
    background: #e3f2fd;
}

.hero h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    line-height: 1.3;
    font-weight: 600;
}

.hero p {
    font-size: 1rem;
    margin-bottom: 20px;
    line-height: 1.5;
    color: #555;
}

.hero .cta-btn {
    background: #43a047;
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.hero .cta-btn:hover {
    background: #388e3c;
    transform: translateY(-2px);
}

/* Tablet Hero */
@media (min-width: 768px) {
    .hero {
        padding: 40px 0 32px 0;
    }
    
    .hero h1 {
        font-size: 2.2rem;
        margin-bottom: 16px;
    }
    
    .hero p {
        font-size: 1.1rem;
        margin-bottom: 24px;
    }
    
    .hero .cta-btn {
        padding: 14px 28px;
        font-size: 1.1rem;
    }
}

/* Desktop Hero */
@media (min-width: 992px) {
    .hero {
        padding: 60px 0 40px 0;
    }
    
    .hero h1 {
        font-size: 2.5rem;
        margin-bottom: 16px;
    }
    
    .hero p {
        font-size: 1.2rem;
        margin-bottom: 24px;
    }
    
    .hero .cta-btn {
        padding: 14px 32px;
    }
}

/* ========================================
   CARD SYSTEM - RESPONSIVE GRID
   ======================================== */

.section-title {
    font-size: 1.3rem;
    margin: 30px 0 16px 0;
    color: #1976d2;
    font-weight: 600;
}

@media (min-width: 768px) {
    .section-title {
        font-size: 1.4rem;
        margin: 36px 0 20px 0;
    }
}

@media (min-width: 992px) {
    .section-title {
        font-size: 1.5rem;
        margin: 40px 0 20px 0;
    }
}

.cards, .featured-cards, .category-cards {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
}

/* Mobile Landscape and Tablet */
@media (min-width: 480px) {
    .cards, .featured-cards, .category-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Tablet */
@media (min-width: 768px) {
    .cards, .featured-cards, .category-cards {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 24px;
    }
}

/* Desktop */
@media (min-width: 992px) {
    .cards, .featured-cards, .category-cards {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

.card, .featured-card, .tool-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #e3e6ea;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover, .featured-card:hover, .tool-card:hover {
    box-shadow: 0 8px 25px rgba(25, 118, 210, 0.15);
    transform: translateY(-4px);
    border-color: #1976d2;
}

.card img, .featured-card .tool-icon, .tool-card .tool-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    font-size: 2rem;
    color: #1976d2;
}

.card-title, .featured-card h3, .tool-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.3;
}

.card-desc, .featured-card p, .tool-card p {
    font-size: 0.9rem;
    margin-bottom: 16px;
    color: #666;
    line-height: 1.4;
    flex-grow: 1;
}

.card .tool-btn, .featured-card .tool-btn, .tool-card .tool-btn {
    background: #1976d2;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    font-size: 0.95rem;
    margin-top: auto;
}

.card .tool-btn:hover, .featured-card .tool-btn:hover, .tool-card .tool-btn:hover {
    background: #1565c0;
    transform: translateY(-1px);
}

@media (min-width: 768px) {
    .card, .featured-card, .tool-card {
        padding: 24px;
    }
    
    .card-title, .featured-card h3, .tool-card h3 {
        font-size: 1.15rem;
    }
    
    .card-desc, .featured-card p, .tool-card p {
        font-size: 0.95rem;
    }
}

/* Legacy card styles - keeping for compatibility */
.card:hover {
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.12);
}
.card img {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
}
.card-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 8px;
}
.card-desc {
    font-size: 0.98rem;
    margin-bottom: 16px;
    color: #555;
}
.card .tool-btn {
    background: #1976d2;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}
.card .tool-btn:hover {
    background: #1565c0;
}
.categories {
    margin: 40px 0;
}
.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.categories-list-featured {
    margin-bottom: 24px;
    justify-content: center;
}
.category {
    background: #e8f5e9;
    color: #388e3c;
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 1rem;
}
.category-group {
    width: 100%;
    margin-bottom: 24px;
}
.category-parent {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: #1976d2;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
}
.category-arrow {
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s;
}
.category-group.collapsed .category-child-list {
    display: none;
}
.category-group.collapsed .category-arrow {
    transform: rotate(-90deg);
}
.tool-desc {
    display: block;
    font-size: 0.92em;
    color: #555;
}
.testimonials {
    background: #f1f8e9;
    padding: 40px 0;
    margin: 40px 0 0 0;
}
.testimonial {
    max-width: 600px;
    margin: 0 auto 24px auto;
    font-style: italic;
    color: #333;
}
.testimonial-author {
    text-align: right;
    font-weight: bold;
    color: #388e3c;
}
/* ========================================
   RESPONSIVE FOOTER
   ======================================== */

footer {
    background: #232f3e;
    color: #b0bec5;
    padding: 30px 0 20px 0;
    text-align: center;
    margin-top: auto;
    flex-shrink: 0;
    border-top: 1px solid #1a222c;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

footer a {
    color: #90caf9;
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: #fff;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.footer-links a {
    color: #90caf9;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
    margin: 0 4px;
}

.footer-links a:hover {
    color: #fff;
}

@media (min-width: 768px) {
    footer {
        padding: 40px 0 24px 0;
    }
    
    .footer-links {
        gap: 24px 32px;
        margin-bottom: 24px;
    }
    
    .footer-links a {
        font-size: 1rem;
        margin: 0 8px;
    }
}

/* Mobile footer spacing adjustments */
@media (max-width: 767px) {
    /* Smaller footer padding on mobile */
    footer {
        padding: 20px 0 16px 0;
    }
    
    /* Reduce footer categories spacing on mobile */
    .footer-tools-categories {
        padding: 16px 12px;
        margin-bottom: 12px;
    }
}

.footer-tools-categories {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    background: #232f3e;
    border-radius: 12px;
    padding: 20px 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

@media (min-width: 480px) {
    .footer-tools-categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (min-width: 768px) {
    .footer-tools-categories {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
        padding: 24px 20px;
    }
}

@media (min-width: 992px) {
    .footer-tools-categories {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
        padding: 32px 24px;
    }
}

@media (min-width: 1200px) {
    .footer-tools-categories {
        grid-template-columns: repeat(6, 1fr);
    }
}

.footer-tools-categories > div {
    margin-bottom: 8px;
}

.footer-tools-categories > div > div {
    font-weight: 600;
    color: #90caf9;
    margin-bottom: 12px;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.footer-tools-categories a {
    color: #e3f2fd;
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.footer-tools-categories a:hover {
    background: #1976d2;
    color: #fff;
    transform: translateX(4px);
}
/* ========================================
   DROPDOWN NAVIGATION - MOBILE RESPONSIVE
   ======================================== */

.nav-dropdown {
    position: relative;
    display: block;
    z-index: 1002;
}

/* Mobile Dropdown Styles */
.dropdown-content {
    display: none;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 0;
    margin-top: 8px;
    border-left: 3px solid #1976d2;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.nav-dropdown.active .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: #555;
    padding: 12px 24px;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    transition: all 0.2s;
    border-radius: 4px;
    margin: 0 8px;
}

.dropdown-content a:hover {
    background: #e3f2fd;
    color: #1976d2;
}

/* Desktop Dropdown Styles */
@media (min-width: 1024px) {
    .nav-dropdown {
        position: relative;
        display: inline-block;
    }
    
    .dropdown-content {
        display: none;
        position: absolute;
        background: #fff;
        min-width: 200px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 1010;
        border-radius: 8px;
        margin-top: 8px;
        padding: 8px 0;
        border-left: none;
        border: 1px solid #e0e0e0;
    }
    
    .nav-dropdown:hover .dropdown-content,
    .nav-dropdown:focus-within .dropdown-content {
        display: block;
    }
    
    .nav-dropdown.active .dropdown-content {
        display: block;
    }
    
    .dropdown-content a {
        color: #333;
        padding: 12px 20px;
        font-size: 0.95rem;
        margin: 0;
        border-radius: 0;
    }
    
    .dropdown-content a:hover {
        background: #f0f4fa;
        color: #1976d2;
    }
}

/* Submenu Styles */
.dropdown-submenu {
    position: relative;
    z-index: 1011;
}

.dropdown-submenu > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    background: none;
    font-size: 0.95rem;
    transition: background 0.2s;
    cursor: pointer;
}

.dropdown-submenu > a::after {
    content: '▶';
    font-size: 0.7em;
    margin-left: 8px;
    color: #888;
    transition: transform 0.2s;
}

@media (max-width: 1023px) {
    .dropdown-submenu > a::after {
        content: '▼';
    }
    
    .dropdown-submenu.active > a::after {
        transform: rotate(180deg);
    }
}

.dropdown-submenu > a:hover {
    background: #f0f4fa;
}

.dropdown-submenu > .dropdown-content {
    display: none;
    position: static;
    box-shadow: none;
    margin-top: 0;
    background: #f8f9fa;
    border-radius: 0;
    border-left: 2px solid #1976d2;
    margin-left: 20px;
}

@media (min-width: 1024px) {
    .dropdown-submenu > .dropdown-content {
        position: absolute;
        left: 100%;
        top: 0;
        min-width: 200px;
        background: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        border-radius: 8px;
        z-index: 1013;
        margin-left: 4px;
        border: 1px solid #e0e0e0;
        border-left: 1px solid #e0e0e0;
    }
}

.dropdown-submenu:hover > .dropdown-content,
.dropdown-submenu:focus-within > .dropdown-content,
.dropdown-submenu.active > .dropdown-content {
    display: block;
}
.dropdown-submenu:hover > .dropdown-content,
.dropdown-submenu:focus-within > .dropdown-content,
.dropdown-submenu > a:hover + .dropdown-content {
    display: block;
}
.dropdown-submenu > .dropdown-content a {
    padding: 10px 18px;
    color: #222;
    text-decoration: none;
    display: block;
    font-size: 1rem;
    transition: background 0.2s;
    z-index: 1014;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    color: #1976d2;
    cursor: pointer;
    margin-left: 16px;
}
.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    position: relative;
    z-index: 1001;
}
@media (max-width: 900px) {
    .nav-links {
        gap: 0.2rem;
    }
}
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.10);
        z-index: 1000;
        padding: 18px 0 12px 0;
        border-radius: 0 0 10px 10px;
    }
    .nav-links.open {
        display: flex;
    }
    .nav-links a {
        padding: 12px 24px;
        font-size: 1.08rem;
        border-bottom: 1px solid #f0f0f0;
        width: 100%;
        text-align: left;
    }
    .logo {
        font-size: 1.3rem;
    }
    nav {
        position: relative;
    }
}
@media (max-width: 480px) {
    .logo {
        font-size: 1.1rem;
    }
    .nav-links a {
        font-size: 1rem;
        padding: 10px 16px;
    }
}

@media (max-width: 1200px) {
  .ad-left, .ad-right {
    display: none;
  }
}
/* Featured Tools Section */
.featured-tools {
    background: transparent;
    padding: 24px 0 18px 0;
    border-radius: 14px;
    margin-bottom: 32px;
}
.featured-cards, .category-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center; /* Center cards on all screen sizes */
}

/* Mobile - Center single column */
@media (max-width: 480px) {
    .featured-cards, .category-cards {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
}
.featured-card, .tool-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 16px #0002;
    padding: 24px 22px 20px 22px;
    max-width: 260px;
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

/* Mobile card styling */
@media (max-width: 480px) {
    .featured-card, .tool-card {
        max-width: 300px;
        width: 90%;
        flex: none;
        margin: 0 auto;
    }
}

.featured-card, .tool-card {
    transition: box-shadow 0.2s, transform 0.2s;
    border: 1px solid #e3e6ea;
    position: relative;
    /* Add padding-bottom for background image visibility */
    padding-bottom: 40px;
    overflow: hidden;
}
.featured-card:hover, .tool-card:hover {
    box-shadow: 0 8px 32px #1976d220;
    transform: translateY(-4px) scale(1.03);
    border-color: #1976d2;
}
.tool-card .tool-icon, .featured-card .tool-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
    color: #1976d2;
}
.tool-card h3, .featured-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.18rem;
    font-weight: 700;
}
.tool-card p, .featured-card p {
    margin: 0 0 18px 0;
    color: #444;
    font-size: 0.98rem;
}
.tool-card .tool-btn, .featured-card .tool-btn {
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
    box-shadow: 0 2px 8px #1976d220;
}
.tool-card .tool-btn:hover, .featured-card .tool-btn:hover {
    background: #1251a3;
}
.category-group {
    margin-bottom: 36px;
}
.category-parent {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1976d2;
}
#tool-search {
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
    padding: 10px 14px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
}
html, body {
    height: 100%;
}
/* Add a subtle overlay for better readability */
body::before {
    content: "";
    position: fixed;
    z-index: 0;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    background: linear-gradient(120deg, #f7fafd 80%, #e3f2fd 100%);
    opacity: 0.7;
}

/* Main content layout for sticky footer */
main, .tool-main, .main-content, .bmr-tool-main {
    flex: 1;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow shrinking in flex container */
}

/* Create a content wrapper for everything between header and footer */
body > *:not(header):not(footer) {
    flex-shrink: 0;
}

/* Ensure the main content area takes remaining space */
body > main:last-of-type,
body > .tool-main:last-of-type,
body > .bmr-tool-main:last-of-type {
    flex: 1;
    margin-bottom: 0;
}

/* Add spacing for main content that directly follows header (no hero section) */
body > main:first-of-type,
body > .tool-main:first-of-type,
body > .bmr-tool-main:first-of-type {
    padding-top: 90px; /* Space for mobile header */
}

@media (min-width: 768px) {
    body > main:first-of-type,
    body > .tool-main:first-of-type,
    body > .bmr-tool-main:first-of-type {
        padding-top: 100px; /* Space for desktop header */
    }
}

/* Handle hero sections that are outside main */
.bmr-hero-section, .hero-section, .tool-hero {
    flex-shrink: 0; /* Don't let hero shrink */
    margin-bottom: 0; /* Remove default margin */
    /* Add top spacing to account for sticky header */
    padding-top: 90px; /* Space for mobile header */
}

/* Responsive header spacing for hero sections */
@media (min-width: 768px) {
    .bmr-hero-section, .hero-section, .tool-hero {
        padding-top: 100px; /* Space for desktop header */
    }
}

/* When hero is outside main, adjust main to not take full space */
.bmr-hero-section + main,
.hero-section + main,
.tool-hero + main {
    flex: 1;
    flex-grow: 1;
    min-height: 0;
}

/* Ensure tool containers within main take available height */
.bmr-tool-main .container,
.tool-main .container,
main .container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Content spacing from footer - use minimal internal padding */
.tool-main,
.bmr-tool-main,
main {
    padding-bottom: 40px;
    box-sizing: border-box;
}

/* Override tool-specific min-heights that conflict with flexbox */
.bmr-tool-main {
    min-height: auto !important;
}

/* Ensure all tool pages follow the same layout rules */
.tool-main {
    min-height: auto !important;
}

/* Force footer to always position correctly */
footer {
    margin-top: auto !important;
    position: relative !important;
    z-index: 10 !important;
}

/* Remove margin for last content element - footer will auto-position */
body > *:not(footer):last-of-type {
    margin-bottom: 0;
    padding-bottom: 40px;
}

/* Mobile responsive spacing */
@media (max-width: 767px) {
    .tool-main,
    .bmr-tool-main,
    main {
        padding-bottom: 30px;
    }
    
    body > *:not(footer):last-of-type {
        padding-bottom: 30px;
    }
}

/* Raise main content above background images */
main, header, footer, .container {
    position: relative;
    z-index: 1;
}

/* Tool-themed background image for cards */
.featured-card::before, .tool-card::before {
    content: "";
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 64px;
    height: 64px;
    opacity: 0.13;
    z-index: 0;
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    /* SVG with multiple tool icons for variety */
    background-image: url('data:image/svg+xml;utf8,<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"><g opacity="0.8"><circle cx="32" cy="32" r="28" fill="%231976d2"/><g><rect x="40" y="16" width="8" height="28" rx="2" fill="%23fbc02d" transform="rotate(30 40 16)"/><rect x="16" y="40" width="8" height="28" rx="2" fill="%2343a047" transform="rotate(-60 16 40)"/></g><g><rect x="24" y="24" width="16" height="16" rx="4" fill="%23fff"/><rect x="28" y="28" width="2" height="8" rx="1" fill="%231976d2"/><rect x="34" y="28" width="2" height="8" rx="1" fill="%231976d2"/></g><g><rect x="46" y="46" width="10" height="4" rx="2" fill="%23e53935" transform="rotate(45 46 46)"/></g></g></svg>');
}
/* Raise card content above background image */
.featured-card > *, .tool-card > * {
    position: relative;
    z-index: 1;
}

/* Fix dropdown going off-screen to the right: flip to left if needed */
@media (min-width: 769px) {
  .dropdown-content {
    right: auto;
    left: 0;
  }
  .nav-dropdown:last-child .dropdown-content,
  .nav-dropdown:nth-last-child(2) .dropdown-content {
    left: auto;
    right: 0;
  }
  /* For submenus: flip to left if near right edge */
  .dropdown-submenu > .dropdown-content {
    left: 100%;
    right: auto;
  }
  .nav-dropdown:last-child .dropdown-submenu > .dropdown-content,
  .nav-dropdown:nth-last-child(2) .dropdown-submenu > .dropdown-content {
    left: auto;
    right: 100%;
  }
}

/* Optional: Prevent dropdown from overflowing viewport horizontally */
.dropdown-content,
.dropdown-submenu > .dropdown-content {
    max-width: 320px;
    min-width: 180px;
    box-sizing: border-box;
    word-break: break-word;
    overflow-x: auto;
}

/* Ensure all dropdowns and submenus are always on top of everything */
nav,
.nav-links,
.nav-dropdown,
.nav-dropdown-multilevel,
.dropdown-content,
.dropdown-submenu,
.dropdown-submenu > .dropdown-content {
    z-index: 1011 !important;
}

.dropdown-content {
    z-index: 1010 !important;
}

.dropdown-content a {
    z-index: 1012 !important;
}

.dropdown-submenu {
    z-index: 1011 !important;
}

.dropdown-submenu > .dropdown-content {
    z-index: 1012 !important;
}

/* ========================================
   FOOTER SPACING FIX - CLEAN IMPLEMENTATION
   ======================================== */

/* Remove conflicting spacing rules that interfere with flexbox layout */
main, .tool-main, .main-content, .bmr-tool-main {
    margin-bottom: 0;
}

/* Universal override for all tool-specific CSS that might interfere with footer */
.tool-main,
.bmr-tool-main,
.beautifier-main,
.converter-main,
.calculator-main,
main {
    min-height: auto !important;
    height: auto !important;
    /* Ensure these elements don't force fixed heights */
}

/* Mobile adjustments - footer already properly configured above */
@media (max-width: 768px) {
    /* Additional mobile spacing if needed */
}
