/* Base Styles */
.custom-toc-wrapper {
    margin: 2rem 0;
    padding: 1.5rem;
    box-sizing: border-box;
}

.custom-toc-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.custom-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.custom-toc-item {
    margin: 0.5rem 0;
}

.custom-toc-item a {
    text-decoration: none;
    color: inherit;
    display: block;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.custom-toc-h1 {
    margin-left: 0;
    font-weight: 700;
}

.custom-toc-h2 {
    margin-left: 1.5rem;
}

.custom-toc-h3 {
    margin-left: 3rem;
}

.custom-toc-h4 {
    margin-left: 4.5rem;
}

.custom-toc-h5 {
    margin-left: 6rem;
}

.custom-toc-h6 {
    margin-left: 7.5rem;
}

/* Flat Design Template */
.custom-toc-flat {
    background: var(--toc-bg-color, #f5f5f5);
    border-left: 4px solid #2196F3;
    border-radius: 4px;
}

.custom-toc-flat .custom-toc-item a {
    color: var(--toc-text-color, #333333);
}

.custom-toc-flat .custom-toc-title {
    color: var(--toc-title-color, #2196F3);
}

.custom-toc-flat .custom-toc-item a:hover {
    background: #e3f2fd;
    padding-left: 1rem;
}

.custom-toc-flat .custom-toc-item.active a {
    background: #bbdefb;
    font-weight: 600;
    color: var(--toc-text-color, #333333);
}

/* Material Design Template */
.custom-toc-material {
    background: var(--toc-bg-color, #ffffff);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
}

.custom-toc-material .custom-toc-title {
    color: var(--toc-title-color, #1976D2);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.custom-toc-material .custom-toc-item a {
    color: var(--toc-text-color, #333333);
    border-radius: 4px;
}

.custom-toc-material .custom-toc-item a:hover {
    background: #E3F2FD;
    transform: translateX(4px);
}

.custom-toc-material .custom-toc-item.active a {
    background: #2196F3;
    color: #ffffff;
}

/* Minimalist Template */
.custom-toc-minimalist {
    background: transparent;
    border: none;
    padding: 0;
}

.custom-toc-minimalist .custom-toc-title {
    color: var(--toc-title-color, #333333);
    border-bottom: 2px solid var(--toc-text-color, #333333);
    display: inline-block;
    padding-bottom: 5px;
}

.custom-toc-minimalist .custom-toc-item a {
    color: var(--toc-text-color, #333333);
    padding: 2px 0;
    transition: color 0.1s ease;
}

.custom-toc-minimalist .custom-toc-item a:hover {
    text-decoration: underline;
    color: var(--toc-title-color, #000);
}

/* Brutalist Template */
.custom-toc-brutalist {
    background: var(--toc-bg-color, #ffffff);
    border: 4px solid #000;
    box-shadow: 8px 8px 0px #000;
    border-radius: 0;
}

.custom-toc-brutalist .custom-toc-title {
    color: var(--toc-title-color, #000000);
    text-transform: uppercase;
    border-bottom: 4px solid #000;
    padding-bottom: 10px;
    letter-spacing: 1px;
}

.custom-toc-brutalist .custom-toc-item a {
    color: var(--toc-text-color, #000000);
    font-family: 'Courier New', monospace;
    font-weight: bold;
    border-bottom: 1px solid #000;
    margin-bottom: 5px;
}

.custom-toc-brutalist .custom-toc-item a:hover {
    background: #000;
    color: #fff;
    padding-left: 10px;
}

/* Neo-Brutalist Template (Pro - Gumroad Style) */
.custom-toc-neo-brutalist {
    background: var(--toc-bg-color, #ffffff);
    border: 3px solid #000;
    box-shadow: 6px 6px 0px #000;
    border-radius: 6px;
    padding: 20px;
    transition: all 0.2s ease;
}

.custom-toc-neo-brutalist .custom-toc-title {
    color: var(--toc-title-color, #000);
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: 1.5rem;
    border-bottom: 3px solid #000;
    padding-bottom: 15px;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
}

.custom-toc-neo-brutalist .custom-toc-item a {
    color: var(--toc-text-color, #000);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    background: #FF61F6;
    /* Vibrant Pink */
    border: 2px solid #000;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 3px 3px 0px #000;
    text-decoration: none;
    display: block;
}

.custom-toc-neo-brutalist .custom-toc-item a:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0px #000;
    background: #ffde59;
    /* Yellow on hover */
}

/* Glassmorphism Template (Pro - Apple Style) */
.custom-toc-glassmorphism {
    background: rgba(255, 255, 255, 0.65);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 24px;
}

.custom-toc-glassmorphism .custom-toc-title {
    color: var(--toc-title-color, #1d1d1f);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 16px;
}

.custom-toc-glassmorphism .custom-toc-item a {
    color: var(--toc-text-color, #1d1d1f);
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.custom-toc-glassmorphism .custom-toc-item a:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Neomorphism Template (Pro - Soft UI) */
.custom-toc-neomorphism {
    background: var(--toc-bg-color, #e0e5ec);
    border-radius: 20px;
    box-shadow: 9px 9px 16px rgb(163, 177, 198, 0.6), -9px -9px 16px rgba(255, 255, 255, 0.5);
    padding: 24px;
}

.custom-toc-neomorphism .custom-toc-title {
    color: var(--toc-title-color, #4d4d4d);
    font-weight: 700;
    text-shadow: 1px 1px 1px #fff;
}

.custom-toc-neomorphism .custom-toc-item a {
    color: var(--toc-text-color, #4d4d4d);
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: var(--toc-bg-color, #e0e5ec);
    box-shadow: 5px 5px 10px #a3b1c6, -5px -5px 10px #ffffff;
    transition: all 0.2s ease;
}

.custom-toc-neomorphism .custom-toc-item a:hover {
    box-shadow: inset 5px 5px 10px #a3b1c6, inset -5px -5px 10px #ffffff;
    color: #333;
}

/* Bauhaus Template (Pro - Geometric) */
/* Bauhaus Template (Pro - Geometric) */
.custom-toc-bauhaus {
    background: #ffffff;
    border: none;
    padding: 0;
    position: relative;
    max-width: 100%;
}

.custom-toc-bauhaus .custom-toc-title {
    font-family: 'Futura', 'Segoe UI', sans-serif;
    text-transform: uppercase;
    font-weight: 700;
    color: #000;
    letter-spacing: 1px;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* Red square before title */
.custom-toc-bauhaus .custom-toc-title::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #d22f27;
    /* Red */
    border-radius: 0;
    /* Square */
}

.custom-toc-bauhaus .custom-toc-item a {
    position: relative;
    padding-left: 20px;
    color: #000;
    font-family: 'Futura', 'Segoe UI', sans-serif;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

.custom-toc-bauhaus .custom-toc-item a:hover {
    color: #204c89;
    /* Blue on hover */
    text-decoration: underline;
}

/* Blue circle bullets for all items */
.custom-toc-bauhaus .custom-toc-item {
    list-style: none;
    position: relative;
    margin-bottom: 8px;
}

.custom-toc-bauhaus .custom-toc-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    /* Center vertically relative to line height */
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #204c89;
    /* Blue */
    border-radius: 50%;
    /* Circle */
}

/* Indent sub-items and adjust bullet position if needed */
.custom-toc-bauhaus .custom-toc-h2 {
    margin-left: 0;
}

.custom-toc-bauhaus .custom-toc-h3 {
    margin-left: 20px;
}

.custom-toc-bauhaus .custom-toc-h4 {
    margin-left: 40px;
}

/* In Bauhaus, keep bullets consistent */
.custom-toc-bauhaus .custom-toc-h3::before {
    background: #204c89;
    clip-path: none;
    border-radius: 50%;
}

.custom-toc-bauhaus .custom-toc-h2 a::before {
    border-radius: 0;
    background: #d22f27;
}

.custom-toc-bauhaus .custom-toc-h3 a::before {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background: #204c89;
    border-radius: 0;
}

/* Floating & Accordion (Pro Features) */
.custom-toc-accordion .custom-toc-nav {
    display: none;
    /* Initially hidden, toggled via JS in real Pro */
}

.custom-toc-accordion.open .custom-toc-nav {
    display: block;
}

.custom-toc-floating {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 9999;
    width: 300px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

/* Clean Design Template fallback if needed, but not using it currently */
.custom-toc-clean {
    border: 1px solid #e0e0e0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .custom-toc-wrapper {
        padding: 1rem;
    }

    .custom-toc-floating {
        width: 48px;
        height: 48px;
        overflow: hidden;
        border-radius: 50%;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        background: var(--toc-title-color, #222);
        color: #fff;
    }
}