/* ==========================================================================
   ADVANCED CATEGORY HIERARCHY - COMPLETE CSS
   ========================================================================== */

/* --- Master Expand/Collapse Toggle --- */
.mnh-master-toggle-wrapper {
    margin-bottom: 8px;
}

.mnh-master-toggle {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    user-select: none;
    transition: color 0.2s;
    display: inline-block;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
}

.mnh-master-toggle:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.mnh-trails-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Post Category Trails Styling --- */
.mnh-custom-category-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    font-family: inherit;
}

.mnh-category-trail {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    background: #f8fafc;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    line-height: 1.5;
}

.mnh-trail-separator {
    color: #94a3b8;
    margin: 0 6px;
    font-size: 12px;
}

.mnh-category-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    /* Forces long text to wrap instead of breaking the screen */
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}

.mnh-category-link:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

/* Specific styling to distinguish TAGS from Categories */
.mnh-category-link.mnh-tag-link {
    color: #059669; /* Emerald Green */
}

.mnh-category-link.mnh-tag-link:hover {
    color: #047857;
}

/* Toggle Expand/Collapse Styling */
.mnh-term-wrapper {
    /* Uses inline so expanded text flows naturally into multiple lines */
    display: inline;
}

.mnh-expand-btn {
    cursor: pointer;
    color: #64748b;
    font-size: 11px;
    font-weight: bold;
    margin-left: 4px;
    user-select: none;
    /* Prevents the [+] button from wrapping alone to the next line */
    white-space: nowrap;
}

.mnh-expand-btn:hover {
    color: #0f172a;
}

/* --- Floating Post List (Modal/Popover) --- */
.mnh-floating-list {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    max-height: 70vh;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    animation: popIn 0.2s ease-out;
}

.mnh-floating-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border-radius: 8px 8px 0 0;
}

.mnh-floating-header h4 {
    margin: 0;
    font-size: 16px;
    color: #0f172a;
    word-break: break-word;
}

.mnh-close-btn {
    cursor: pointer;
    font-weight: bold;
    color: #64748b;
    font-size: 20px;
    line-height: 1;
}

.mnh-floating-content {
    padding: 15px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling on iPhones */
}

.mnh-post-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.mnh-post-list li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.mnh-post-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.mnh-post-list a {
    text-decoration: none;
    color: #2563eb;
    font-weight: 500;
}

.mnh-post-list a:hover { 
    text-decoration: underline; 
}

/* Empty state text inside the modal */
.mnh-empty-state {
    color: #64748b;
    font-style: italic;
    text-align: center;
    padding: 15px 0;
}

.mnh-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
}

@keyframes popIn { 
    from { opacity: 0; transform: translate(-50%, -45%); } 
    to { opacity: 1; transform: translate(-50%, -50%); } 
}

/* --- Category/Tag Tree Shortcode Styling --- */
.mnh-tree-wrapper {
    font-family: inherit;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    /* NEW: Enables horizontal scrolling on mobile */
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
}

.mnh-tree-node {
    margin-bottom: 15px;
    /* NEW: Prevents deeply indented text from squishing into a single column */
    min-width: max-content; 
    padding-right: 15px; 
}

.mnh-tree-term-title {
    margin-bottom: 10px;
    word-break: break-word;
    /* We removed color, font-size, and borders so your native theme CSS takes over! */
}

.mnh-tree-post-list {
    list-style-type: disc !important;
    padding-left: 20px !important;
    margin: 0 0 15px 0 !important;
}

.mnh-tree-post-list li {
    margin-bottom: 6px;
}

.mnh-tree-post-list a {
    color: #2563eb;
    text-decoration: none;
    font-size: 15px;
}

.mnh-tree-post-list a:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

/* This handles the recursive indentation of subcategories */
.mnh-tree-children {
    margin-top: 15px;
    padding-left: 25px;
    border-left: 2px dashed #cbd5e1;
}

/* --- Empty Term Styling (Disabled Click) --- */
span.mnh-empty-link {
    color: #94a3b8 !important; /* Muted grey */
    cursor: not-allowed;
    text-decoration: none;
    font-weight: 400;
}
span.mnh-empty-link:hover {
    color: #94a3b8 !important; /* Prevents color change on hover */
    text-decoration: none;
}