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

/* Fix for fixed header blocking content */
.blog-article,
.blog-post,
main.blog-content {
    padding-top: 80px;
}

:root {
    /* Colors */
    --primary-blue: #2563eb;
    --primary-green: #10b981;
    --dark-bg: #0f172a;
    --dark-card: #1e293b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --border-light: #e2e8f0;
    --error: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-green) 100%);
    --gradient-hero: linear-gradient(135deg, #1e40af 0%, #059669 100%);
    
    /* Border Radius */
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-full: 9999px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-out;
    
    /* Spacing */
    --container-padding: 1.5rem;
    --section-padding: 4rem 0;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-light: #94a3b8;
        --surface: #1e293b;
        --surface-hover: #334155;
        --border-light: #334155;
    }
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: #fafbfc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-blue);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    transition: var(--transition-fast);
}

.skip-link:focus {
    top: 6px;
}

/* Focus styles for better accessibility */
a:focus,
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* Header */
header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

header.scrolled {
    background: rgba(15, 23, 42, 0.98);
    box-shadow: var(--shadow-xl);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    min-height: 80px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 48px;
}

.logo img {
    height: 40px;
    width: auto;
    transition: var(--transition);
}

.logo img:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: #ffffff;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    position: relative;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-green);
    background: rgba(16, 185, 129, 0.1);
}

.nav-links a.active {
    background: var(--gradient-primary);
    color: white;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
    background: none;
    border: none;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: var(--transition);
}

/* Hero Section */
.blog-hero {
    background: var(--gradient-hero);
    color: white;
    padding: 8rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.blog-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="rgba(255,255,255,0.03)" fill-opacity="0.4"><path d="m36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/></g></g></svg>') repeat;
    opacity: 0.1;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #ffffff 0%, #e0f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1rem, 3vw, 1.25rem);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    display: block;
    background: linear-gradient(135deg, #ffffff 0%, #22c55e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Blog Controls */
.blog-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    padding: 1.5rem 0;
    flex-wrap: wrap;
    align-items: center;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--surface);
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.filter-container {
    display: flex;
    gap: 1rem;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--surface);
    cursor: pointer;
    transition: var(--transition);
    min-width: 160px;
}

.filter-select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Main Content */
.blog-main {
    padding: var(--section-padding);
}

.blog-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Featured Post */
.featured-post {
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    transition: var(--transition);
    border: 1px solid var(--border-light);
    margin-bottom: 4rem;
}

.featured-post:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

.featured-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
}

.featured-content {
    padding: 2rem;
}

/* Blog Posts */
.blog-posts {
    display: grid;
    gap: 2.5rem;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    margin-top: 3rem;
}

.blog-post {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    border: 1px solid var(--border-light);
    transition: var(--transition);
    position: relative;
    height: fit-content;
    margin-bottom: 1rem;
}

.blog-post:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-blue);
}

.blog-post.hidden {
    display: none;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    object-fit: cover;
}

.author-info {
    flex: 1;
}

.author-name {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 0.9rem;
}

.post-date {
    color: var(--text-light);
    font-size: 0.85rem;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.post-title a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

.post-title a:hover {
    color: var(--primary-blue);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.tag:hover {
    transform: scale(1.05);
}

.tag-web-design {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-blue);
}

.tag-business {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-green);
}

.tag-saas {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.tag-seo {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.tag-security {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.tag-mobile {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.post-excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.read-more {
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.read-more:hover {
    gap: 0.75rem;
    color: var(--primary-green);
}

.read-more::after {
    content: '→';
    transition: var(--transition);
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin: 3rem 0;
}

.load-more-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.load-more-btn .btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.load-more-btn.loading .btn-text {
    opacity: 0;
}

.load-more-btn.loading .btn-spinner {
    display: inline-block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Newsletter Section */
.newsletter {
    background: var(--gradient-primary);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    margin: 4rem 0;
    border-radius: var(--border-radius-lg);
    position: relative;
    overflow: hidden;
}

.newsletter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><g fill="rgba(255,255,255,0.05)"><circle cx="20" cy="20" r="2"/></g></svg>') repeat;
    opacity: 0.3;
}

.newsletter-content {
    position: relative;
    z-index: 1;
}

.newsletter h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.newsletter p {
    opacity: 0.9;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.newsletter-form {
    display: flex;
    max-width: 400px;
    margin: 0 auto;
    gap: 1rem;
    position: relative;
}

.newsletter-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.newsletter-form input:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.newsletter-form button {
    background: var(--dark-bg);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.newsletter-form button:hover {
    background: var(--dark-card);
    transform: translateY(-1px);
}

.newsletter-form button .btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.newsletter-form button.loading .btn-text {
    opacity: 0;
}

.newsletter-form button.loading .btn-spinner {
    display: inline-block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.error-message,
.success-message {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.success-message {
    background: rgba(34, 197, 94, 0.1);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.error-message.show,
.success-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Footer */
footer {
    background: var(--dark-bg);
    color: white;
    padding: 2rem 0 1rem;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.footer-social a {
    color: white;
    font-size: 1.5rem;
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 8px;
}

.footer-social a:hover {
    color: var(--primary-green);
    background: rgba(16, 185, 129, 0.1);
    transform: translateY(-2px);
}

.footer-copy {
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-copy a {
    color: var(--primary-green);
    text-decoration: none;
    transition: var(--transition);
}

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

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Loading Animation for Posts */
.loading {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

.loading:nth-child(1) { animation-delay: 0.1s; }
.loading:nth-child(2) { animation-delay: 0.2s; }
.loading:nth-child(3) { animation-delay: 0.3s; }
.loading:nth-child(4) { animation-delay: 0.4s; }
.loading:nth-child(5) { animation-delay: 0.5s; }
.loading:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hero-stats {
        gap: 2rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .blog-posts {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    :root {
        --container-padding: 1rem;
        --section-padding: 3rem 0;
    }
    
    .nav-links {
        display: none;
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        background: var(--dark-bg);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-xl);
        z-index: 999;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links li {
        width: 100%;
    }
    
    .nav-links a {
        width: 100%;
        padding: 1rem;
        text-align: center;
        border-radius: 8px;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    .blog-hero {
        padding: 6rem 0 3rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .blog-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        max-width: none;
    }
    
    .newsletter-form {
        flex-direction: column;
        max-width: 300px;
    }
    
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
    
    .blog-posts {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .featured-post {
        margin-bottom: 3rem;
    }
}

@media (max-width: 480px) {
    .blog-post,
    .featured-content {
        padding: 1.5rem;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .newsletter {
        margin: 2rem 0;
        padding: 2rem 1rem;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .blog-posts {
        gap: 1.5rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-light: #000000;
        --text-secondary: #000000;
    }
    
    .blog-post {
        border-width: 2px;
    }
    
    .tag {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Print Styles */
@media print {
    header,
    .newsletter,
    footer,
    .back-to-top,
    .blog-controls,
    .load-more-container {
        display: none;
    }
    
    .blog-main {
        padding: 0;
    }
    
    .blog-post {
        box-shadow: none;
        border: 1px solid #ccc;
        margin-bottom: 1rem;
        break-inside: avoid;
    }
    
    .blog-hero {
        background: none;
        color: black;
        padding: 1rem 0;
    }
    
    .hero-title {
        color: black;
        background: none;
        -webkit-text-fill-color: initial;
    }
}