/* [B] Elementor Dynamic TOC - Base Styles */

.bdw-dtoc-container {
    background-color: #f8fafc; /* Light fallback */
    border: 1px solid #e2e8f0;
    border-radius: 8px; /* Must match the elementor control */
    transition: all 0.3s ease;
    overflow: hidden; /* Crucial to keep the header background inside the border radius */
    align-self: start; /* Helps with sticky position inside flex/grid layouts */
}

/* Sticky modifier applied via Elementor switch */
.bdw-dtoc-container.is-sticky {
    position: -webkit-sticky;
    position: sticky;
    /* top value is injected dynamically via Elementor offset setting */
    top: 80px; 
    z-index: 10; /* Keep it above standard content, below primary nav */
}

/* Header segmentation */
.bdw-dtoc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background-color: #003366; /* Default Dark Blue */
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.bdw-dtoc-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #ffffff;
    margin: 0;
    flex: 1;
}

.bdw-dtoc-toggle {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.bdw-dtoc-toggle svg {
    fill: #ffcc00; /* Default yellow */
    transition: transform 0.3s ease;
    /* Width/Height injected by Elementor */
}

/* Body and List Styling */
.bdw-dtoc-body {
    overflow: hidden;
    max-height: 2500px; /* Allows CSS animation */
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
}

/* Collapsed State */
.bdw-dtoc-container.is-collapsed .bdw-dtoc-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.bdw-dtoc-container.is-collapsed .bdw-dtoc-toggle svg {
    transform: rotate(-180deg);
}

/* List Formatting */
.bdw-dtoc-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    counter-reset: bdw-toc-counter;
}

.bdw-dtoc-item {
    margin-bottom: 12px;
    position: relative;
    padding-left: 24px;
}

.bdw-dtoc-item:last-child {
    margin-bottom: 0;
}

.bdw-dtoc-item::before {
    counter-increment: bdw-toc-counter;
    content: counter(bdw-toc-counter) ".";
    position: absolute;
    left: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: #003366; /* Usually inherits hover color via PHP selector */
}

/* Hierarchy indents */
.bdw-dtoc-level-h3 { margin-left: 15px; }
.bdw-dtoc-level-h4 { margin-left: 30px; }
.bdw-dtoc-level-h5 { margin-left: 45px; }

.bdw-dtoc-list a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: color 0.2s ease, font-weight 0.2s ease;
    display: block;
}

.bdw-dtoc-list a:hover,
.bdw-dtoc-list a.is-active {
    color: #0f172a;
    font-weight: 700;
}