/* Table of Contents Widget Styles */
.fps-toc-widget {
    margin: 15px 0;
    padding: 15px;
    background: #2d3748;         /* dark mode */
    border: 1px solid #4a5568;   /* dark mode */
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #e2e8f0;              /* dark mode */
}

.fps-toc-widget label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #e2e8f0;              /* dark mode */
    font-size: 14px;
}

/* Navigation layout with buttons */
.fps-toc-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fps-toc-nav-buttons-row {
    display: contents; /* Desktop: buttons integrated into main flex layout */
}

.fps-toc-nav-button {
    flex: 0 0 auto;
    min-width: 80px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fps-toc-prev {
    justify-content: flex-start;
    order: -1; /* Ensure Previous button appears first */
}

.fps-toc-next {
    justify-content: flex-end;
    order: 1; /* Ensure Next button appears last */
}

.fps-toc-dropdown-container {
    flex: 1 1 auto;
    order: 0; /* Dropdown appears in the middle */
}

.fps-toc-nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 12px;
    background: #63b3ed;         /* dark mode */
    color: #1a202c;              /* dark mode */
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.15s ease-in-out;
    border: 1px solid #63b3ed;   /* dark mode */
}

.fps-toc-nav-link:hover {
    background: #4299e1;         /* dark mode */
    border-color: #4299e1;       /* dark mode */
    color: #1a202c;              /* dark mode */
    text-decoration: none;
}

.fps-toc-nav-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.25); /* dark mode */
}

.fps-toc-nav-arrow {
    font-size: 16px;
    line-height: 1;
}

.fps-toc-nav-text {
    font-size: 13px;
}

.fps-toc-nav-placeholder {
    display: block;
    width: 80px;
    height: 44px;
}

.fps-toc-dropdown {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #718096;       /* dark mode */
    border-radius: 4px;
    background-color: #4a5568;       /* dark mode */
    color: #e2e8f0;                  /* dark mode */
    cursor: pointer;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.fps-toc-dropdown:focus {
    outline: none;
    border-color: #63b3ed;           /* dark mode */
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.25); /* dark mode */
}

.fps-toc-dropdown:hover {
    border-color: #a0aec0;           /* dark mode */
}

/* Responsive design */
@media (max-width: 768px) {
    .fps-toc-widget {
        margin: 10px 0;
        padding: 12px;
    }
    
    .fps-toc-navigation {
        flex-direction: column;
        gap: 12px;
    }
    
    .fps-toc-dropdown-container {
        width: 100%;
        order: 0; /* Reset order for mobile */
    }
    
    .fps-toc-nav-buttons-row {
        display: flex; /* Override display: contents for mobile */
        gap: 10px;
        width: 100%;
        order: 1; /* Buttons below dropdown on mobile */
    }
    
    .fps-toc-nav-button {
        flex: 1;
        min-width: auto;
        justify-content: center;
        order: unset; /* Reset order for mobile */
    }
    
    .fps-toc-nav-link {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
    }
    
    .fps-toc-nav-text {
        display: inline; /* Show text on mobile when there's space */
    }
    
    .fps-toc-nav-placeholder {
        width: 100%;
        height: 44px;
    }
    
    .fps-toc-dropdown {
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}