/**
 * NavStack Public CSS
 */

.navstack-set-title {
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: bold;
}

/* Accordion Style */
.navstack-accordion {
    border: 1px solid #ddd;
    border-radius: 4px;
}

.navstack-accordion-item {
    border-bottom: 1px solid #ddd;
}

.navstack-accordion-item:last-child {
    border-bottom: none;
}

.navstack-accordion-header {
    padding: 12px 15px;
    background: #f7f7f7;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
}

.navstack-accordion-header:hover {
    background: #ebebeb;
}

.navstack-accordion-icon {
    transition: transform 0.3s;
}

.navstack-accordion-icon.open {
    transform: rotate(180deg);
}

.navstack-accordion-content {
    display: none;
    padding: 15px;
    background: #fff;
}

.navstack-accordion-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.navstack-accordion-content li {
    padding: 5px 0;
}

.navstack-accordion-content a {
    text-decoration: none;
}

/* Dropdown Style */
.navstack-dropdown {
    margin: 10px 0;
}

.navstack-dropdown-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

/* Flat List Style */
.navstack-flat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.navstack-flat-list > li {
    margin-bottom: 10px;
}

.navstack-flat-list > li > a {
    display: inline-block;
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.3s;
}

.navstack-flat-list > li > a:hover {
    background: #e0e0e0;
}

.navstack-flat-list ul {
    list-style: none;
    padding: 0 0 0 20px;
    margin: 5px 0 0 0;
}

.navstack-flat-list ul li {
    padding: 3px 0;
}

/* Post Count Styling */
.navstack-post-count {
    font-size: 0.85em;
    color: #666;
    font-weight: normal;
    margin-left: 5px;
}

/* Category States */
.navstack-category-item {
    transition: all 0.2s ease;
    position: relative;
}

.navstack-category-item.navstack-hovered {
    background: rgba(0, 123, 255, 0.05);
}

.navstack-category-item.navstack-selected {
    background: rgba(0, 123, 255, 0.1);
    font-weight: bold;
}

.navstack-category-item.navstack-active a,
.navstack-category-active {
    color: #007cba;
    font-weight: bold;
}

/* Submenu styles for child categories */
.navstack-category-item ul,
.navstack-category-item .sub-menu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 200px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
    border-radius: 4px;
    z-index: 999;
    padding: 5px 0;
}

.navstack-category-item:hover > ul,
.navstack-category-item.hover > ul,
.navstack-category-item:hover > .sub-menu,
.navstack-category-item.hover > .sub-menu {
    display: block;
}

.navstack-category-item ul li {
    padding: 0;
    margin: 0;
}

.navstack-category-item ul li a {
    display: block;
    padding: 8px 15px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
}

.navstack-category-item ul li a:hover {
    background: #f5f5f5;
    color: #007cba;
}

/* Arrow indicator for items with children */
.menu-item-has-children > a:after {
    content: '▸';
    float: right;
    margin-left: 10px;
    opacity: 0.5;
}

/* Nested sub-menu styles */
.navstack-category-item ul.sub-menu,
.navstack-category-item .navstack-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Hidden categories */
.navstack-category-item.navstack-hidden {
    opacity: 0.3;
    pointer-events: none;
}

/* Clear Button Styles */
.navstack-clear-item {
    border-top: 1px solid #eee;
    margin-top: 5px;
    padding-top: 5px;
    display: none; /* Hidden by default */
}

/* Completely hide if admin setting is disabled */
body.navstack-clear-disabled .navstack-clear-item {
    display: none !important;
}

.navstack-clear-selection {
    color: inherit;
    font-weight: 500;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    border-radius: 4px;
    transition: all 0.3s ease;
    background-color: rgba(0, 0, 0, 0.05);
    text-align: center;
}

.navstack-clear-selection:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: inherit;
    text-decoration: none;
}

.navstack-clear-icon {
    font-weight: normal;
    margin-right: 5px;
    font-size: 14px;
    vertical-align: middle;
    opacity: 0.7;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    /* Main menu container */
    .navstack-menu-item {
        position: relative;
        margin-bottom: 10px;
    }
    
    .navstack-submenu,
    .sub-menu {
        position: static !important;
        display: none;
        box-shadow: none;
        margin-left: 0;
        width: 100%;
        background: #f8f8f8;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        margin-top: 10px;
        max-height: 400px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .navstack-menu-item.active .navstack-submenu,
    .navstack-menu-item.open .navstack-submenu,
    .navstack-menu-item.active .sub-menu,
    .navstack-menu-item.open .sub-menu,
    .menu-item-has-children.active .sub-menu,
    .menu-item-has-children.open .sub-menu {
        display: block !important;
    }
    
    .navstack-menu-item > a {
        cursor: pointer;
        position: relative;
        padding: 12px 40px 12px 15px;
        display: block;
        background: #f0f0f0;
        border-radius: 4px;
        margin-bottom: 5px;
        font-weight: 600;
        font-size: 16px;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
        user-select: none;
    }
    
    .navstack-menu-item > a:after {
        content: '▼';
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 14px;
        transition: transform 0.3s;
    }
    
    .navstack-menu-item.open > a:after {
        transform: translateY(-50%) rotate(180deg);
    }
    
    /* Category items for large touch area */
    .navstack-category-item {
        margin-bottom: 5px;
        display: block !important; /* Fix visibility issue */
    }
    
    .navstack-category-item a {
        padding: 12px 15px;
        display: block;
        border-bottom: 1px solid #e0e0e0;
        background: #fff;
        margin-bottom: 2px;
        border-radius: 4px;
        font-size: 16px; /* Prevent iOS zoom */
        text-decoration: none;
        -webkit-tap-highlight-color: rgba(0,123,186,0.2);
        position: relative;
    }
    
    .navstack-category-item a:active {
        background: #e8e8e8;
    }
    
    .navstack-category-item.navstack-active a,
    .navstack-category-item.navstack-selected a {
        background: #007cba;
        color: #fff;
    }
    
    .navstack-category-item.navstack-hidden {
        display: none !important;
    }
    
    /* Clear button mobile styles */
    .navstack-clear-item {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 2px solid #e0e0e0;
        display: block !important; /* Show on mobile when needed */
    }
    
    .navstack-clear-selection {
        background: rgba(0, 0, 0, 0.08);
        color: inherit;
        text-align: center;
        padding: 12px 15px;
        border-radius: 4px;
        font-size: 16px;
        font-weight: 500;
        border: 1px solid rgba(0, 0, 0, 0.12);
    }
    
    .navstack-clear-selection:active {
        background: rgba(0, 0, 0, 0.12);
    }
    
    /* Post count styling */
    .navstack-post-count {
        float: right;
        background: rgba(0,0,0,0.1);
        padding: 2px 8px;
        border-radius: 12px;
        font-size: 12px;
    }
    
    .navstack-category-item.navstack-selected .navstack-post-count,
    .navstack-category-item.navstack-active .navstack-post-count {
        background: rgba(255,255,255,0.3);
        color: #fff;
    }
    
    /* Child categories in mobile */
    .navstack-category-item ul.sub-menu,
    .menu-item-has-children .sub-menu {
        position: static !important;
        display: none !important; /* Initially hidden */
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        margin: 5px 0 5px 20px !important;
        padding: 0 !important;
        width: auto !important;
    }
    
    /* Show submenu when parent is open */
    .navstack-category-item.open > ul.sub-menu,
    .menu-item-has-children.open > .sub-menu {
        display: block !important;
    }
    
    .navstack-category-item ul.sub-menu li a {
        padding: 10px 12px;
        font-size: 14px;
        background: #f5f5f5;
    }
    
    /* Remove hover states on mobile */
    .navstack-category-item:hover > ul,
    .menu-item-has-children:hover > .sub-menu {
        display: none; /* Disable hover on mobile */
    }
    
    /* Arrow for parent items */
    .menu-item-has-children > a:after {
        display: none;
    }
    
    /* Accordion and Dropdown styles */
    .navstack-accordion-content {
        max-height: 400px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
    }
    
    .navstack-dropdown-select {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 12px 15px;
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='14' height='8' viewBox='0 0 14 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1L7 7L13 1' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 15px center;
        padding-right: 40px;
    }
    
    /* Touch feedback */
    .navstack-category-item a,
    .navstack-accordion-header,
    .navstack-dropdown-select {
        -webkit-tap-highlight-color: rgba(0,123,186,0.2);
    }
}

/* Tablet responsive */
@media (min-width: 769px) and (max-width: 1024px) {
    .navstack-submenu {
        min-width: 250px;
    }
    
    .navstack-category-item a {
        padding: 10px 15px;
    }
}

/* Fix for theme compatibility */
.gridhot-posts-grid,
.entry-content {
    clear: both;
    margin-top: 30px;
}

/* Hide Debug Info (in Production) */
body:not(.wp-debug) .navstack-debug-info {
    display: none !important;
}

/* Theme-agnostic clear button styles */
.navstack-clear-selection {
    /* Reset any theme styles */
    all: initial;
    /* Apply our styles */
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: rgba(0, 0, 0, 0.05);
    padding: 8px 12px;
    text-decoration: none !important;
    display: block;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
    border: 1px solid transparent;
}

.navstack-clear-selection:hover,
.navstack-clear-selection:focus {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.15);
    text-decoration: none !important;
    color: inherit;
}

/* Combined Category Descriptions */
.navstack-combined-descriptions {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.navstack-category-description {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.navstack-category-description:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.navstack-category-description h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.3em;
    color: #333;
}

.navstack-category-description .description-content {
    color: #6c757d;
    line-height: 1.6;
}

/* Mobile Responsive */
/* Fast Filter System */
.navstack-fast-filter {
    margin-bottom: 1em;
}

.navstack-filter-title {
    margin-bottom: 0.5em;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.navstack-filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.navstack-filter-select {
    max-width: 300px;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.navstack-filter-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.navstack-filter-select:hover {
    border-color: #999;
}

.navstack-filter-submit {
    padding: 8px 15px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.navstack-filter-submit:hover {
    background: #005a87;
}

.navstack-filter-submit:active {
    background: #004768;
}

/* Multiple filters container */
.navstack-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.navstack-filters-container .navstack-fast-filter {
    margin-bottom: 0;
    flex: 1;
    min-width: 250px;
}

/* Active filter indication */
.navstack-fast-filter.has-selection .navstack-filter-select {
    border-color: #0073aa;
    background: #f0f8ff;
}

@media screen and (max-width: 768px) {
    .navstack-combined-descriptions {
        padding: 15px;
    }
    
    .navstack-category-description h2 {
        font-size: 1.1em;
    }
    
    .navstack-filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .navstack-filter-select {
        max-width: none;
    }
    
    .navstack-filters-container {
        flex-direction: column;
    }
    
    .navstack-filters-container .navstack-fast-filter {
        min-width: auto;
    }
}

/* Hide clear button when disabled */
body.navstack-clear-disabled .navstack-clear-all,
body.navstack-clear-disabled .navstack-clear-button,
body.navstack-clear-disabled .navstack-clear-filter {
    display: none !important;
}

/* Hide category prefix when enabled */
body.navstack-hide-category-prefix .page-title::before,
body.navstack-hide-category-prefix .archive-title::before,
body.navstack-hide-category-prefix h1.page-title::before,
body.navstack-hide-category-prefix h1.archive-title::before {
    content: '';
    display: none;
}

/* WPML Language Switcher Hover Fix */
.wpml-ls-item a:hover,
.wpml-ls-link:hover,
a[hreflang]:hover,
.wpml-ls-slot-footer a:hover {
    /* Force browser to re-read href on hover */
    pointer-events: auto;
}



/* Try to hide the actual "Category:" text */
body.navstack-hide-category-prefix .page-title,
body.navstack-hide-category-prefix .archive-title,
body.navstack-hide-category-prefix h1.page-title,
body.navstack-hide-category-prefix h1.archive-title {
    /* This will work for themes that use text nodes */
}

/* For themes that wrap the prefix in a specific element */
body.navstack-hide-category-prefix .page-title > span:first-child,
body.navstack-hide-category-prefix .archive-title > span:first-child,
body.navstack-hide-category-prefix h1.page-title > span:first-child,
body.navstack-hide-category-prefix h1.archive-title > span:first-child {
    /* Hide if the span contains "Category:" or similar */
}

/* Hide pagination on category pages */
.category .nav-links,
.category .navigation.pagination,
.category .navigation.posts-navigation,
.category .page-numbers,
.category .pagination,
.category .wp-pagenavi,
.category .page-links,
.category .post-navigation,
.category .paging-navigation,
.category [class*="pagination"],
.category [class*="page-navi"],
.category [class*="pagenavi"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
} 