/* Reset and Base Styles */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    /* Improve performance */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    /* Performance optimizations */
    will-change: background-color, color;
    overflow-x: hidden;
}

/* CSS Variables */
:root {
    /* Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-contrast: #0f172a;
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Compatibility aliases for existing HTML */
    --primary-color: var(--accent-primary);
    --secondary-color: var(--accent-secondary);
    --text-color: var(--text-primary);
    --text-light: var(--text-secondary);
    --bg-color: var(--bg-primary);
    --shadow: var(--shadow-md);
    --success-color: var(--accent-success);
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-contrast: #ffffff;
    --accent-primary: #60a5fa;
    --accent-secondary: #a78bfa;
    --accent-success: #34d399;
    --accent-warning: #fbbf24;
    --accent-error: #f87171;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    
    /* Compatibility aliases for existing HTML */
    --primary-color: var(--accent-primary);
    --secondary-color: var(--accent-secondary);
    --text-color: var(--text-primary);
    --text-light: var(--text-secondary);
    --bg-color: var(--bg-primary);
    --shadow: var(--shadow-md);
    --success-color: var(--accent-success);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-secondary);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Performance critical styles loaded first */
/* Critical above-the-fold CSS optimized for fast rendering */
.header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.8);
    /* Performance optimizations */
    will-change: transform;
    contain: layout style paint;
    transform: translateZ(0); /* Force hardware acceleration */
}

[data-theme="dark"] .header {
    background-color: rgba(15, 23, 42, 0.8);
}

/* Critical above-the-fold styles */
.hero {
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    /* Performance optimization */
    will-change: transform;
    contain: layout style;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* Performance optimization */
    will-change: transform;
    contain: layout style;
}

/* Fast loading for interactive elements */
.cta-button, .tool-link, .generate-button {
    transform: translateZ(0); /* Hardware acceleration */
    backface-visibility: hidden;
    contain: layout style;
}

/* Optimize animations for 60fps */
@media (prefers-reduced-motion: no-preference) {
    .tool-card:hover,
    .post-card:hover,
    .category-card:hover {
        transform: translateY(-5px) translateZ(0);
    }
}

.navbar {
    padding: 1rem 0;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.nav-logo .logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.logo-img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
}

.nav-menu {
    display: flex;
    align-items: center;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding: 0.5rem 1rem;
    padding-right: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 200px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: color 0.3s ease;
}

.search-btn:hover {
    color: var(--accent-primary);
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    position: relative;
}

.theme-toggle:hover {
    background-color: var(--bg-secondary);
    color: var(--accent-primary);
}

.moon-icon {
    display: none;
}

[data-theme="dark"] .sun-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: block;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger {
    width: 20px;
    height: 2px;
    background-color: var(--text-primary);
    margin: 2px 0;
    transition: 0.3s;
}

/* Hero Section */
.hero {
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.btn-secondary:hover {
    background-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent-primary);
}

/* Sections */
.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    font-weight: 700;
}

/* Featured Posts */
.featured-posts {
    padding: 4rem 0;
    background-color: var(--bg-secondary);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.post-card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.post-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-content {
    padding: 1.5rem;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.post-category {
    background-color: var(--accent-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.post-title a {
    color: var(--text-primary);
}

.post-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.post-read-more {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

/* Categories */
.categories {
    padding: 4rem 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    text-decoration: none;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.category-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Blog Layout */
.blog-header {
    padding: 3rem 0;
    background-color: var(--bg-secondary);
    text-align: center;
}

.blog-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.blog-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.blog-content {
    padding: 3rem 0;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
}

.blog-main {
    min-width: 0;
}

/* Blog Controls */
.blog-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.filter-tab:hover,
.filter-tab.active {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.sort-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 0.875rem;
}

/* Sidebar */
.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-widget {
    background-color: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.sidebar-widget h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.search-widget {
    display: flex;
    gap: 0.5rem;
}

.search-widget-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.search-widget-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-widget-btn {
    padding: 0.5rem;
    background-color: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-widget-btn:hover {
    background-color: #2563eb;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 0.5rem;
}

.category-list a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    display: block;
    padding: 0.25rem 0;
}

.category-list a:hover {
    color: var(--accent-primary);
}

.recent-posts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-post {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.recent-post:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.recent-post-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.recent-post-content h4 {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.recent-post-content h4 a {
    color: var(--text-primary);
    text-decoration: none;
}

.recent-post-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.tag:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Newsletter */
.newsletter-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.newsletter-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.newsletter-btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.newsletter-btn:hover {
    background-color: #2563eb;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h3,
.footer-section h4 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.footer-section p {
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 0.75rem;
}

.footer-section ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 0.25rem 0;
    display: inline-block;
}

.footer-section ul li a:hover {
    color: var(--accent-primary);
    transform: translateX(5px);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    font-size: 1.2rem;
}

.social-link:hover {
    background-color: var(--accent-primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-bottom p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    position: relative;
}

.footer-links a:hover {
    color: var(--accent-primary);
}

.footer-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--accent-primary);
    transition: width 0.3s ease;
}

.footer-links a:hover::after {
    width: 100%;
}

/* Search Modal */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.search-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.search-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: color 0.3s ease;
}

.search-modal-close:hover {
    color: var(--accent-primary);
}

.search-results {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* Load More */
.load-more-container {
    text-align: center;
    margin-top: 3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
    }

    .nav-menu.active {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        padding: 1rem;
        gap: 0;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .search-input {
        width: 150px;
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .blog-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .blog-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tabs {
        justify-content: center;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .hero {
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 200px;
    }

    .section-title {
        font-size: 2rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .search-input {
        width: 120px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.hidden { display: none; }
.visible { display: block; }

/* Print Styles */
@media print {
    .header,
    .footer,
    .search-modal,
    .nav-actions {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}

/* Header Structure Updates */
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
}

.logo img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
}

.nav a:hover {
    color: var(--accent-primary);
}

.mobile-menu-toggle {
    display: none;
}

/* Main Content */
.main {
    min-height: 80vh;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.tool-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-primary);
}

.tool-card h3 {
    color: var(--accent-primary);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.tool-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.tool-link {
    display: inline-block;
    background-color: var(--accent-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tool-link:hover {
    background-color: var(--accent-secondary);
    transform: translateY(-2px);
    color: white;
}

/* CTA Button */
.cta-button {
    display: inline-block;
    background-color: var(--accent-primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.cta-button:hover {
    background-color: var(--accent-secondary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    color: white;
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* Hero Stats */
.hero-stats {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent-primary);
    display: block;
    line-height: 1;
}

.stat-label {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Featured Tools Section */
.featured-tools {
    padding: 4rem 0;
    background-color: var(--bg-secondary);
}

/* Animations for JavaScript */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-up {
    animation: slideInUp 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.float {
    animation: float 3s ease-in-out infinite;
}

/* Interactive Elements */
.interactive-hover {
    transition: all 0.3s ease;
}

.interactive-hover:hover {
    transform: translateY(-5px);
}

/* Mobile Responsive Updates */
@media (max-width: 768px) {
    .header-container {
        padding: 1rem;
    }
    
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
        flex-direction: column;
        padding: 1rem;
    }
    
    .nav.active {
        display: flex;
    }
    
    .nav a {
        padding: 1rem 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav a:last-child {
        border-bottom: none;
    }
    
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-primary);
        cursor: pointer;
        padding: 0.5rem;
    }
    
    .hero-stats {
        gap: 2rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Tool-specific styles */
.tool-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-header {
    text-align: center;
    margin-bottom: 3rem;
}

.tool-header h1 {
    font-size: 2.5rem;
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.tool-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.tool-interface {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 3rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-lg);
}

.generate-button {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white !important;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.generate-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white !important;
}

.generate-button:active {
    transform: translateY(-1px);
    color: white !important;
}

.result {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin: 2rem 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.result.has-content {
    background-color: var(--bg-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.count-btn {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.count-btn:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.count-btn.active {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Country card styles */
.country-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-lg);
    display: none;
}

.country-card.show {
    display: block;
}

.country-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.country-detail-item:last-child {
    border-bottom: none;
}

.country-detail-label {
    font-weight: 600;
    color: var(--text-primary);
}

.country-detail-value {
    color: var(--text-secondary);
}

/* Number generator specific styles */
.number-stats {
    display: none;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
}

.number-stats.show {
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-box {
    background-color: var(--bg-primary);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-box h4 {
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.stat-box .stat-value {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
}

/* Emoji specific styles */
.emoji-item {
    display: inline-block;
    margin: 0.25rem;
    font-size: 2rem;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.emoji-item:hover {
    transform: scale(1.1);
}

/* Warning color variable */
:root {
    --warning-color: var(--accent-warning);
    --text-readable: #374151; /* Better contrast for light mode */
}

[data-theme="dark"] {
    --warning-color: var(--accent-warning);
    --text-readable: #d1d5db; /* Better contrast for dark mode */
}

/* Enhanced contrast classes */
.text-readable {
    color: var(--text-readable) !important;
}

.text-high-contrast {
    color: var(--text-contrast) !important;
}