/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables for consistent theming */
:root {
    --primary-color: #1a9e20;
    --primary-hover: #67af3d;
    --secondary-color: #4b5563;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #dbeafe;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --bg-dark: #202935;
    --white: #ffffff;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    --transition: all 0.2s ease-in-out;
}

/* Base Typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white);
    /* Improve text rendering on all devices */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Ensure proper text scaling */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Container and Layout - Full Desktop Width */
.container {
    max-width: 1700px; /* Increased from 1200px */
    margin: 0 auto;
    padding: 0 2rem; /* Increased padding for desktop */
}

.main-content {
    min-height: calc(100vh - 200px);
    padding-top: auto; /* Increased top padding */
}

/* Grid System */
.grid {
    display: grid;
    gap: 0.75rem;
}

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

/* Responsive Grid */
@media (min-width: 768px) {
    .md-grid-2 { grid-template-columns: repeat(2, 1fr); }
    .md-grid-3 { grid-template-columns: repeat(3, 1fr); }
    .md-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
    .lg-grid-2 { grid-template-columns: repeat(2, 1fr); }
    .lg-grid-3 { grid-template-columns: repeat(3, 1fr); }
    .lg-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Typography Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

/* Color Classes */
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-accent { color: var(--accent-color); }
.text-light { color: var(--text-light); }

.bg-primary { background-color: var(--primary-color); }
.bg-accent { background-color: var(--accent-color); }
.bg-accent-light { background-color: var(--accent-light); }
.bg-light { background-color: var(--bg-light); }

/* Spacing Classes */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-6 { margin: 1.5rem; }
.m-8 { margin: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }

.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

/* Border and Shadow Classes */
.border { border: 1px solid var(--border-color); }
.border-2 { border: 2px solid var(--border-color); }
.border-primary { border-color: var(--primary-color); }

.rounded { border-radius: var(--border-radius); }
.rounded-lg { border-radius: var(--border-radius-lg); }

.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Flexbox Classes */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

/* Display Classes */
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }

/* Transition Classes */
.transition { transition: var(--transition); }

/* Hover Effects */
.hover-shadow:hover { box-shadow: var(--shadow-md); }
.hover-primary:hover { color: var(--primary-color); }
.hover-border-primary:hover { border-color: var(--primary-color); }

/* Button Base Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px; /* Touch-friendly */
}

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

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

.btn-accent {
    background-color: var(--accent-color);
    color: var(--white);
}

.btn-accent:hover {
    background-color: var(--accent-hover);
    color: var(--white);
}

/* Responsive Utilities */
@media (max-width: 767px) {
    .mobile-hidden { display: none; }
    .mobile-block { display: block; }
}

@media (min-width: 768px) {
    .md-block { display: block; }
    .md-hidden { display: none; }
}

@media (min-width: 1024px) {
    .lg-block { display: block; }
    .lg-hidden { display: none; }
    .lg-flex { display: flex; }
}

/* Page Header Styles - Desktop Focused */
.page-header {
    text-align: center;
    padding: 2rem 0; /* Increased padding */
    margin-bottom: 1rem;
}

.page-title {
    font-size: 1.5rem; /* Reduced size for more balanced look */
    font-weight: 700; /* Bolder weight */
    color: var(--primary-color);
    margin-bottom: 0.5rem; /* Reduced gap after title */
    letter-spacing: 0.02em;
}

.page-intro {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.page-subtitle {
    font-size: 1.125rem; /* Larger subtitle */
    color: var(--text-light);
    margin-bottom: 1.5rem; /* Increased margin */
}

/* Category Section Styles - Desktop Enhanced */
.category-section {
    margin-bottom: 2rem; /* Increased spacing between sections */
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    background-color: var(--white);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

/* Category-specific background tints */
.category-section:nth-child(2) { /* Random Generator Tools */
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.02) 0%, rgba(255, 255, 255, 1) 100%);
    border-color: rgba(59, 130, 246, 0.1);
}

.category-section:nth-child(3) { /* Calculators */
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.02) 0%, rgba(255, 255, 255, 1) 100%);
    border-color: rgba(16, 185, 129, 0.1);
}

.category-section:nth-child(4) { /* Text Tools */
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.02) 0%, rgba(255, 255, 255, 1) 100%);
    border-color: rgba(139, 92, 246, 0.1);
}

.category-section:nth-child(5) { /* Image Tools */
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.02) 0%, rgba(255, 255, 255, 1) 100%);
    border-color: rgba(245, 158, 11, 0.1);
}

.category-section:nth-child(6) { /* Website Tools */
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.02) 0%, rgba(255, 255, 255, 1) 100%);
    border-color: rgba(239, 68, 68, 0.1);
}

.category-section:nth-child(7) { /* Unit Converters */
    background: linear-gradient(135deg, rgba(50, 146, 109, 0.02) 0%, rgba(255, 255, 255, 1) 100%);
    border-color: rgba(50, 146, 109, 0.1);
}

.category-section:nth-child(8) { /* Binary Tools */
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.02) 0%, rgba(255, 255, 255, 1) 100%);
    border-color: rgba(107, 114, 128, 0.1);
}

/* Category section hover effects */
.category-section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.category-title {
    font-size: 1.125rem; /* Smaller category titles */
    font-weight: 700; /* Bold weight */
    color: var(--primary-color);
    margin-bottom: 1rem; /* Reduced margin */
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color); /* Thinner border */
    text-align: left; /* Left-aligned like in the image */
}

/* Category-specific title colors */
.category-section:nth-child(2) .category-title { /* Random Generator Tools */
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.category-section:nth-child(3) .category-title { /* Calculators */
    color: #10b981;
    border-bottom-color: #10b981;
}

.category-section:nth-child(4) .category-title { /* Text Tools */
    color: #8b5cf6;
    border-bottom-color: #8b5cf6;
}

.category-section:nth-child(5) .category-title { /* Image Tools */
    color: #f59e0b;
    border-bottom-color: #f59e0b;
}

.category-section:nth-child(6) .category-title { /* Website Tools */
    color: #ef4444;
    border-bottom-color: #ef4444;
}

.category-section:nth-child(7) .category-title { /* Unit Converters */
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.category-section:nth-child(8) .category-title { /* Binary Tools */
    color: #6b7280;
    border-bottom-color: #6b7280;
}

/* Tool Card Styles - Rectangular Layout */
.tool-card {
    display: flex;
    flex-direction: row; /* Changed to row for horizontal layout */
    align-items: center;
    justify-content: center; /* Center content horizontally */
    padding: 0.75rem 1.25rem; /* Reduced vertical, increased horizontal padding */
    border: 1px solid var(--border-color); /* Thinner border */
    border-radius: var(--border-radius); /* Smaller border radius */
    text-decoration: none;
    color: var(--text-color);
    background-color: var(--white);
    text-align: center; /* Center-aligned text */
    font-weight: 500; /* Medium weight */
    transition: var(--transition);
    min-height: 60px; /* Reduced height for thinner boxes */
    max-height: 70px; /* Maximum height to keep them thin */
    font-size: 0.9rem; /* Appropriate text size */

}

.tool-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
    transform: translateY(-1px);
}

.tool-card i {
    font-size: 1.1rem;
    margin-right: 0.75rem; /* Changed from margin-bottom to margin-right */
    margin-bottom: 0; /* Remove bottom margin */
    color: var(--primary-color);
    flex-shrink: 0; /* Prevent icon from shrinking */
}

/* Category-specific tool card accents */
.category-section:nth-child(2) .tool-card:hover { /* Random Generator Tools */
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.category-section:nth-child(2) .tool-card i { /* Random Generator Tools */
    color: var(--accent-color);
}

.category-section:nth-child(3) .tool-card:hover { /* Calculators */
    border-color: #10b981;
    color: #10b981;
}

.category-section:nth-child(3) .tool-card i { /* Calculators */
    color: #10b981;
}

.category-section:nth-child(4) .tool-card:hover { /* Text Tools */
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.category-section:nth-child(4) .tool-card i { /* Text Tools */
    color: #8b5cf6;
}

.category-section:nth-child(5) .tool-card:hover { /* Image Tools */
    border-color: #f59e0b;
    color: #f59e0b;
}

.category-section:nth-child(5) .tool-card i { /* Image Tools */
    color: #f59e0b;
}

.category-section:nth-child(6) .tool-card:hover { /* Website Tools */
    border-color: #ef4444;
    color: #ef4444;
}

.category-section:nth-child(6) .tool-card i { /* Website Tools */
    color: #ef4444;
}

.category-section:nth-child(7) .tool-card:hover { /* Unit Converters */
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-section:nth-child(7) .tool-card i { /* Unit Converters */
    color: var(--primary-color);
}

.category-section:nth-child(8) .tool-card:hover { /* Binary Tools */
    border-color: #6b7280;
    color: #6b7280;
}

.category-section:nth-child(8) .tool-card i { /* Binary Tools */
    color: #6b7280;
}

/* Tools Grid - Desktop Optimized */
.tools-grid {
    display: grid;
    gap: 1rem; /* Increased gap for desktop */
    grid-template-columns: 1fr;
}

@media (min-width: 576px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

@media (min-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(4, 1fr); /* Keep 4 columns for desktop */
        gap: 1.5rem;
    }
}

@media (min-width: 1200px) {
    .tools-grid {
        grid-template-columns: repeat(4, 1fr); /* Maintain 4 columns on larger screens */
        gap: 2rem; /* Even larger gap on very wide screens */
    }
}

/* Social Buttons Styles */
.social-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0 0.25rem 0; /* Reduced bottom margin */
    padding: 0 0.5rem; /* Add horizontal padding for mobile */
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    color: var(--white);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
    min-height: 32px;
    white-space: nowrap; /* Prevent text wrapping */
    touch-action: manipulation; /* Improve touch responsiveness */
}

.social-btn:hover {
    opacity: 0.9;
    text-decoration: none;
    color: var(--white);
    transform: translateY(-1px);
}

.social-btn:active {
    transform: translateY(0);
    opacity: 0.8;
}

.social-btn.facebook {
    background: linear-gradient(135deg, #3b5998 0%, #4c70ba 100%);
    box-shadow: 0 2px 8px rgba(59, 89, 152, 0.3);
}
.social-btn.twitter {
    background: linear-gradient(135deg, #1da1f2 0%, #0d8bd9 100%);
    box-shadow: 0 2px 8px rgba(29, 161, 242, 0.3);
}
.social-btn.twitter-alt {
    background: linear-gradient(135deg, #1da1f2 0%, #0d8bd9 100%);
    box-shadow: 0 2px 8px rgba(29, 161, 242, 0.3);
}
.social-btn.linkedin {
    background: linear-gradient(135deg, #0077b5 0%, #005885 100%);
    box-shadow: 0 2px 8px rgba(0, 119, 181, 0.3);
}
.social-btn.reddit {
    background: linear-gradient(135deg, #ff4500 0%, #e03d00 100%);
    box-shadow: 0 2px 8px rgba(255, 69, 0, 0.3);
}
.social-btn.whatsapp {
    background: linear-gradient(135deg, #25d366 0%, #1ebe57 100%);
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}
.social-btn.pinterest {
    background: linear-gradient(135deg, #bd081c 0%, #a00717 100%);
    box-shadow: 0 2px 8px rgba(189, 8, 28, 0.3);
}

/* SEO Content Styles */
.seo-content {
    max-width: 800px;
    margin: 3rem auto 0;
    padding: 2rem;
    background-color: var(--bg-light);
    border-radius: var(--border-radius-lg);
}

.seo-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.seo-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 1.5rem 0 0.75rem;
}

.seo-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.seo-content ul, .seo-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.seo-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Mobile Optimizations - Maintain mobile functionality */
@media (max-width: 767px) {
    .container {
        padding: 0 1rem; /* Slightly more padding than before */
    }

    .page-header {
        padding: 1rem 0; /* Maintain some spacing */
    }

    .page-title {
        font-size: 1.75rem; /* Larger than before but smaller than desktop */
    }

    .page-subtitle {
        font-size: 1rem; /* Slightly larger */
    }

    .category-title {
        font-size: 1.25rem; /* Larger category titles on mobile */
        margin-bottom: 1rem;
    }

    .category-section {
        margin-bottom: 2rem; /* More spacing */
        padding: 1rem;
        border-radius: var(--border-radius);
    }

    .tool-card {
        padding: 0.75rem 1rem; /* Maintain horizontal layout padding */
        min-height: 55px; /* Thinner cards on mobile */
        max-height: 65px; /* Keep them thin */
        font-size: 0.85rem; /* Appropriate mobile text size */
        flex-direction: row; /* Maintain horizontal layout on mobile */
        justify-content: center; /* Center content on mobile too */
        text-align: center; /* Center-aligned text on mobile */
    }

    .tools-grid {
        gap: 0.75rem; /* Appropriate gap for mobile */
    }

    .tool-card i {
        font-size: 1rem; /* Appropriate icon size for mobile */
        margin-right: 0.5rem; /* Smaller margin on mobile */
        margin-bottom: 0; /* No bottom margin */
    }

    /* Social buttons mobile optimization */
    .social-buttons {
        gap: 0.4rem;
        margin: 1rem 0 0.5rem 0;
        padding: 0 0.25rem;
    }

    .social-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.6rem;
        min-height: 44px; /* Touch-friendly size */
        gap: 0.25rem;
    }

    .social-btn i {
        font-size: 0.9rem; /* Slightly larger icons on mobile */
    }

    .seo-content {
        margin-top: 2rem;
        padding: 1.5rem;
    }
}

/* Mobile Desktop Mode - Handles when mobile browsers switch to desktop mode */
@media (max-width: 1023px) and (min-width: 768px) {
    /* Ensure proper text sizing for mobile desktop mode */
    .page-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .page-subtitle {
        font-size: 1.125rem;
        line-height: 1.4;
    }

    .category-title {
        font-size: 1.125rem;
        line-height: 1.3;
    }

    .tool-card {
        font-size: 0.9rem;
        line-height: 1.4;
        padding: 0.75rem 1rem;
        min-height: 60px;
        max-height: 70px;
    }

    .tool-card i {
        font-size: 1.1rem;
    }

    /* Ensure proper container sizing */
    .container {
        padding: 0 1.5rem;
        max-width: 100%;
    }

    /* Improve text readability */
    body {
        font-size: 16px;
        line-height: 1.6;
    }

    /* Social buttons for tablet/mobile desktop mode */
    .social-buttons {
        gap: 0.5rem;
        margin: 1rem 0 0.5rem 0;
    }

    .social-btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
        min-height: 44px;
    }
}

/* Enhanced Mobile Portrait and Landscape Support */
@media (max-width: 767px) and (orientation: landscape) {
    .page-header {
        padding: 0.75rem 0;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .category-section {
        margin-bottom: 1.5rem;
    }

    .tool-card {
        min-height: 50px;
        max-height: 60px;
        font-size: 0.8rem;
    }

    /* Social buttons for landscape mobile */
    .social-buttons {
        gap: 0.3rem;
        margin: 0.75rem 0 0.5rem 0;
    }

    .social-btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.5rem;
        min-height: 40px; /* Slightly smaller for landscape */
    }
}

/* Improved support for various mobile viewport sizes */
@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .page-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .page-subtitle {
        font-size: 0.95rem;
    }

    .category-title {
        font-size: 1.1rem;
    }

    .tool-card {
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
        min-height: 50px;
        max-height: 60px;
    }

    .tool-card i {
        font-size: 0.9rem;
        margin-right: 0.4rem;
    }

    /* Social buttons for very small screens */
    .social-buttons {
        gap: 0.25rem;
        margin: 1rem 0 0.5rem 0;
        padding: 0 0.125rem;
        overflow-x: auto; /* Allow horizontal scroll if needed */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    .social-btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.5rem;
        min-height: 44px; /* Maintain touch-friendly size */
        flex-shrink: 0; /* Prevent shrinking */
    }

    .social-btn i {
        font-size: 0.8rem;
    }
}

/* Footer Styles */
.main-footer {
    background-color: var(--bg-dark);
    color: var(--white);
    margin-top: 3rem;
    padding: 2rem 0 1rem;
}

.footer-container {
    max-width: 1600px; /* Match header and main container */
    margin: 0 auto;
    padding: 0 2rem; /* Increased padding for desktop */
}

.footer-content {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    margin-bottom: 2rem;
}

.footer-section {
    display: flex;
    flex-direction: column;
}

.footer-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--white);
}

.footer-description {
    color: #d1d5db;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.social-links {
    display: flex;
    gap: 0.75rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
}

.social-link:hover {
    background-color: var(--primary-color);
    color: var(--white);
    text-decoration: none;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-link {
    color: #d1d5db;
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    text-align: center;
}

.footer-copyright {
    color: #9ca3af;
}

/* Footer Mobile Styles */
@media (max-width: 767px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .main-footer {
        padding: 1.5rem 0 1rem;
    }
}

/* Additional Mobile Desktop Mode Fixes */
@media screen and (max-width: 1024px) {
    /* Ensure all text elements are properly sized */
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Improve button and interactive element sizing */
    .btn, .tool-card, .nav-link, .social-btn {
        min-height: 44px; /* Ensure touch-friendly size */
        touch-action: manipulation; /* Improve touch responsiveness */
    }

    /* Ensure social buttons are properly sized on all mobile devices */
    .social-btn {
        min-width: 44px; /* Minimum width for touch targets */
        justify-content: center;
    }

    /* Prevent horizontal scrolling issues */
    .container, .nav-container, .footer-container {
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
    }

    /* Ensure proper text contrast and readability */
    .page-title, .category-title, .tool-card {
        text-shadow: none;
        font-weight: 600;
    }
}

/* Specific fixes for mobile browsers in desktop mode */
@media screen and (max-width: 1024px) and (min-resolution: 150dpi) {
    /* High DPI mobile devices in desktop mode */
    body {
        font-size: 16px;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .category-title {
        font-size: 1.25rem;
    }

    .tool-card {
        font-size: 0.9rem;
        padding: 0.8rem 1rem;
    }
}

/* Landscape orientation improvements for mobile desktop mode */
@media screen and (max-width: 1024px) and (orientation: landscape) {
    .page-header {
        padding: 1rem 0;
    }

    .category-section {
        margin-bottom: 1.5rem;
    }

    .tools-grid {
        gap: 1rem;
    }
}

/* Mobile browsers in desktop mode - wide screens but mobile user agent */
@media screen and (min-width: 980px) and (max-width: 1024px) {
    .social-buttons {
        gap: 0.6rem;
        margin: 1rem 0 0.75rem 0;
    }

    .social-btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.8rem;
        min-height: 44px;
    }
}

/* Ensure proper scaling on all mobile devices */
@media screen and (max-width: 1024px) {
    * {
        -webkit-text-size-adjust: none;
        -moz-text-size-adjust: none;
        -ms-text-size-adjust: none;
        text-size-adjust: none;
    }

    body {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    /* Ensure social buttons are visible and functional */
    .social-btn {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Responsive mode-specific social button styles */
.mobile-mode .social-buttons,
.mobile-large-mode .social-buttons {
    gap: 0.4rem;
    margin: 1rem 0 0.5rem 0;
}

.mobile-mode .social-btn,
.mobile-large-mode .social-btn {
    font-size: 0.75rem;
    padding: 0.5rem 0.6rem;
    min-height: 44px;
}

.tablet-portrait-mode .social-buttons,
.tablet-landscape-mode .social-buttons {
    gap: 0.5rem;
    margin: 1rem 0 0.75rem 0;
}

.tablet-portrait-mode .social-btn,
.tablet-landscape-mode .social-btn {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    min-height: 44px;
}

.desktop-mode .social-buttons {
    gap: 0.6rem;
    margin: 0.75rem 0 0.25rem 0;
}

.desktop-mode .social-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    min-height: 32px;
}

/* Additional optimization classes for JavaScript-controlled modes */
.social-buttons.mobile-optimized {
    gap: 0.3rem;
    padding: 0 0.25rem;
}

.social-buttons.mobile-optimized .social-btn {
    font-size: 0.7rem;
    padding: 0.4rem 0.5rem;
    min-height: 44px;
}

.social-buttons.tablet-optimized {
    gap: 0.5rem;
    padding: 0 0.5rem;
}

.social-buttons.tablet-optimized .social-btn {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    min-height: 44px;
}

.social-buttons.desktop-optimized {
    gap: 0.6rem;
    padding: 0;
}

.social-buttons.desktop-optimized .social-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    min-height: 32px;
}

/* Emergency fallback for very small screens or problematic mobile browsers */
@media (max-width: 320px) {
    .social-buttons {
        gap: 0.2rem !important;
        margin: 1rem 0 0.5rem 0 !important;
        padding: 0 !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important; /* Firefox */
        -ms-overflow-style: none !important; /* IE/Edge */
    }

    .social-buttons::-webkit-scrollbar {
        display: none !important; /* Chrome/Safari */
    }

    .social-btn {
        font-size: 0.65rem !important;
        padding: 0.3rem 0.4rem !important;
        min-height: 44px !important;
        min-width: 44px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }

    .social-btn i {
        font-size: 0.75rem !important;
    }
}

/* Fix for iOS Safari and other webkit browsers */
@supports (-webkit-touch-callout: none) {
    .social-btn {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Fix for Android Chrome and other mobile browsers */
@media (hover: none) and (pointer: coarse) {
    .social-btn:hover {
        transform: none; /* Disable hover transform on touch devices */
        opacity: 1;
    }

    .social-btn:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* Recent Tools Section */
#recent-tools-section {
    margin-bottom: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

#recent-tools-section .category-title {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#recent-tools-section .category-title::before {
    content: "🕒";
    font-size: 1.2rem;
}

.recent-tool-card {
    position: relative;
    background: var(--white);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.recent-tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-hover);
}

.recent-tool-card::after {
    content: "Recent";
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-color);
    color: var(--white);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-tools-actions {
    margin-top: 1.5rem;
    text-align: center;
}

.btn-clear-recent {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.btn-clear-recent:hover {
    background: #374151;
    transform: translateY(-1px);
}

.btn-clear-recent:active {
    transform: translateY(0);
}

/* Mobile optimizations for recent tools */
@media (max-width: 768px) {
    #recent-tools-section {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    #recent-tools-section .category-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .recent-tool-card::after {
        font-size: 0.6rem;
        padding: 1px 4px;
        top: -6px;
        right: -6px;
    }

    .btn-clear-recent {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        min-height: 44px; /* Touch-friendly */
    }
}
