/* Table of Contents Widget Styles */
.toc-widget {
    background: #ffffff;
    border-radius: 10px;
    padding: 8px 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #E5E7EB;
    width: 100%;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* VILLÁM GYORS JUMP - disable ALL smooth scrolling when clicking TOC */
.toc-jumping,
.toc-jumping *,
.toc-jumping html,
.toc-jumping body {
    scroll-behavior: auto !important;
    -webkit-scroll-behavior: auto !important;
    -moz-scroll-behavior: auto !important;
    -ms-scroll-behavior: auto !important;
    -o-scroll-behavior: auto !important;
}

/* Force instant scrolling on entire document during TOC jump */
html.toc-jumping,
body.toc-jumping {
    scroll-behavior: auto !important;
}

/* Disable smooth scrolling for any element during TOC navigation */
.toc-jumping *:not(.toc-widget):not(.toc-item) {
    scroll-behavior: auto !important;
    transition: none !important;
}

/* Width Control Options */
.toc-width-full .toc-widget {
    width: 100% !important;
}

.toc-width-content .toc-widget {
    width: fit-content !important;
    min-width: 200px;
    max-width: 100%;
    margin: 0 auto;
}

.toc-width-content .toc-content {
    flex-wrap: nowrap;
    justify-content: flex-start;
}

/* Ensure widget adapts to any Elementor container */
.elementor-widget-container .toc-widget,
.elementor-container .toc-widget,
.elementor-column .toc-widget,
.elementor-widget .toc-widget {
    width: 100% !important;
    max-width: none !important;
    min-width: unset !important;
}

/* Sticky Position - Base */
.toc-widget.sticky {
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(229, 231, 235, 0.8);
    z-index: 500 !important;
}

/* Ensure header/navigation elements are always on top */
header,
.header,
nav,
.nav,
.navigation,
.navbar,
.main-nav,
.primary-nav,
.site-header,
.elementor-location-header,
.elementor-kit-header,
.menu,
.main-menu,
.header-menu,
.nav-menu,
.dropdown,
.dropdown-menu,
.sub-menu,
.submenu,
.mega-menu {
    z-index: 9999 !important;
}

/* Common theme header selectors */
.site-header *,
.header *,
nav *,
.navigation *,
.navbar *,
.elementor-location-header *,
.menu * {
    z-index: inherit !important;
}

/* Fallback for older browsers */
@supports not (backdrop-filter: blur(10px)) {
    .toc-widget.sticky {
        background: rgba(255, 255, 255, 0.98) !important;
    }
}

/* Position variations */
.toc-widget.sticky.position-top-left {
    position: fixed !important;
    top: 20px;
    left: 20px;
    width: calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px);
    z-index: 500 !important;
}

.toc-widget.sticky.position-top-right {
    position: fixed !important;
    top: 20px;
    right: 20px;
    width: calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px);
    z-index: 500 !important;
}

.toc-widget.sticky.position-top-center {
    position: fixed !important;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px);
    z-index: 500 !important;
}

.toc-widget.sticky.position-bottom-center {
    position: fixed !important;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px);
    z-index: 500 !important;
}

/* Content-based width for sticky positions */
.toc-width-content .toc-widget.sticky.position-top-left {
    width: fit-content !important;
    min-width: 200px;
    max-width: calc(100vw - 40px);
}

.toc-width-content .toc-widget.sticky.position-top-right {
    width: fit-content !important;
    min-width: 200px;
    max-width: calc(100vw - 40px);
}

.toc-width-content .toc-widget.sticky.position-top-center {
    width: fit-content !important;
    min-width: 200px;
    max-width: calc(100vw - 40px);
}

.toc-width-content .toc-widget.sticky.position-bottom-center {
    width: fit-content !important;
    min-width: 200px;
    max-width: calc(100vw - 40px);
}

/* Enhanced responsive behavior for sticky */
@media (max-width: 768px) {
    .toc-widget.sticky {
        position: fixed !important;
        top: 8px !important;
        left: 8px !important;
        right: 8px !important;
        transform: none !important;
        width: calc(100% - 16px) !important;
        max-width: none !important;
        padding: 8px 12px !important;
    }
    
    .toc-widget.sticky .toc-content {
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 3px;
    }
    
    /* Content-based width on mobile - still full width for usability */
    .toc-width-content .toc-widget.sticky {
        width: calc(100% - 16px) !important;
        left: 8px !important;
        right: 8px !important;
    }
}

/* Header */
.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #E5E7EB;
}

.toc-title {
    font-size: 14px;
    font-weight: 700;
    color: #7C3AED;
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.toc-subtitle {
    font-size: 14px;
    color: #6B7280;
    font-weight: 500;
    padding: 4px 8px;
    background: #F3F4F6;
    border-radius: 6px;
}

/* Content */
.toc-content {
    display: flex;
    flex-direction: row;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #E5E7EB transparent;
    width: 100%;
    transition: all 0.3s ease;
}

/* Menu Groups */
.toc-menu-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

/* Submenu Container */
.toc-submenu {
    display: none; /* Initially hidden */
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    padding-left: 8px;
    border-left: 2px solid rgba(124, 58, 237, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Show submenu when expanded */
.toc-menu-group.expanded .toc-submenu {
    display: flex;
    animation: slideDown 0.3s ease;
}

/* Submenu slide down animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 300px;
    }
}

.toc-content::-webkit-scrollbar {
    height: 6px;
}

.toc-content::-webkit-scrollbar-track {
    background: transparent;
}

.toc-content::-webkit-scrollbar-thumb {
    background: #E5E7EB;
    border-radius: 3px;
}

.toc-content::-webkit-scrollbar-thumb:hover {
    background: #D1D5DB;
}

/* Items */
.toc-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    flex: 0 0 auto;
    white-space: nowrap;
    height: 28px;
}

.toc-item:hover {
    background-color: #F9FAFB;
    transform: translateY(-1px);
}

.toc-item.active {
    background-color: #7C3AED;
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.2);
}

.toc-item.active:hover {
    background-color: #6D28D9;
    transform: translateY(-1px);
}

/* Item content */
.toc-item a {
    display: flex;
    align-items: center;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.toc-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-right: 10px;
    flex-shrink: 0;
}

.toc-item-icon i {
    font-size: 10px;
    color: #7C3AED;
}

.toc-item.active .toc-item-icon i {
    color: #ffffff;
}

.toc-item-text {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    line-height: 1.3;
}

.toc-item.active .toc-item-text {
    color: #ffffff;
}

/* Submenu Item Styles */
.toc-item.submenu-item {
    padding: 2px 6px;
    height: 24px;
    font-size: 12px;
    background-color: #F9FAFB;
    border: 1px solid #E5E7EB;
    margin-bottom: 1px;
}

.toc-item.submenu-item:hover {
    background-color: #F3F4F6;
    transform: translateX(2px);
}

.toc-item.submenu-item.active {
    background-color: #6D28D9;
    border-color: #6D28D9;
}

.toc-item.submenu-item .toc-item-icon {
    width: 12px;
    height: 12px;
    margin-right: 6px;
}

.toc-item.submenu-item .toc-item-icon i {
    font-size: 8px;
    color: #9CA3AF;
}

.toc-item.submenu-item.active .toc-item-icon i {
    color: #ffffff;
}

.toc-item.submenu-item .toc-item-text {
    font-size: 11px;
    color: #6B7280;
}

.toc-item.submenu-item.active .toc-item-text {
    color: #ffffff;
}

/* Dropdown Arrow Styles */
.toc-dropdown-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    background-color: rgba(124, 58, 237, 0.1);
    flex-shrink: 0;
}

.toc-dropdown-arrow:hover {
    background-color: rgba(124, 58, 237, 0.2);
    transform: scale(1.1);
}

.toc-dropdown-arrow i {
    font-size: 10px;
    color: #7C3AED;
    transition: transform 0.3s ease;
}

/* Rotate arrow when expanded */
.toc-menu-group.expanded .toc-dropdown-arrow i {
    transform: rotate(180deg);
}

/* Active state for dropdown arrow */
.toc-item.active .toc-dropdown-arrow {
    background-color: rgba(255, 255, 255, 0.2);
}

.toc-item.active .toc-dropdown-arrow i {
    color: #ffffff;
}

/* Has submenu indicator */
.toc-item.has-submenu {
    position: relative;
}

.toc-item.has-submenu::after {
    content: '';
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 3px;
    background-color: rgba(124, 58, 237, 0.5);
    border-radius: 50%;
    pointer-events: none;
}

.toc-item-number {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .toc-widget {
        padding: 10px 16px;
        width: 100%;
    }
    
    .toc-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }
    
    .toc-content {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 3px;
    }
    
    .toc-item {
        padding: 3px 6px;
        flex: 0 0 auto;
        height: 24px;
    }
    
    .toc-item-text {
        font-size: 12px;
    }
    
    /* Submenu mobile styles */
    .toc-submenu {
        padding-left: 6px;
        gap: 1px;
        margin-top: 2px;
        border-left-width: 1px;
    }
    
    .toc-item.submenu-item {
        padding: 1px 4px;
        height: 20px;
        font-size: 10px;
    }
    
    .toc-item.submenu-item .toc-item-icon {
        width: 10px;
        height: 10px;
        margin-right: 4px;
    }
    
    .toc-item.submenu-item .toc-item-icon i {
        font-size: 7px;
    }
    
    .toc-item.submenu-item .toc-item-text {
        font-size: 10px;
    }
    
    /* Dropdown arrow mobile styles */
    .toc-dropdown-arrow {
        width: 16px;
        height: 16px;
        margin-left: 6px;
    }
    
    .toc-dropdown-arrow i {
        font-size: 8px;
    }
    
    .toc-item.has-submenu::after {
        width: 2px;
        height: 2px;
        right: 1px;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toc-widget {
    animation: fadeInUp 0.3s ease;
}

.toc-item {
    animation: fadeInUp 0.3s ease;
    animation-fill-mode: both;
}

.toc-item:nth-child(1) { animation-delay: 0.05s; }
.toc-item:nth-child(2) { animation-delay: 0.1s; }
.toc-item:nth-child(3) { animation-delay: 0.15s; }
.toc-item:nth-child(4) { animation-delay: 0.2s; }
.toc-item:nth-child(5) { animation-delay: 0.25s; }
.toc-item:nth-child(6) { animation-delay: 0.3s; }
.toc-item:nth-child(7) { animation-delay: 0.35s; }
.toc-item:nth-child(8) { animation-delay: 0.4s; }

/* Focus states for accessibility */
.toc-item:focus {
    outline: 2px solid #7C3AED;
    outline-offset: 2px;
}

/* Additional hover effects */
.toc-item:not(.active):hover .toc-item-icon i {
    color: #7C3AED;
    transform: scale(1.1);
} 