/* DASHBOARD RESCUE CSS */

/* Sidebar Container */
.dream-sidebar-box {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: 1rem;
}

.dark .dream-sidebar-box {
    background: #1e1e1e !important;
    /* Solid Dark Grey */
    border: 1px solid #333;
    color: #e5e5e5;
}

/* Sidebar Text Contrast */
.dream-sidebar-box h1,
.dream-sidebar-box h2,
.dream-sidebar-box p,
.dream-sidebar-box .text-gray-500,
.dream-sidebar-box .text-gray-400 {
    color: #111 !important;
    /* Force Black in Light Mode */
}

.dark .dream-sidebar-box h1,
.dark .dream-sidebar-box h2,
.dark .dream-sidebar-box p,
.dark .dream-sidebar-box .text-gray-500,
.dark .dream-sidebar-box .text-gray-400 {
    color: #f5f5f5 !important;
    /* Force White in Dark Mode */
}

/* Input Field */
#post-search {
    width: 100%;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: #fff;
    color: #000;
    margin-top: 5px;
}

.dark #post-search {
    background: #2d2d2d;
    border-color: #444;
    color: #fff;
}

/* Tag Cloud Spacing */
#tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    /* Standard explicit gap */
    margin-top: 10px;
}

.tag-filter {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    border: none;
    background: #e5e7eb;
    /* Light Grey */
    color: #374151;
    transition: all 0.2s;
    margin: 0;
    /* Let gap handle it */
}

.dark .tag-filter {
    background: #3f3f46;
    color: #e4e4e7;
}

.tag-filter:hover,
.tag-filter.active {
    background: #6366f1 !important;
    /* Indigo */
    color: white !important;
    transform: translateY(-1px);
}

/* Post Grid & Cards */
#posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    /* Responsive Grid */
    gap: 1.5rem;
}

.post-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    /* Fix for layout */
    flex-direction: column;
}

.dark .post-card {
    background: #18181b;
    /* Zinc 900 */
    border-color: #333;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.post-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.post-card .content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: #111;
}

.dark .post-card h2 {
    color: #fff;
}

.post-card p {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.dark .post-card p {
    color: #aaa;
}

/* Floating Date */
.date-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark .date-badge {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
}

/* Filter Bar & Search Tweaks */
.filter-bar {
    transition: background 0.3s, border-color 0.3s;
}

.dark .filter-bar {
    background: rgba(30, 30, 30, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark #post-search {
    background: #000 !important;
    color: white !important;
    border-color: #333 !important;
}

.dark .tag-filter {
    background: #333 !important;
    color: #ddd !important;
}

/* Standardize Active State for ALL filters */
.tag-filter.active,
.time-filter.active,
.year-filter.active,
.category-filter.active,
.dark .tag-filter.active,
.dark .time-filter.active,
.dark .year-filter.active,
.dark .category-filter.active {
    background: #6366f1 !important;
    color: white !important;
    border-color: #6366f1 !important;
}

/* TOC Styles (Clean/Lark) */
/* Ensure no duplicate TOCs appear in the content body */
.prose .toc,
.prose #TableOfContents {
    display: none !important;
}

/* Sidebar TOC overrides */
aside #TableOfContents {
    display: block !important;
}

aside #TableOfContents ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

aside #TableOfContents li {
    margin: 2px 0;
}

aside #TableOfContents a {
    color: #3f3f46;
    /* zinc-700 - Darker for better light mode readabilty */
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    line-height: 1.6;
    /* Slightly more breathing room */
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    /* Slightly larger text */
    border-left: 2px solid transparent;
    font-weight: 500;
    /* Medium weight for readability */
}

.dark aside #TableOfContents a {
    color: #e4e4e7;
    /* zinc-200 - Brighter for dark mode */
}

aside #TableOfContents a:hover {
    color: #000;
    /* Pure black on hover */
    background: rgba(0, 0, 0, 0.05);
}

.dark aside #TableOfContents a:hover {
    color: #fff;
    /* Pure white on hover */
    background: rgba(255, 255, 255, 0.1);
}

/* Deep nesting adjustments */
aside #TableOfContents ul ul {
    padding-left: 0;
    margin-top: 4px;
}

aside #TableOfContents ul ul a {
    padding-left: 16px;
    font-size: 0.85rem;
    color: #52525b;
    /* zinc-600 */
    font-weight: 400;
}

.dark aside #TableOfContents ul ul a {
    color: #a1a1aa;
    /* zinc-400 */
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.3);
    border-radius: 20px;
}

/* ENFORCE VISIBILITY RULES (Bypass Tailwind if needed) */
@media (max-width: 1023px) {
    #DesktopSidebar {
        display: none !important;
    }

    #MobileTOC {
        display: block !important;
    }
}

@media (min-width: 1024px) {
    #DesktopSidebar {
        display: block !important;
    }

    #MobileTOC {
        display: none !important;
    }
}

/* Time Filter specific tweaks */
.time-filter {
    font-size: 0.7rem;
    padding: 4px 10px;
}