/* Table of Contents Styling for Bleaching Page */
.article-toc-container {
    background: transparent;
    padding: 2.5rem 0;
    margin: 3rem 0;
}

.article-toc {
    max-width: 700px;
    margin: 0 auto;
    text-align: left;
    background: rgba(240, 253, 250, 0.5);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.article-toc-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(35, 207, 178, 0.2);
}

.article-toc-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: transparent;
    padding: 0;
}

.article-toc-item {
    display: block;
    padding: 0.75rem 0;
    color: var(--text-secondary);
    text-decoration: underline;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
    transition: all 0.3s ease;
    background: transparent;
    position: relative;
}

.article-toc-item .toc-number {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    margin-right: 0.5rem;
}

.article-toc-item:hover {
    color: var(--primary-color);
}

.article-toc-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Mobile Sticky TOC */
.article-toc-mobile-sticky {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 2000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(35, 207, 178, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    transition: all 0.3s ease;
}

.article-toc-mobile-sticky.sticky-visible {
    transform: translateY(0);
}

.article-toc-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.article-toc-mobile-header:hover {
    background-color: rgba(35, 207, 178, 0.03);
}

.article-toc-mobile-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    margin-right: 1rem;
}

.article-toc-mobile-title {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    line-height: 1;
}

.article-toc-mobile-current-wrapper {
    position: relative;
    width: 100%;
    height: 1.4rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.article-toc-mobile-current {
    position: absolute;
    width: 100%;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-primary);
    text-align: left;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity 0.25s ease;
    opacity: 1;
}

.article-toc-mobile-current.fade-out {
    opacity: 0;
}

.article-toc-mobile-current.fade-in {
    opacity: 1;
}

.article-toc-mobile-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-toc-mobile-toggle:hover {
    background: rgba(35, 207, 178, 0.1);
}

.article-toc-mobile-toggle.expanded svg {
    transform: rotate(180deg);
}

.article-toc-mobile-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
    border-top: 1px solid rgba(35, 207, 178, 0.1);
}

.article-toc-mobile-sticky.expanded .article-toc-mobile-nav {
    max-height: 400px;
    overflow-y: auto;
}

.article-toc-mobile-item {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: underline;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.article-toc-mobile-item .toc-number {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    margin-right: 0.5rem;
}

.article-toc-mobile-item:hover {
    color: var(--primary-color);
}

.article-toc-mobile-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Desktop Sticky TOC */
.article-toc-desktop-sticky {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 450px;
    max-width: 450px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(35, 207, 178, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.article-toc-desktop-sticky.sticky-visible {
    transform: translateY(0);
    opacity: 1;
    display: block;
}

.article-toc-desktop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    cursor: pointer;
    user-select: none;
    border-radius: 12px 12px 0 0;
    transition: background-color 0.2s ease;
}

.article-toc-desktop-header:hover {
    background-color: rgba(35, 207, 178, 0.05);
}

.article-toc-desktop-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    margin-right: 0.8rem;
}

.article-toc-desktop-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1;
}

.article-toc-desktop-current-wrapper {
    position: relative;
    width: 100%;
    min-height: 2rem;
    display: flex;
    align-items: center;
}

.article-toc-desktop-current {
    width: 100%;
    max-width: 370px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: left;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity 0.25s ease;
    opacity: 1;
}

.article-toc-desktop-current.fade-out {
    opacity: 0;
}

.article-toc-desktop-current.fade-in {
    opacity: 1;
}

.article-toc-desktop-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.article-toc-desktop-toggle:hover {
    background: rgba(35, 207, 178, 0.1);
}

.article-toc-desktop-toggle.expanded svg {
    transform: rotate(180deg);
}

.article-toc-desktop-nav {
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
    border-radius: 0 0 12px 12px;
    box-sizing: border-box;
}

.article-toc-desktop-sticky.expanded .article-toc-desktop-nav {
    max-height: 400px;
    overflow-y: auto;
}

.article-toc-desktop-item {
    display: block;
    padding: 0.4rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
    transition: color 0.2s ease;
    border-left: 2px solid transparent;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    box-sizing: border-box;
}

.article-toc-desktop-item:hover {
    color: var(--primary-color);
}

.article-toc-desktop-item.active {
    color: var(--primary-color);
    font-weight: 500;
    border-left-color: var(--primary-color);
}

/* Mobile responsive TOC */
@media (max-width: 768px) {
    .article-toc-container {
        padding: 2rem 1rem;
        margin: 2rem 0;
    }

    .article-toc {
        padding: 1.5rem;
    }

    .article-toc-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .article-toc-nav {
        padding: 0;
        gap: 0.5rem;
    }

    .article-toc-item {
        padding: 0.5rem 0;
        font-size: 0.9rem;
    }

    /* Show mobile sticky TOC */
    .article-toc-mobile-sticky {
        display: block;
    }

    /* Hide desktop sticky TOC on mobile */
    .article-toc-desktop-sticky {
        display: none !important;
    }
}

/* Desktop only - show desktop sticky TOC */
@media (min-width: 769px) {
    .article-toc-desktop-sticky {
        display: none; /* Will be shown by JavaScript when needed */
    }

    .article-toc-mobile-sticky {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .article-toc-container {
        padding: 1.5rem 1rem;
        margin: 1.5rem 0;
    }

    .article-toc {
        padding: 1.2rem;
    }

    .article-toc-title {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
        padding-bottom: 0.6rem;
    }

    .article-toc-nav {
        padding: 0;
        gap: 0.4rem;
    }

    .article-toc-item {
        padding: 0.4rem 0;
        font-size: 0.85rem;
        line-height: 1.4;
    }

    /* Mobile sticky adjustments */
    .article-toc-mobile-header {
        padding: 0.5rem 1rem;
    }

    .article-toc-mobile-content {
        margin-right: 0.5rem;
        gap: 0.2rem;
    }

    .article-toc-mobile-title {
        font-size: 0.6rem;
        letter-spacing: 0.6px;
    }

    .article-toc-mobile-current-wrapper {
        height: 1.6rem;
    }

    .article-toc-mobile-current {
        font-size: 0.8rem;
    }

    .article-toc-mobile-item {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}
