/* Micro-Band Main Stylesheet */

/* ==========================================================================
   0. Global Link Styles
   ========================================================================== */
.micro-band-dashboard a,
.single-post-container a {
    text-decoration: none;
}

.micro-band-dashboard a:hover,
.single-post-container a:hover {
    text-decoration: underline; /* Re-enable underline on hover by default */
}

/* ==========================================================================
   1. Base Layout & Variables
   ========================================================================== */

:root {
    --mb-card-background: #ffffff;
    --mb-page-background: #f0f2f5;
    --mb-primary-text: #1d2129;
    --mb-secondary-text: #65676b;
    --mb-accent-color: #0073aa;
    --mb-border-color: #e4e6eb;
    --mb-border-radius: 12px;
    --mb-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body {
    background-color: var(--mb-page-background);
}

.micro-band-dashboard {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    gap: 30px;
    align-items: flex-start; /* Aligns items to the start of the cross axis */
}

/* Sidebar widths and sticky positioning */
.micro-band-left-sidebar { 
    width: 22%; 
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start; /* Ensures sticky behavior for content that might be shorter */
}
.micro-band-center-feed  { width: 53%; flex-grow: 1; }
.micro-band-right-sidebar{ 
    width: 25%; 
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start; /* Ensures sticky behavior for content that might be shorter */
    display: flex;
    flex-direction: column;
    gap: 20px; /* Gap between widgets */
}

#micro-band-feed-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ==========================================================================
   2. Left Sidebar (New Design)
   ========================================================================== */
.sidebar-content-wrapper {
    background: var(--mb-card-background);
    border-radius: var(--mb-border-radius);
    padding: 16px;
    box-shadow: var(--mb-shadow); /* Add block shadow */
}
.sidebar-profile-block {
    text-align: center;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--mb-border-color); /* Use border-color variable */
}
.sidebar-avatar { /* No longer a link here directly, will be in HTML */
    margin-bottom: 12px;
}
.sidebar-avatar a {
    display: inline-block;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(45deg, var(--mb-accent-color), #9b59b6); /* Example gradient */
}
.sidebar-avatar img {
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--mb-card-background);
    object-fit: cover;
}
.sidebar-profile-name {
    font-size: 1.15em; /* Adjusted from 1.25em */
    font-weight: 700;
    color: var(--mb-primary-text);
    margin-top: 12px;
    white-space: nowrap; /* Prevent line breaks */
    overflow: hidden; /* Hide overflow content */
    text-overflow: ellipsis; /* Show ellipsis for overflow */
}
.sidebar-profile-description {
    font-size: 0.9em;
    color: var(--mb-secondary-text);
    margin-top: 4px;
    line-height: 1.5;
    text-align: left; /* Left align the description */
}
.sidebar-social-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}
.sidebar-social-links .social-icon {
    color: var(--mb-secondary-text);
    transition: color 0.2s ease;
}
.sidebar-social-links .social-icon:hover {
    color: var(--mb-primary-text);
}
.sidebar-main-nav {
    padding-top: 16px; /* Add top padding for spacing */
    border-top: 1px solid var(--mb-border-color); /* Add a subtle top border */
}
.sidebar-main-nav ul {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px; border-radius: 8px;
    color: var(--mb-primary-text);
    text-decoration: none;
    font-weight: 600; font-size: 1em;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.nav-item svg { color: var(--mb-secondary-text); transition: color 0.2s ease; }
.nav-item:hover, .nav-item.active {
    background-color: var(--mb-page-background);
    color: var(--mb-accent-color);
}
.nav-item:hover svg, .nav-item.active svg {
    color: var(--mb-accent-color);
}


/* ==========================================================================
   3. Center Feed - Tag Filter Bar
   ========================================================================== */
.micro-band-category-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: var(--mb-card-background);
    border-radius: var(--mb-border-radius);
    box-shadow: var(--mb-shadow);
    margin-bottom: 20px; /* Space below the filter bar */
}

.category-filter-button {
    font-size: 0.9em;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px; /* Pill shape */
    background-color: var(--mb-page-background);
    color: var(--mb-secondary-text);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid var(--mb-border-color);
    white-space: nowrap; /* Prevent wrapping */
}

.category-filter-button:hover {
    background-color: #e4e6e9; /* Lighter background on hover */
    border-color: #c9ccd3;
    color: var(--mb-primary-text);
    text-decoration: none; /* Ensure no underline on hover */
}

.category-filter-button.active {
    background-color: var(--mb-accent-color);
    color: #ffffff;
    border-color: var(--mb-accent-color);
    font-weight: 600;
    text-decoration: none; /* Ensure no underline when active */
}


/* ==========================================================================
   3. Center Feed - 'Write a Post' Button (Admin Only)
   ========================================================================== */
#micro-band-writer-toggle-container {
    display: flex;
    justify-content: flex-start; /* Align to left */
    margin-bottom: 20px;
    padding: 0 10px; /* Match card padding visually */
}
.admin-action-btn {
    display: inline-flex; /* For icon and text alignment */
    align-items: center;
    gap: 8px;
    background-color: var(--mb-page-background);
    color: var(--mb-primary-text);
    border: 1px solid var(--mb-border-color);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.admin-action-btn:hover {
    background-color: #e8eaf0; /* Slightly darker hover */
    border-color: #c9ccd3;
}
.admin-action-btn svg {
    width: 16px; height: 16px;
    stroke: currentColor;
}


/* ==========================================================================
   4. Center Feed - Main Card Design
   ========================================================================== */
.micro-band-feed-card {
    background: var(--mb-card-background);
    border-radius: var(--mb-border-radius);
    box-shadow: var(--mb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Ensures child elements conform to border-radius */
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
}
.card-author-info { display: flex; align-items: center; gap: 10px; }
.card-author-info .avatar { width: 40px; height: 40px; border-radius: 50%; }
.card-author-details { display: flex; flex-direction: column; line-height: 1.3; }
.card-author-name { font-weight: 600; color: var(--mb-primary-text); }
.card-post-time { font-size: 0.85em; color: var(--mb-secondary-text); }
.card-category-badge {
    font-size: 0.8em; font-weight: 500;
    padding: 4px 10px;
    background-color: var(--mb-page-background);
    color: var(--mb-secondary-text);
    border-radius: 12px; text-decoration: none;
    transition: background-color 0.2s;
}
.card-category-badge:hover { background-color: #e4e6e9; }
.card-title {
    font-size: 1.5em; font-weight: 700;
    color: var(--mb-primary-text);
    line-height: 1.3; padding: 0 16px; margin: 0 0 12px 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis;
}
.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card-thumbnail {
    display: block; width: 100%;
    aspect-ratio: 16 / 9;
    background-color: var(--mb-page-background);
    border-top: 1px solid var(--mb-border-color);
    border-bottom: 1px solid var(--mb-border-color);
}
.card-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 12px 16px; }
.card-excerpt {
    font-size: 1em; color: var(--mb-primary-text);
    margin: 0 0 12px 0; line-height: 1.5;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-read-more {
    display: block;
    text-align: right;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--mb-accent-color);
    margin-top: 8px;
    text-decoration: none;
}
.card-read-more:hover {
    text-decoration: underline;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.card-tags a { font-size: 0.85em; color: var(--mb-accent-color); text-decoration: none; }
.card-tags a:hover { text-decoration: underline; }
.card-footer {
    display: flex; align-items: center; gap: 16px;
    padding: 8px 16px 12px;
    border-top: 1px solid var(--mb-page-background);
}
.card-footer-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em; font-weight: 600;
    color: var(--mb-secondary-text);
    text-decoration: none; background: none; border: none;
    padding: 8px; margin: -8px; /* Tappable area */
    border-radius: 6px; cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.card-footer-action:hover { 
    background-color: var(--mb-page-background);
    color: var(--mb-primary-text);
}
.card-footer-action svg {
    width: 18px; height: 18px;
    stroke: currentColor;
}
.share-container { position: relative; margin-left: auto; }
.card-share-options {
    position: absolute; bottom: 100%; left: 0;
    background: var(--mb-card-background);
    border: 1px solid var(--mb-border-color);
    border-radius: 8px; box-shadow: var(--mb-shadow);
    min-width: 120px; z-index: 10;
    margin-bottom: 8px; overflow: hidden;
}
.card-share-options a {
    display: block; padding: 8px 12px; font-size: 0.9em;
    color: var(--mb-primary-text); text-decoration: none;
}
.card-share-options a:hover { background-color: var(--mb-page-background); }


/* ==========================================================================
   5. Right Sidebar (New Design)
   ========================================================================== */

.widget-card {
    background: var(--mb-card-background);
    border-radius: var(--mb-border-radius);
    padding: 16px;
    box-shadow: var(--mb-shadow);
}
.widget-title {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--mb-primary-text);
    padding-bottom: 12px;
    margin: 0 0 16px 0;
    border-bottom: 1px solid var(--mb-border-color);
}

/* Gallery Widget */
.micro-band-gallery-widget .gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.micro-band-gallery-widget .gallery-item a {
    display: block;
    overflow: hidden;
    border-radius: 8px;
}
.micro-band-gallery-widget .gallery-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
}
.micro-band-gallery-widget .gallery-item a:hover img {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* Popular Posts Widget */
.micro-band-popular-posts-widget ul {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column;
    gap: 16px;
}
.micro-band-popular-posts-widget .popular-post-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit; /* Inherit color for text in link */
}
.popular-post-thumbnail {
    width: 44px; height: 44px;
    flex-shrink: 0;
    border-radius: 6px;
    background-color: var(--mb-page-background);
    overflow: hidden;
}
.popular-post-thumbnail img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.popular-post-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow info to take remaining space */
}
.popular-post-title {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--mb-primary-text);
    line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis;
    transition: color 0.2s ease;
}
.popular-post-meta {
    font-size: 0.8em;
    color: var(--mb-secondary-text);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.popular-post-meta svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}
.micro-band-popular-posts-widget .popular-post-link:hover .popular-post-title {
    color: var(--mb-accent-color);
}

/* ==========================================================================
   6. Single Post Page (Refined Design)
   ========================================================================== */
body.single-micro_feed {
    background-color: var(--mb-page-background); /* Light grey background for the page */
}
.single-post-container {
    max-width: 840px; /* A comfortable width for the floating card */
    margin: 40px auto;
    padding: 40px 60px;
    background-color: var(--mb-card-background);
    border-radius: var(--mb-border-radius);
    box-shadow: var(--mb-shadow);
}
.single-entry-header .entry-title {
    font-size: 2.4em; /* Slightly reduced for balance */
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 24px;
    color: var(--mb-primary-text);
}
.entry-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--mb-border-color);
}
.meta-author { display: flex; align-items: center; gap: 12px; }
.meta-author .avatar { width: 48px; height: 48px; border-radius: 50%; }
.author-info { display: flex; flex-direction: column; }
.author-name { font-weight: 600; }
.author-info time { font-size: 0.9em; color: var(--mb-secondary-text); }
.meta-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-tags a {
    font-size: 0.85em; background-color: var(--mb-page-background);
    padding: 5px 12px; border-radius: 15px; color: var(--mb-secondary-text);
    text-decoration: none; transition: background-color 0.2s;
}
.meta-tags a:hover { background-color: #e4e6e9; }

.single-featured-image {
    margin-bottom: 40px;
}
.single-featured-image img {
    width: 100%;
    height: auto;
    border-radius: var(--mb-border-radius); /* Consistent border radius */
}

.entry-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--mb-primary-text);
}
.entry-content > * + * { margin-top: 1.5em; }

.single-gallery-fullwidth {
    width: 100%;
    padding: 40px 0;
    margin-top: 40px;
    /* Removed background color to blend with page */
}
.gallery-grid-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}
.gallery-grid-container .gallery-item img {
    width: 100%; height: auto;
    border-radius: 8px;
    transition: opacity 0.3s;
}
.gallery-grid-container .gallery-item a:hover img { opacity: 0.85; }

.share-module { text-align: center; padding: 40px 0; border-top: 1px solid var(--mb-border-color); margin-top: 40px;}
.share-title { font-size: 1em; font-weight: 600; color: var(--mb-secondary-text); margin-bottom: 16px; }
.share-buttons { display: flex; justify-content: center; gap: 12px; }
.share-buttons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--mb-border-color);
    border-radius: 50%;
    text-decoration: none;
    color: var(--mb-secondary-text);
    transition: background-color 0.2s, color 0.2s;
}
.share-buttons a:hover { 
    background-color: var(--mb-page-background);
    color: var(--mb-primary-text);
}
.back-to-list-link { text-align: center; margin: 40px 0; }
.back-to-list-link a { color: var(--mb-secondary-text); text-decoration: none; font-weight: 500; }
.back-to-list-link a:hover { color: var(--mb-primary-text); text-decoration: underline; }


/* ==========================================================================
   7. Responsive Design (Mobile & Tablet)
   ========================================================================== */

@media (max-width: 992px) {
    /* Dashboard */
    .micro-band-dashboard {
        flex-direction: column;
        padding: 0;
        gap: 10px;
        background-color: var(--mb-page-background);
    }
    .micro-band-left-sidebar, .micro-band-center-feed, .micro-band-right-sidebar {
        width: 100%; position: static; top: auto;
        border-radius: 0; box-shadow: none; padding: 0;
    }
    .micro-band-center-feed { order: 1; }
    .micro-band-left-sidebar { order: 2; background: var(--mb-card-background); }
    .micro-band-right-sidebar { order: 3; padding: 0; background: transparent; }

    .sidebar-content-wrapper, .widget-card {
        border-radius: 0; box-shadow: none;
        border-bottom: 1px solid var(--mb-border-color);
        margin-bottom: 10px;
    }
}

@media (max-width: 768px) {
    /* Card Feed */
    #micro-band-feed-list { gap: 0; }
    .micro-band-feed-card {
        border-radius: 0; box-shadow: none;
        border-left: none; border-right: none;
        border-top: 1px solid var(--mb-border-color);
    }
    #micro-band-feed-list .micro-band-feed-card:first-child { border-top: none; }
    .card-header, .card-title, .card-body, .card-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    .card-title { font-size: 1.4em; }
    .card-excerpt, .card-footer-action, .card-tags a { font-size: 1em; }

    /* Single Post */
    .single-post-container {
        margin: 0;
        padding: 20px 15px;
        border-radius: 0;
        box-shadow: none;
    }
    .single-entry-header .entry-title { font-size: 2em; }
    .entry-meta-bar { flex-direction: column; align-items: flex-start; }
    .entry-content { font-size: 1.05rem; line-height: 1.7; }
    .gallery-grid-container { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* WP Admin Bar Compatibility */
body.admin-bar .single-post-container { margin-top: 32px; }
@media screen and (max-width: 782px) {
    body.admin-bar .single-post-container { margin-top: 46px; }
}
