/* 
 * ET Sibeko Blog Styles - Version 2.0
 * Modern blog styling with search functionality, responsive design, and theme support
 * 
 * Performance Optimizations:
 * - Efficient CSS Grid and Flexbox layouts
 * - Optimized search functionality with CSS-only filtering
 * - Minimal JavaScript dependencies
 * - Responsive images and efficient media queries
 */

/* THEME SWITCHER FOR BLOG */
.theme-switcher {
    display: flex;
    align-items: center;
}

.theme-toggle {
    background-color: var(--background-white);
    border: 1px solid var(--border-light);
    color: var(--text-gray);
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: var(--transition-smooth);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background-color: var(--primary-blue);
    color: var(--text-white);
    border-color: var(--primary-blue);
    box-shadow: 0 6px 20px rgba(24, 119, 242, 0.3);
    transform: translateY(-2px);
}

.theme-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle svg {
    transition: var(--transition-smooth);
    width: 20px;
    height: 20px;
    color: var(--text-gray);
    fill: var(--text-gray);
}

.theme-toggle:hover svg {
    color: #ffffff;
    fill: #ffffff;
}


/* BLOG PAGE LAYOUT */
.blog-post-page {
    margin-top: 40px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 24px;
}

/* Ensure header stays visible on blog pages */
.blog-post-page .header,
body:has(.blog-post-page) .header {
    position: sticky !important;
    top: 0 !important;
    transform: translateY(0) !important;
    z-index: 200 !important;
}

.blog-post-page h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-black);
    margin-bottom: 16px;
    line-height: 1.3;
    text-align: center;
}

/* BLOG INDEX PAGE STYLES */
#blog-header {
    margin-top: 70px;
}

/* Ensure header stays visible on blog index page */
body:has(#blog-header) .header {
    position: sticky !important;
    top: 0 !important;
    transform: translateY(0) !important;
    z-index: 200 !important;
}

#blog-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 16px;
    text-align: center;
}

#blog-header p {
    font-size: 16px;
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 32px;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* SEARCH FUNCTIONALITY */
.search-container {
    margin-bottom: 32px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--background-white);
    border: 2px solid var(--border-light);
    border-radius: 24px;
    padding: 12px 16px;
    transition: var(--transition-smooth);
    box-shadow: var(--card-shadow);
}

.search-box:focus-within {
    border-color: var(--primary-blue);
    box-shadow: none;
}

.search-icon {
    color: var(--text-light-gray);
    margin-right: 12px;
    flex-shrink: 0;
}

#blog-search {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: var(--text-black);
    font-family: inherit;
}

#blog-search::placeholder {
    color: var(--text-light-gray);
}

.clear-button {
    background: none;
    border: none;
    color: var(--text-light-gray);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: var(--transition-smooth);
    margin-left: 8px;
    flex-shrink: 0;
}

.clear-button:hover {
    color: var(--text-gray);
    background-color: var(--light-gray);
}

.search-results-info {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-light-gray);
    text-align: center;
}

.search-highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--text-black);
}

/* BLOG POSTS CONTAINER */
#blog-posts {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* INDIVIDUAL BLOG POST STYLES */
.blog-post {
    background-color: var(--background-white);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition-smooth);
}

.blog-post:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.blog-post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid var(--border-light);
}

.blog-post-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-black);
    line-height: 1.4;
    flex: 1;
    margin-right: 16px;
}

.blog-post-header h2 a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-smooth);
}

.blog-post-header h2 a:hover {
    color: var(--primary-blue);
}

.collapse-toggle {
    background-color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
    color: var(--text-white);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--card-shadow);
}

.collapse-toggle:hover {
    background-color: var(--primary-light-blue);
    color: var(--text-white);
    border-color: var(--primary-light-blue);
    box-shadow: var(--card-shadow);
}

.collapse-toggle svg {
    transition: transform 0.2s ease;
    width: 16px;
    height: 16px;
    color: var(--text-white);
}

.blog-post-content {
    padding: 0 24px 24px 24px;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.category {
    background-color: var(--primary-blue);
    color: var(--text-white);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date {
    color: var(--text-light-gray);
    font-size: 14px;
    font-weight: 500;
}

.blog-post-content p {
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 16px;
}

.read-more {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition-smooth);
    margin-top: 16px;
    margin-left: auto;
    width: fit-content;
}

.read-more:hover {
    color: var(--primary-light-blue);
}

.read-more::after {
    content: '▶';
    transition: transform 0.2s ease;
    font-size: 12px;
    margin-left: 2px;
}

.read-more:hover::after {
    transform: translateX(4px);
}

/* BLOG POST PAGE STYLES */
.post-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.back-to-blog-top {
    margin-bottom: 32px;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition-smooth);
    margin-top: 16px;
    margin-right: auto;
    width: fit-content;
}

.back-button:hover {
    color: var(--primary-light-blue);
}

.back-button::before {
    content: '◀';
    transition: transform 0.2s ease;
    font-size: 12px;
    margin-right: 4px;
}

.back-button:hover::before {
    transform: translateX(-4px);
}

.post-content {
    background-color: var(--background-white);
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-light);
    margin-bottom: 40px;
}

.post-content h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-black);
    margin-top: 32px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-blue);
}

.post-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-black);
    margin-top: 24px;
    margin-bottom: 12px;
}

.post-content p {
    color: var(--text-gray);
    line-height: 1.7;
    margin-bottom: 16px;
    font-size: 16px;
}

.post-content ul {
    margin-bottom: 16px;
    padding-left: 24px;
}

.post-content li {
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 8px;
}

.post-content a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.post-content a:hover {
    color: var(--primary-dark-blue);
    text-decoration: underline;
}

.post-content pre {
    background-color: var(--background-gray);
    color: var(--text-black);
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 20px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-light);
}

.post-content code {
    background-color: var(--background-off-white);
    color: var(--primary-blue);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    border: 1px solid var(--border-light);
}

.post-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    border: none;
}

.post-content em {
    color: var(--text-light-gray);
    font-style: italic;
}

.post-content strong {
    color: var(--text-black);
    font-weight: 600;
}

/* RESPONSIVE DESIGN FOR BLOG */
@media (max-width: 768px) {
    .blog-post-page {
        margin-top: 40px;
        padding: 0 16px;
    }

    .blog-post-page h1 {
        font-size: 24px;
    }

    #blog-header {
        margin-top: 40px;
    }

    #blog-header h1 {
        font-size: 22px;
    }

    .blog-post-header {
        padding: 20px 20px 12px 20px;
        flex-direction: row;
        gap: 16px;
        align-items: center;
    }

    .blog-post-header h2 {
        font-size: 18px;
        margin-right: 0;
        margin-bottom: 0;
        flex: 1;
    }

    .collapse-toggle {
        align-self: center;
        flex-shrink: 0;
    }

    .blog-post-content {
        padding: 0 20px 20px 20px;
    }

    .post-content {
        padding: 24px 20px;
        margin-bottom: 32px;
    }

    .post-content h2 {
        font-size: 20px;
    }

    .post-content h3 {
        font-size: 18px;
    }

    .post-content p {
        font-size: 15px;
    }


    .search-box {
        padding: 10px 14px;
    }

    #blog-search {
        font-size: 15px;
    }

    /* Mobile floating theme switcher */
    .theme-switcher {
        bottom: 16px;
        left: 16px;
    }

    .theme-toggle {
        width: 44px;
        height: 44px;
        padding: 10px;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    .post-meta {
        gap: 12px;
    }

    .category {
        font-size: 11px;
        padding: 3px 10px;
    }

    .date {
        font-size: 13px;
    }

    #box1 h3 {
        font-size: 12px;
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .blog-post-page {
        padding: 0 12px;
    }

    .blog-post-page h1 {
        font-size: 20px;
    }

    #blog-header h1 {
        font-size: 20px;
    }

    .blog-post-header {
        padding: 16px 16px 12px 16px;
    }

    .blog-post-header h2 {
        font-size: 16px;
    }

    .blog-post-content {
        padding: 0 16px 16px 16px;
    }

    .post-content {
        padding: 20px 16px;
    }

    .post-content h2 {
        font-size: 18px;
    }

    .post-content h3 {
        font-size: 16px;
    }

    .search-box {
        padding: 8px 12px;
    }

    #blog-search {
        font-size: 14px;
    }
}

/* ACCESSIBILITY IMPROVEMENTS */
.blog-post:focus-within {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.collapse-toggle:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.search-box:focus-within {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* ANIMATION FOR COLLAPSIBLE CONTENT */
.blog-post-content {
    transition: all 0.3s ease;
}

