/* CSS Custom Properties for Theme System */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-tertiary: #adb5bd;
    --accent-primary: #2563eb;
    --accent-secondary: #1d4ed8;
    --border-primary: #dee2e6;
    --border-secondary: #e9ecef;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 8px 25px rgba(0,0,0,0.15);
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --code-bg: #f1f5f9;
    --code-text: #be185d;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --text-tertiary: #6c757d;
    --accent-primary: #4f8ff7;
    --accent-secondary: #3b82f6;
    --border-primary: #404040;
    --border-secondary: #2d2d2d;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 25px rgba(0,0,0,0.4);
    --gradient-hero: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%);
    --code-bg: #374151;
    --code-text: #f472b6;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --bg-tertiary: #404040;
        --text-primary: #e9ecef;
        --text-secondary: #adb5bd;
        --text-tertiary: #6c757d;
        --accent-primary: #4f8ff7;
        --accent-secondary: #3b82f6;
        --border-primary: #404040;
        --border-secondary: #2d2d2d;
        --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
        --shadow-md: 0 4px 6px rgba(0,0,0,0.2);
        --shadow-lg: 0 8px 25px rgba(0,0,0,0.4);
        --gradient-hero: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%);
        --code-bg: #374151;
        --code-text: #f472b6;
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: color 0.3s ease, background-color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.nav {
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--accent-primary);
    font-weight: 700;
}

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

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--accent-primary);
}

.blog-link {
    background: var(--accent-primary);
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.blog-link:hover {
    background: var(--accent-secondary);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: 2px solid var(--border-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

/* Navigation Search */
.nav-search-container {
    position: relative;
    margin: 0 1rem;
}

.nav-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-tertiary);
    z-index: 2;
    pointer-events: none;
}

.nav-search-input {
    width: 200px;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-search-input::placeholder {
    color: var(--text-tertiary);
}

.nav-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
    width: 250px;
}

.nav-search-input:focus + .nav-search-icon {
    color: var(--accent-primary);
}

/* Navigation Search Results */
.nav-search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.search-result-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-secondary);
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-result-item:hover,
.search-result-item:focus {
    background: var(--bg-secondary);
    outline: none;
}

.search-result-item:last-of-type {
    border-bottom: none;
}

.result-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.result-meta {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.result-category {
    background: var(--accent-primary);
    color: white;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-weight: 500;
}

.result-date,
.result-time {
    color: var(--text-tertiary);
}

.result-excerpt {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.search-result-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-secondary);
    text-align: center;
}

.view-all-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.view-all-link:hover {
    text-decoration: underline;
}

.nav-search-highlight {
    background: rgba(255, 235, 59, 0.3);
    color: inherit;
    padding: 0.1em 0;
    border-radius: 2px;
    font-weight: 600;
}

/* Hero Section */
.hero {
    background: var(--gradient-hero);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero-content h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

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

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sections */
.section {
    padding: 4rem 0;
}

.section-alt {
    background: var(--bg-primary);
}

.section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.about-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: transform 0.3s ease;
}

.about-card:hover {
    transform: translateY(-5px);
}

.about-card h3 {
    color: var(--accent-primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* Setup Section */
.setup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.setup-category {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 10px;
    border-left: 4px solid var(--accent-primary);
}

.setup-category h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.setup-category ul {
    list-style: none;
}

.setup-category li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-secondary);
}

.setup-category li:last-child {
    border-bottom: none;
}

/* Posts Section */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.post-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.post-content {
    padding: 2rem;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #64748b;
}

.post-category {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.post-card h3 {
    margin-bottom: 1rem;
    color: #1e293b;
}

.post-card h3 a {
    text-decoration: none;
    color: inherit;
}

.post-card h3 a:hover {
    color: #2563eb;
}

.post-excerpt {
    color: #64748b;
    margin-bottom: 1rem;
}

.read-more {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.read-more:hover {
    text-decoration: underline;
}

.posts-footer {
    text-align: center;
    margin-top: 3rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

/* Contact Section */
.contact-info {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-info p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: #64748b;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #64748b;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    font-weight: 500;
}

.contact-link:hover {
    color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Footer */
.footer {
    background: #1e293b;
    color: white;
    text-align: center;
    padding: 2rem 0;
}

.footer p {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        padding: 1rem 20px;
    }
    
    .nav-menu {
        gap: 1rem;
        margin-top: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-search-container {
        order: -1;
        margin: 0 0 1rem 0;
        width: 100%;
        max-width: 300px;
    }
    
    .nav-search-input {
        width: 100%;
    }
    
    .nav-search-input:focus {
        width: 100%;
    }
    
    .nav-search-results {
        left: 0;
        right: 0;
        width: 100%;
    }
}
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .hero-stats .stat {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1rem;
    }
    
    .about-grid,
    .setup-grid,
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-links {
        flex-direction: column;
        align-items: center;
    }
    
    .contact-link {
        width: 200px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .section {
        padding: 2rem 0;
    }
    
    .hero {
        padding: 2rem 0;
    }
}